Skip to content

Commit

Permalink
Merge pull request #429 from soid/duration-in-history
Browse files Browse the repository at this point in the history
JENKINS-13377 test suite duration may be calculated wrong
  • Loading branch information
kutzi committed Apr 8, 2012
2 parents 5432576 + f8a0fc0 commit e330af1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/src/main/java/hudson/tasks/junit/TestResult.java
Expand Up @@ -200,6 +200,7 @@ private void add(SuiteResult sr) {
s.addCase(cr);
cr.replaceParent(s);
}
duration += sr.getDuration();
return;
}
}
Expand Down
4 changes: 4 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 All @@ -139,6 +142,7 @@ public void testDuplicatedTestSuiteIsNotCounted() throws IOException, URISyntaxE

assertEquals("Wrong number of testsuites", 1, testResult.getSuites().size());
assertEquals("Wrong number of test cases", 1, testResult.getTotalCount());
assertEquals("Wrong duration for test result", 1.0, testResult.getDuration(), 0.01);
}

private static final XStream XSTREAM = new XStream2();
Expand Down

0 comments on commit e330af1

Please sign in to comment.