public void RunTwoParams() { doc.LoadXml("<seeflaw><param name='param1' value='Arne'/><param name='param2' argument='user'/></seeflaw>"); argDic.Add("user", "Kalle"); seeFlaw = new SeeFlaw(); seeFlaw.AddDetails(doc, null, resultDoc, argDic, null, null); seeFlaw.SetTestTime(); seeFlaw.RunTestCase(); string expected = "<h1><center>SeeFlaw v1.0 run</center></h1><br />"; expected += "<h2>testfile</h2><br />"; expected += "<table border=\"0\" cellpadding=\"0\" class=\"step_passed\"><tr><td><table width=\"100%\">"; expected += "<tr><th align=\"left\" bgcolor=\"lightgreen\" class=\"title\">param</th></tr></table></td></tr>"; expected += "<tr><td><table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">"; expected += "<tr><td class=\"status_passed\">Type</td><td bgcolor=\"#AAAAFF\" class=\"input_title\">name</td><td bgcolor=\"#AAAAFF\" class=\"input_title\">value</td><td bgcolor=\"#AAAAFF\" class=\"input_title\">argument</td><td bgcolor=\"#EEAAFF\" class=\"output_title\" colspan=\"2\">read_value</td></tr>"; expected += "<tr><td bgcolor=\"lightgreen\" class=\"statusvalue_passed\">Param</td><td bgcolor=\"#CCCCFF\" class=\"input_value\">param1</td><td bgcolor=\"#CCCCFF\" class=\"input_value\">Arne</td><td bgcolor=\"#CCCCFF\" class=\"input_value\" /><td bgcolor=\"lightgreen\" class=\"outputvalue_passed\" colspan=\"2\" /></tr>"; expected += "<tr><td bgcolor=\"lightgreen\" class=\"statusvalue_passed\">Param</td><td bgcolor=\"#CCCCFF\" class=\"input_value\">param2</td><td bgcolor=\"#CCCCFF\" class=\"input_value\" /><td bgcolor=\"#CCCCFF\" class=\"input_value\">user</td><td bgcolor=\"lightgreen\" class=\"outputvalue_passed\" colspan=\"2\">Kalle</td></tr>"; expected += "</table></td></tr></table><br />"; System.Console.WriteLine(resultDoc.FirstChild.InnerXml); NUnit.Framework.Assert.AreEqual(expected, resultDoc.FirstChild.LastChild.InnerXml); }
public void RunTextTest() { string testXml = "<seeflaw><text>Comment1 line1</text><text>Comment1 line2</text><call fixture='SeeFlawRunner.ExampleFixture' method='SingleOutputExampleMethod'><input name='Arne'/><output message='Hello Arne'/></call><text>Comment2</text></seeflaw>"; doc.LoadXml(testXml); seeFlaw = new SeeFlaw(); seeFlaw.AddDetails(doc, null, resultDoc, argDic, null, null); seeFlaw.SetTestTime(); XmlDocument loadDoc = new XmlDocument(); XmlElement resultElement = resultDoc.CreateElement("seeflawresult"); bool successful = seeFlaw.RunTest(doc.GetElementsByTagName("seeflaw")[0], resultElement); System.Console.WriteLine(resultElement.OuterXml); seeFlaw.TransformToHtml(resultElement); XmlNode resultNode = resultDoc.FirstChild.LastChild; string expected = "<table border=\"1\" cellpadding=\"0\" class=\"step_text\"><tr><td><table width=\"100%\" bgcolor=\"yellow\">"; expected += "<tr><th align=\"left\" class=\"text\">Comment1 line1</th></tr>"; expected += "<tr><th align=\"left\" class=\"text\">Comment1 line2</th></tr>"; expected += "</table></td></tr></table><br />"; expected += "<table border=\"0\" cellpadding=\"0\" class=\"step_passed\"><tr><td><table width=\"100%\">"; expected += "<tr><th align=\"left\" bgcolor=\"lightgreen\" class=\"title\">SeeFlawRunner.ExampleFixture : SingleOutputExampleMethod</th></tr></table></td></tr>"; expected += "<tr><td><table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">"; expected += "<tr><td class=\"status_passed\">Type</td><td class=\"time_value\">Time</td><td bgcolor=\"#AAAAFF\" class=\"input_title\">name</td><td bgcolor=\"#EEAAFF\" class=\"output_title\" colspan=\"2\">message</td></tr>"; expected += "<tr><td bgcolor=\"lightgreen\" class=\"statusvalue_passed\">Match</td><td class=\"time_value\">(00:00:00)</td><td bgcolor=\"#CCCCFF\" class=\"input_value\">Arne</td><td bgcolor=\"lightgreen\" class=\"outputvalue_passed\" colspan=\"2\">Hello Arne</td></tr>"; expected += "</table></td></tr></table><br />"; expected += "<table border=\"1\" cellpadding=\"0\" class=\"step_text\"><tr><td><table width=\"100%\" bgcolor=\"yellow\">"; expected += "<tr><th align=\"left\" class=\"text\">Comment2</th></tr>"; expected += "</table></td></tr></table><br />"; System.Console.WriteLine(resultNode.InnerXml); NUnit.Framework.Assert.AreEqual(expected, resultNode.InnerXml); }
public void RunSingleTestWithParamValue() { doc.LoadXml("<seeflaw><param name='param1' value='Arne'/><call fixture='SeeFlawRunner.ExampleFixture' method='SingleOutputExampleMethod'><input name='param1'/><output message='Hello Arne'/></call></seeflaw>"); seeFlaw = new SeeFlaw(); seeFlaw.AddDetails(doc, null, resultDoc, argDic, null, null); seeFlaw.SetTestTime(); seeFlaw.RunTestCase(); XmlNode resultNode = resultDoc.FirstChild.LastChild; string expected = "<h1><center>SeeFlaw v1.0 run</center></h1><br />"; expected += "<h2>testfile</h2><br />"; expected += "<table border=\"0\" cellpadding=\"0\" class=\"step_passed\"><tr><td><table width=\"100%\">"; expected += "<tr><th align=\"left\" bgcolor=\"lightgreen\" class=\"title\">param</th></tr></table></td></tr>"; expected += "<tr><td><table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">"; expected += "<tr><td class=\"status_passed\">Type</td><td bgcolor=\"#AAAAFF\" class=\"input_title\">name</td><td bgcolor=\"#AAAAFF\" class=\"input_title\">value</td></tr>"; expected += "<tr><td bgcolor=\"lightgreen\" class=\"statusvalue_passed\">Param</td><td bgcolor=\"#CCCCFF\" class=\"input_value\">param1</td><td bgcolor=\"#CCCCFF\" class=\"input_value\">Arne</td></tr>"; expected += "</table></td></tr></table><br />"; expected += "<table border=\"0\" cellpadding=\"0\" class=\"step_passed\"><tr><td><table width=\"100%\">"; expected += "<tr><th align=\"left\" bgcolor=\"lightgreen\" class=\"title\">SeeFlawRunner.ExampleFixture : SingleOutputExampleMethod</th></tr></table></td></tr>"; expected += "<tr><td><table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">"; expected += "<tr><td class=\"status_passed\">Type</td><td class=\"time_value\">Time</td><td bgcolor=\"#AAAAFF\" class=\"input_title\">name</td><td bgcolor=\"#EEAAFF\" class=\"output_title\" colspan=\"2\">message</td></tr>"; expected += "<tr><td bgcolor=\"lightgreen\" class=\"statusvalue_passed\">Match</td><td class=\"time_value\">(00:00:00)</td><td bgcolor=\"#CCCCFF\" class=\"input_value\">Arne</td><td bgcolor=\"lightgreen\" class=\"outputvalue_passed\" colspan=\"2\">Hello Arne</td></tr>"; expected += "</table></td></tr></table><br />"; System.Console.WriteLine(resultNode.InnerXml); NUnit.Framework.Assert.AreEqual(expected, resultNode.InnerXml); }
public void RunTest() { doc.LoadXml(xml); argDic["testfile"] = "xml"; seeFlaw = new SeeFlaw(); seeFlaw.AddDetails(doc, resultDoc, htmlDoc, argDic, null, null); seeFlaw.SetTestTime(); seeFlaw.RunTestCase(); System.Console.WriteLine(resultDoc.FirstChild.OuterXml); System.Console.WriteLine(htmlDoc.FirstChild.OuterXml); }
public void RunSingleTestFixtureException() { doc.LoadXml("<seeflaw><call fixture='SeeFlawRunner.ExampleFixture' method='SingleOutputExampleMethod'><input test='error'/><output message='some'/></call></seeflaw>"); seeFlaw = new SeeFlaw(); seeFlaw.AddDetails(doc, resultDoc, htmlDoc, argDic, null, null); seeFlaw.SetTestTime(); seeFlaw.RunTestCase(); System.Console.WriteLine(resultDoc.FirstChild.OuterXml); XmlNode bodyNode = htmlDoc.FirstChild.LastChild; string expected = "<h1><center>SeeFlaw v1.0 run</center></h1><br />"; expected += "<h2>testfile</h2><br />"; expected += "<table border=\"0\" cellpadding=\"0\" class=\"step_error\"><tr><td><table width=\"100%\">"; expected += "<tr><th align=\"left\" bgcolor=\"#FF5555\" class=\"title\">SeeFlawRunner.ExampleFixture : SingleOutputExampleMethod</th></tr></table></td></tr>"; expected += "<tr><td><table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">"; expected += "<tr><td class=\"status_error\">Type</td><td class=\"time_value\">Time</td><td bgcolor=\"#AAAAFF\" class=\"input_title\">test</td><td bgcolor=\"#EEAAFF\" class=\"output_title\" colspan=\"2\">message</td></tr>"; expected += "<tr><td bgcolor=\"#FF0000\" class=\"statusvalue_error\"><a href=\"#Exception1\">Exception1</a></td><td class=\"time_value\">(00:00:00)</td><td bgcolor=\"#CCCCFF\" class=\"input_value\">error</td><td bgcolor=\"#BBBBBB\" class=\"outputvalue_unprocessed\" colspan=\"2\">some</td></tr>"; expected += "</table></td></tr></table>"; expected += "<br /><h2>Exceptions Listing</h2>"; expected += "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">"; expected += "<tr><td valign=\"top\"><a name=\"Exception1\">Exception1</a></td>"; expected += "<td valign=\"top\"><pre valign=\"top\">Mandatory input 'name' missing."; System.Console.WriteLine(bodyNode.OuterXml); int length = System.Math.Min(expected.Length, bodyNode.InnerXml.Length - 1); string resultStr = bodyNode.InnerXml.Substring(0, length); NUnit.Framework.Assert.AreEqual(expected, resultStr); }