提交 e330af12 编写于 作者: C Christoph Kutzinski

Merge pull request #429 from soid/duration-in-history

JENKINS-13377 test suite duration may be calculated wrong
...@@ -200,6 +200,7 @@ public final class TestResult extends MetaTabulatedResult { ...@@ -200,6 +200,7 @@ public final class TestResult extends MetaTabulatedResult {
s.addCase(cr); s.addCase(cr);
cr.replaceParent(s); cr.replaceParent(s);
} }
duration += sr.getDuration();
return; return;
} }
} }
......
...@@ -125,6 +125,9 @@ public class TestResultTest extends TestCase { ...@@ -125,6 +125,9 @@ public class TestResultTest extends TestCase {
assertEquals("Wrong number of testsuites", 1, testResult.getSuites().size()); assertEquals("Wrong number of testsuites", 1, testResult.getSuites().size());
assertEquals("Wrong number of test cases", 2, testResult.getTotalCount()); 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);
} }
/** /**
...@@ -139,6 +142,7 @@ public class TestResultTest extends TestCase { ...@@ -139,6 +142,7 @@ public class TestResultTest extends TestCase {
assertEquals("Wrong number of testsuites", 1, testResult.getSuites().size()); assertEquals("Wrong number of testsuites", 1, testResult.getSuites().size());
assertEquals("Wrong number of test cases", 1, testResult.getTotalCount()); 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(); private static final XStream XSTREAM = new XStream2();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册