public static List <TestSuite> Parse(string path) { XDocument doc = XDocument.Load(path); env = Environment.InitFromXElement(doc.Root.Element("environment")); List <TestSuite> testFixtures = new List <TestSuite>(); var globalTestSuites = doc.Root.Element("test-suite").Element("results").Elements("test-suite"); foreach (XElement testSuite in globalTestSuites) { Console.WriteLine(testSuite.Attribute("name")); var _testSuites = testSuite.Element("results").Elements("test-suite"); foreach (XElement ts in _testSuites) { Console.WriteLine(ts.Attribute("name")); var nTests = ts.Element("results").Elements("test-suite"); //TestSuite tt = TestSuite.Parse(ts); TestSuite tt = new TestSuite(); tt.Parse(ts); testFixtures.Add(tt); Console.WriteLine(tt.Name); } } TestFixture = testFixtures.FirstOrDefault(); return(testFixtures); }
public override void Parse(XElement testSuite) { //TestSuite tt = InitFromXElement(testSuite); this.InitAttributeFromXElement(testSuite); string reason = testSuite.Element("reason")?.Element("message")?.Value; this.Reason = reason; var results = testSuite.Element("results"); var subTS = results.Elements("test-suite"); foreach (XElement _testSuite in subTS) { //TestSuite ttt = TestSuite.Parse(_testSuite); TestSuite ttt = new TestSuite(); ttt.Parse(_testSuite); this.TestSuites.Add(ttt); } var testCases = results.Elements("test-case"); foreach (XElement testCase in testCases) { TestCase test = new TestCase(); test.Parse(testCase); this.TestCases.Add(test); } //return this; }
public static List<TestSuite> Parse(string path) { XDocument doc = XDocument.Load(path); env = Environment.InitFromXElement(doc.Root.Element("environment")); List<TestSuite> testFixtures = new List<TestSuite>(); var globalTestSuites = doc.Root.Element("test-suite").Element("results").Elements("test-suite"); foreach (XElement testSuite in globalTestSuites) { Console.WriteLine(testSuite.Attribute("name")); var _testSuites = testSuite.Element("results").Elements("test-suite"); foreach (XElement ts in _testSuites) { Console.WriteLine(ts.Attribute("name")); var nTests = ts.Element("results").Elements("test-suite"); //TestSuite tt = TestSuite.Parse(ts); TestSuite tt = new TestSuite(); tt.Parse(ts); testFixtures.Add(tt); Console.WriteLine(tt.Name); } } TestFixture = testFixtures.FirstOrDefault(); return testFixtures; }