[
http://jira.codehaus.org/browse/SUREFIRE-433?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dan Fabulich updated SUREFIRE-433:
--
Description:
When running a directory of Junit tests, surefire will generate a
TEST-(full-classname).xml per test class in the surefire-reports directory.
Each XML will contain a testcase for each method in the given class.
However when runnign TestNG test, surefire only generates one
Test-TestSuite.xml in the surefire-reports directory. This xml contains a
testcase per test method for all the classes in the given project.
This is a problem since it breaks the surefire-report.
- The report wil have a class section with one row, The class name in the row
will be TestSuite
- The report will have a package section with one row. The package name in the
row will be empty. ("TestSuite" contains no dot so no package)
- Proberly unrelated, but any < or > characters appers on the page as < and
>
I have looked a bit at the code and the problem appears to be that in SureFire
TestNG Runner(surefire-testng) the methods
- org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.startTestSuite(...)
- org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.finishTestSuite(...)
is only called once, and inside it uses a hardcoded "TestSuite" for the name.
I think it should be called for each class and passed the full classname as
name parameter.
I will attach a simple maven project that shows the problem.
was:
When running Junit test, surefire will generate a TEST-(full-classname).xml per
test class in the surefire-reports directory. Each XML will contain a testcase
for each method in the given class.
However when runnign TestNG test, surefire only generates one
Test-TestSuite.xml in the surefire-reports directory. This xml contains a
testcase per test method for all the classes in the given project.
This is a problem since it breaks the surefire-report.
- The report wil have a class section with one row, The class name in the row
will be TestSuite
- The report will have a package section with one row. The package name in the
row will be empty. ("TestSuite" contains no dot so no package)
- Proberly unrelated, but any < or > characters appers on the page as < and
>
I have looked a bit at the code and the problem appears to be that in SureFire
TestNG Runner(surefire-testng) the methods
- org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.startTestSuite(...)
- org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.finishTestSuite(...)
is only called once, and inside it uses a hardcoded "TestSuite" for the name.
I think it should be called for each class and passed the full classname as
name parameter.
I will attach a simple maven project that shows the problem.
Component/s: (was: TestNG support)
xml generation
report plugin
Summary: All tests run in a single execution are reported as coming
from just one class (was: Surefire gathers all tests tun in a single
TEST-TestSuite.xml instead of one per class as with Junit)
In fact, the same thing happens when you create a JUnit TestSuite that includes
tests from other classes: Maven generates just one XML file for the entire
TestSuite.
Testing in Ant 1.7, I see that Ant does the same thing, too. However, Ant
includes a "classname" attribute on every testcase, which the report can use to
guess what suite you're in.
The fix for this is to include the classname attribute on the generated XML and
to honor it in the report plugin.
> All tests run in a single execution are reported as coming from just one class
> --
>
> Key: SUREFIRE-433
> URL: http://jira.codehaus.org/browse/SUREFIRE-433
> Project: Maven Surefire
> Issue Type: Bug
> Components: report plugin, xml generation
>Affects Versions: 2.4
> Environment: Linux, maven 2.0.8, surefire 2.4, TestNg 5.7
>Reporter: Henrik Lynggaard
> Attachments: bug-example.zip, testng-dir-suite-it.patch
>
>
> When running a directory of Junit tests, surefire will generate a
> TEST-(full-classname).xml per test class in the surefire-reports directory.
> Each XML will contain a testcase for each method in the given class.
> However when runnign TestNG test, surefire only generates one
> Test-TestSuite.xml in the surefire-reports directory. This xml contains a
> testcase per test method for all the classes in the given project.
> This is a problem since it breaks the surefire-report.
> - The report wil have a class section with one row, The class name in the row
> will be TestSuite
> - The report will have a package section with one row. The package name in
> the row will be empty. ("TestSuite" contains no dot so no package)
> - Proberly unrelated, but any < or > char