public void Build() { // if (Environment.GetEnvironmentVariables().Contains("START_DEBUG")) // System.Diagnostics.Debugger.Launch (); ReadLists(); XmlDocument whole = new XmlDocument(); whole.Load(@"testsuite/TESTS/catalog-fixed.xml"); foreach (XmlElement testCase in whole.SelectNodes("test-suite/test-catalog/test-case")) { string testid = testCase.GetAttribute("id"); if (skipTargets.Contains(testid)) { continue; } CatalogTestCase ctc = new CatalogTestCase(EnvOptions.OutputDir, testCase); if (!ctc.Process()) { continue; } SingleTestTransform stt = new SingleTestTransform(ctc); string expectedException = (string)expectedExceptions[testid]; bool isKnownFailure = knownFailures.Contains(testid) || fixmeList.Contains(testid); _suite.Add(new TestFromCatalog(testid, stt, expectedException, EnvOptions.InverseResults, isKnownFailure)); } }
void Build (TestSuite suite) { // if (Environment.GetEnvironmentVariables().Contains("START_DEBUG")) // System.Diagnostics.Debugger.Launch (); ReadLists (); XmlDocument whole = new XmlDocument (); whole.Load (@"testsuite/TESTS/catalog-fixed.xml"); foreach (XmlElement testCase in whole.SelectNodes ("test-suite/test-catalog/test-case")) { string testid = testCase.GetAttribute ("id"); if (skipTargets.Contains (testid)) continue; CatalogTestCase ctc = new CatalogTestCase(EnvOptions.OutputDir, testCase); if (!ctc.Process ()) continue; SingleTestTransform stt = new SingleTestTransform (ctc); string expectedException = (string) expectedExceptions[testid]; bool isKnownFailure = knownFailures.Contains (testid) || fixmeList.Contains (testid); suite.Add (new TestFromCatalog (testid, stt, expectedException, EnvOptions.InverseResults, isKnownFailure)); } }
void ProcessTestCase(XmlElement testCase) { string testid = testCase.GetAttribute("id"); Console.Out.WriteLine(testid); if (skipTargets.Contains(testid)) { return; } CatalogTestCase ctc = new CatalogTestCase(EnvOptions.OutputDir, testCase); if (!ctc.Process()) { return; } SingleTestTransform stt = new SingleTestTransform(ctc); stt.RunTest(); if (stt.Succeeded) { using (StreamWriter fw = new StreamWriter(ctc.OutFile, false, Encoding.UTF8)) fw.Write(stt.Result); } else { resultExceptionsWriter.WriteLine("{0}\t{1}", testid, stt.Exception.GetType().ToString()); } }
void ProcessTestCase (XmlElement testCase) { string testid = testCase.GetAttribute ("id"); Console.Out.WriteLine (testid); if (skipTargets.Contains (testid)) return; CatalogTestCase ctc = new CatalogTestCase(EnvOptions.OutputDir, testCase); if (!ctc.Process ()) return; SingleTestTransform stt = new SingleTestTransform (ctc); stt.RunTest (); if (stt.Succeeded) using (StreamWriter fw = new StreamWriter (ctc.OutFile, false, Encoding.UTF8)) fw.Write (stt.Result); else resultExceptionsWriter.WriteLine ("{0}\t{1}", testid, stt.Exception.GetType ().ToString ()); }
string CompareResult (string actual, string expected, CatalogTestCase.CompareType compare) { //TODO: add html comparison if (compare== CatalogTestCase.CompareType.XML) { try { XmlDocument actDoc = new XmlDocument(); XmlDocument expDoc = new XmlDocument(); actDoc.LoadXml (actual); expDoc.LoadXml (expected); XmlCompare.XmlCompare cmp = new XmlCompare.XmlCompare(XmlCompare.XmlCompare.Flags.IgnoreAttribOrder); if (cmp.AreEqual (actDoc, expDoc)) { return null; } } catch (Exception ex) { //could not compare as xml, fallback to text if (actual == expected) return null; } } else if (actual == expected) return null; string res = "Different.\nActual*****\n"+actual+"\nReference*****\n"+expected; return EscapeString (res); }
public SingleTestTransform(CatalogTestCase testCase) { _testCase = testCase; }
public SingleTestTransform (CatalogTestCase testCase) { _testCase = testCase; }