I also really like this move, thanks for that. I have also experience with JUnit 5. And if there is something where I may can help I'm glad to do so.
For people who may don't know, this are the features JUnit5 gives us and I'm also excited about: - assertThrows(..) - assertDoesNotThrows(..) -> No more tests without any assert... :) - Parameterized tests are much easier to write and can be mixed with normal tests - We can provide a display name - We can provide better display names for parameterized test - We can decide where the value the parameterized test should use come from, this gives us the ability to have multiple parameterized tests in one class More: [1]https://junit.org/junit5/docs/current/user-guide/#writing-test s-parameterized-tests Example: Hopefully it's ok readable on the mailing list: ----- START ------ @DisplayName("A parameterized test with named arguments") @ParameterizedTest(name = "{0} should match with {1} (lower case)") @MethodSource("initData") void testToLowerCase(String string1, String string2) { assertEquals(string1, string2.toLowerCase()); } static Stream<Arguments> initData() { return Stream.of(of("aaa", "AAA"), of("bbb", "BBB"), of("ccc", "cCc")); } static Arguments of(String string1, String string2) { return Arguments.of(string1, string2); } ----- END------ -- Marius Gesendet: Samstag, 25. September 2021 um 15:23 Uhr Von: "Kevin Rushforth" <kevin.rushfo...@oracle.com> An: "Nir Lisker" <nlis...@gmail.com>, "John Hendrikx" <hj...@xs4all.nl> Cc: "openjfx-dev@openjdk.java.net Mailing" <openjfx-dev@openjdk.java.net> Betreff: Re: Gauging interest in updating the JavaFX test framework with JUnit 5 I also see advantages in moving to JUnit 5, given that we can still support both JUint 4 and JUnit 5 in the same project using jupiter-vintage (thus avoiding the need to rewrite existing tests). Do any other contributors have experiences with JUnit 5 that they could share? -- Kevin On 9/25/2021 12:16 AM, Nir Lisker wrote: > I much prefer JUnit 5 to 4, so I'm in favor. > > On Sat, Sep 25, 2021 at 12:40 AM John Hendrikx <hj...@xs4all.nl> wrote: > >> Posting this to gauge the interest in adding JUnit 5 as a test >> dependency to JavaFX, enabling writing tests with this new version of >> JUnit while still supporting all JUnit 4 tests. >> >> A draft PR has been submitted here: >> [2]https://github.com/openjdk/jfx/pull/633 >> >> And an issue has been filed here: >> [3]https://bugs.openjdk.java.net/browse/JDK-8274274 >> >> Although very personally motivated to be able to write nested unit tests >> in future JavaFX pull requests, I think this would be a great addition >> to have in our testing arsenal. >> >> The main benefits of using JUnit 5: >> >> Better integration with Java 8, specifically use of Lambda functions >> where this would make sense. For example `assertThrows` is really useful >> and can replace the `expected` parameter in the Test annotation >> (although this has also been backported to recent JUnit 4 versions). >> >> Support for better organization of tests (using Nested) and better >> naming. See this image to see Nested and naming in action: >> >> [4]https://user-images.githubusercontent.com/995917/111858133-d6ce0f80- 8936-11eb-9724-be2c15150590.png >> >> Better extension system allowing to combine extensions whereas JUnit 4 >> only allowed one extension at a time. >> >> Native support for parameterized tests, repeated tests, nested tests, >> conditional test execution (by platform or environment for example), >> assumptions, test generation and timeouts. >> >> Please let us know if you'd like to see a newer version of JUnit >> included in JavaFX to further ease testing :) >> >> --John >> >> >> >> References 1. https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests 2. https://github.com/openjdk/jfx/pull/633 3. https://bugs.openjdk.java.net/browse/JDK-8274274 4. https://user-images.githubusercontent.com/995917/111858133-d6ce0f80-8936-11eb-9724-be2c15150590.png