mirror of
https://github.com/corda/corda.git
synced 2025-04-12 05:40:48 +00:00
convert to nanos from seconds rather than milliseconds when parsing JUnit xml (#5666)
* convert to nanos from seconds rather than milliseconds * fix tests
This commit is contained in:
parent
5a0b8c7992
commit
f7e0ce6f0b
@ -328,7 +328,7 @@ public class TestDurationArtifacts {
|
||||
|
||||
// If the test doesn't have a duration (it should), we return zero.
|
||||
if (!(testName.isEmpty() || testClassName.isEmpty())) {
|
||||
final long nanos = !testDuration.isEmpty() ? (long) (Double.parseDouble(testDuration) * 1000000.0) : 0L;
|
||||
final long nanos = !testDuration.isEmpty() ? (long) (Double.parseDouble(testDuration) * 1_000_000_000.0) : 0L;
|
||||
results.add(new Tuple2<>(testClassName + "." + testName, nanos));
|
||||
} else {
|
||||
LOG.warn("Bad test in junit xml: name={} className={}", testName, testClassName);
|
||||
|
@ -38,7 +38,7 @@ public class TestDurationArtifactsTest {
|
||||
" </properties>\n");
|
||||
|
||||
for (Tuple2<String, Long> test : tests) {
|
||||
Double d = ((double) test.getSecond()) / 1_000_000;
|
||||
Double d = ((double) test.getSecond()) / 1_000_000_000.0;
|
||||
sb.append(" <testcase assertions=\"\" classname=\"" + CLASSNAME + "\" name=\""
|
||||
+ test.getFirst() + "\" status=\"\" time=\"" + d.toString() + "\">\n" +
|
||||
" <skipped/>\n" +
|
||||
@ -67,7 +67,7 @@ public class TestDurationArtifactsTest {
|
||||
" </properties>\n");
|
||||
|
||||
for (Tuple2<String, Long> test : tests) {
|
||||
Double d = ((double) test.getSecond()) / 1_000_000;
|
||||
Double d = ((double) test.getSecond()) / 1_000_000_000.0;
|
||||
sb.append(" <testcase assertions=\"\" classname=\"" + CLASSNAME + "\" name=\""
|
||||
+ test.getFirst() + "\" status=\"\" time=\"\">\n" +
|
||||
" <skipped/>\n" +
|
||||
@ -88,8 +88,8 @@ public class TestDurationArtifactsTest {
|
||||
@Test
|
||||
public void fromJunitXml() {
|
||||
List<Tuple2<String, Long>> tests = new ArrayList<>();
|
||||
tests.add(new Tuple2<>("TEST-A", 111_000_000L));
|
||||
tests.add(new Tuple2<>("TEST-B", 222_200_000L));
|
||||
tests.add(new Tuple2<>("TEST-A", 111_000_000_000L));
|
||||
tests.add(new Tuple2<>("TEST-B", 222_200_000_000L));
|
||||
final String xml = getXml(tests);
|
||||
|
||||
List<Tuple2<String, Long>> results
|
||||
@ -100,9 +100,9 @@ public class TestDurationArtifactsTest {
|
||||
Assert.assertFalse("Should have results", results.isEmpty());
|
||||
Assert.assertEquals(results.size(), 2);
|
||||
Assert.assertEquals(CLASSNAME + "." + "TEST-A", results.get(0).getFirst());
|
||||
Assert.assertEquals(111_000_000L, results.get(0).getSecond().longValue());
|
||||
Assert.assertEquals(111_000_000_000L, results.get(0).getSecond().longValue());
|
||||
Assert.assertEquals(CLASSNAME + "." + "TEST-B", results.get(1).getFirst());
|
||||
Assert.assertEquals(222_200_000L, results.get(1).getSecond().longValue());
|
||||
Assert.assertEquals(222_200_000_000L, results.get(1).getSecond().longValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user