Skip to content

Commit

Permalink
finally added a test for JENKINS-6545
Browse files Browse the repository at this point in the history
  • Loading branch information
kutzi committed Jul 23, 2011
1 parent e121335 commit 073bd72
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/src/test/java/hudson/tasks/junit/SuiteResultTest.java
Expand Up @@ -56,6 +56,10 @@ private SuiteResult parseOne(File file) throws Exception {
assertEquals(1,results.size());
return results.get(0);
}

private List<SuiteResult> parseSuites(File file) throws Exception {
return SuiteResult.parse(file, false);
}

/**
* Verifying fix for issue #1233.
Expand Down Expand Up @@ -196,4 +200,16 @@ public void testErrorInTestInitialization() throws Exception {
assertEquals(1, result.getFailCount());
assertTrue(result.getErrorStackTrace() != null);
}

@Bug(6454)
public void testParseNestedTestSuites() throws Exception {
// A report with several nested suites
// 3 of them have actual some tests - each exactly one
List<SuiteResult> results = parseSuites(getDataFile("junit-report-nested-testsuites.xml"));
assertEquals(3, results.size());

for (SuiteResult result : results) {
assertEquals(1, result.getCases().size());
}
}
}
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Automated Tests" tests="186" errors="0" failures="0" ignored="0">
<testsuite name="test.AutomatedTests" time="4.486">
<testsuite name="test.fs.FileSystemTest" time="0.014">
<testcase name="testPrefix" classname="test.fs.FileSystemTest" time="0.003"/>
</testsuite>
<testsuite name="test.db.DatabaseTest" time="0.014">
<testsuite errors="1" failures="0" hostname="whatever" name="test.3rdlevel" tests="1" time="0.0" timestamp="2011-07-22T13:12:19">
<error message="bla bla" type="java.lang.IllegalStateException">java.lang.IllegalStateException: bla bla
at test.Test(Test:35)
</error>
</testsuite>
<testcase name="testTable" classname="test.db.DatabaseTest" time="0.003"/>
</testsuite>
</testsuite>
</testsuites>

0 comments on commit 073bd72

Please sign in to comment.