Skip to content

Commit

Permalink
JENKINS-13377 duration on history page bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
soid committed Apr 7, 2012
1 parent 5432576 commit 7921599
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/tasks/junit/TestResult.java
Expand Up @@ -185,6 +185,7 @@ public void parse(long buildTime, File baseDir, String[] reportFiles) throws IOE
}

private void add(SuiteResult sr) {
duration += sr.getDuration();
for (SuiteResult s : suites) {
// JENKINS-12457: If a testsuite is distributed over multiple files, merge it into a single SuiteResult:
if(s.getName().equals(sr.getName()) && nullSafeEq(s.getId(),sr.getId())) {
Expand All @@ -204,7 +205,6 @@ private void add(SuiteResult sr) {
}
}
suites.add(sr);
duration += sr.getDuration();
}

private boolean strictEq(Object lhs, Object rhs) {
Expand Down
3 changes: 3 additions & 0 deletions core/src/test/java/hudson/tasks/junit/TestResultTest.java
Expand Up @@ -125,6 +125,9 @@ public void testTestSuiteDistributedOverMultipleFilesIsCountedAsOne() throws IOE

assertEquals("Wrong number of testsuites", 1, testResult.getSuites().size());
assertEquals("Wrong number of test cases", 2, testResult.getTotalCount());

// check duration: 157.980 (TestSuite_a1.xml) and 15.000 (TestSuite_a2.xml) = 172.98
assertEquals("Wrong duration for test result", 172.98, testResult.getDuration(), 0.1);
}

/**
Expand Down

0 comments on commit 7921599

Please sign in to comment.