RFR: 8339515: [TestBug] Convert web tests to JUnit 5 [v6]

Jay Bhaskar jbhaskar at openjdk.org
Mon Sep 16 15:51:15 UTC 2024


On Mon, 16 Sep 2024 15:32:15 GMT, Jay Bhaskar <jbhaskar at openjdk.org> wrote:

>> @Maran23 is right.  In the absence of support for parameterized class-level tests the easiest solution (I think) is to parameterize every `@Test`, which means:
>> - add parameters to each method, replace `@Test` with `@ParameterizedTest` and `@MethodSource`
>> - add parameters to setup method (`@Before`, remove the annotation)
>> - call the setup method from each test method
>> - remove the fields that were set in the constructor and the constructor itself
>> 
>> Things might be a bit more complicated in the case of test class hierarchies, so additional work and checks will be needed.
>
> still some tests fail, after applying  solution as suggested.

When hashValue and expected are instance variables, they are initialized once per test case due to how JUnit creates a new instance of the test class for each @ParameterizedTest. This ensures that the state is clean between tests and no variable is shared between different test cases. So I think it is ok.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1567#discussion_r1761413603


More information about the openjfx-dev mailing list