public void Parse_AnXmlWith3Tests_3PassingTestsReturned()
        {
            const string xml = @"<?xml version=""1.0""?>
            <testsuite name=""Chrome 52.0.2743 (Windows 10 0.0.0)"" package="""" timestamp=""2016-08-05T16:35:32"" id=""0"" hostname=""DESKTOP-297BJKV"" tests=""3"" errors=""0"" failures=""0"" time=""0.001"">
              <properties>
            <property name=""browser.fullName"" value=""Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36""/>
              </properties>
              <testcase name=""blabla Should do something"" time=""0.001"" classname=""Chrome_52_0_2743_(Windows_10_0_0_0).blabla""/>
              <testcase name=""blabla Should do something else"" time=""0"" classname=""Chrome_52_0_2743_(Windows_10_0_0_0).blabla""/>
              <testcase name=""blabla Should pass"" time=""0"" classname=""Chrome_52_0_2743_(Windows_10_0_0_0).blabla""/>
              <system-out>
            <![CDATA[
            ]]>
              </system-out>
              <system-err/>
            </testsuite>";

            var parser = new JUnitResultsParser();

            var foundTestsResults = parser.Parse(xml);

            var expected = new[] {
                new KarmaTestResult("blabla Should do something", true),
                new KarmaTestResult("blabla Should do something else", true),
                new KarmaTestResult("blabla Should pass", true)
            };

            CollectionAssert.AreEquivalent(expected, foundTestsResults.ToArray());
        }
Exemple #2
0
        private static IEnumerable<KarmaTestResult> GetTestResults(IRunContext runContext)
        {
            var firstResultFile = Directory.EnumerateFiles(Path.Combine(@"C:\temp", "test-results"), "*.xml").First();

            string outputResults = File.ReadAllText(firstResultFile);

            var karmaResultsParser = new JUnitResultsParser();

            IEnumerable<KarmaTestResult> testResult = karmaResultsParser.Parse(outputResults);

            return testResult;
        }