RFR: 7903753: Report duration of testng test methods [v2]
Jaikiran Pai
jpai at openjdk.org
Fri Jun 14 09:02:29 UTC 2024
On Fri, 14 Jun 2024 08:52:29 GMT, Christian Stein <cstein at openjdk.org> wrote:
>> Jaikiran Pai has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - update copyright year
>> - don't rely on testng's duration reporting instead use System.nanoTime() in listeners to track duration
>
> src/share/classes/com/sun/javatest/regtest/agent/TestNGRunner.java line 118:
>
>> 116: // keeps track of the test start time for each test
>> 117: private final Map<ITestResult, Long> startTimeNanos =
>> 118: Collections.synchronizedMap(new IdentityHashMap<>());
>
> Why didn't you use `java.util.concurrent.ConcurrentHashMap` here?
Hello Christian, we want the equality check of the key to be based on identity (since I don't think we can rely on the `equals()` implementation of `ITestResult`). ConcurrentHashMap uses `equals()` check unlike `IdentityHashMap` which uses `==`.
In the case of junit, where you used a ConcurrentHashMap, i think it's fine since the tests in junit appear to have a `UniqueId` unlike here where I don't see that construct exposed in testng.
-------------
PR Review Comment: https://git.openjdk.org/jtreg/pull/207#discussion_r1639510937
More information about the jtreg-dev
mailing list