public void Will_generate_junit_xml() { var transformer = new JUnitXmlTransformer(); var summary = BuildTestCaseSummary(); var expected = @"<?xml version=""1.0"" encoding=""UTF-8"" ?> <testsuites> <testsuite name=""path1"" tests=""2"" failures=""1"" time=""1500""> <testcase name=""module1:test1"" time=""1000""> <failure message=""some failure""></failure> </testcase> <testcase name=""module1:test2"" time=""500"" /> </testsuite> <testsuite name=""path>2"" tests=""2"" failures=""1"" time=""2000""> <testcase name=""test3"" time=""1000"" /> <testcase name=""test<4"" time=""1000""> <failure message=""bad<failure""></failure> </testcase> </testsuite> </testsuites> "; var result = transformer.Transform(summary); Assert.Equal(expected, result); }
public void Will_generate_junit_xml() { var transformer = new JUnitXmlTransformer(GetFileSystemWrapper()); var summary = BuildTestCaseSummary(); var expectedFormat = @"<?xml version=""1.0"" encoding=""UTF-8"" ?> <testsuites> <testsuite name=""path1"" tests=""2"" failures=""1"" time=""{0}""> <testcase name=""module1:test1"" time=""1""> <failure message=""some failure""></failure> </testcase> <testcase name=""module1:test2"" time=""{1}"" /> </testsuite> <testsuite name=""path>2"" tests=""2"" failures=""1"" time=""2""> <testcase name=""test3"" time=""1"" /> <testcase name=""test<4"" time=""1""> <failure message=""bad<failure""></failure> </testcase> </testsuite> </testsuites> "; var result = transformer.Transform(summary); var expected = string.Format(expectedFormat, 1.5.ToString(), 0.5.ToString()); Assert.Equal(expected, result); }
public void Will_throw_if_test_summary_is_null() { var transformer = new JUnitXmlTransformer(); Exception ex = Record.Exception(() => transformer.Transform(null)); Assert.IsType <ArgumentNullException>(ex); }