[ 
https://issues.apache.org/jira/browse/IGNITE-10958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17276576#comment-17276576
 ] 

Yaroslav Molochkov edited comment on IGNITE-10958 at 2/2/21, 9:56 AM:
----------------------------------------------------------------------

Right now we, contrary to comments in other tickets, particularly here 
IGNITE-10973, we are not quite ready to migrate, because of two main things, 
that ignite tests rely heavily upon: suites and parameterized tests.

Thing about suites is it's done with an old api using static methods to gather 
all needed classes in particular suite. That won't be an issue if JU5 would 
have supported that feature, but current solution is to use @RunWith and 
@SelectClasses/@SelectPackages. And the discussion about it is here 
https://github.com/junit-team/junit5/issues/744. This should be available 
relatively shortly and without that feature there would be a lot of repeated 
code. The worst part -- @BeforeClass and it's new JU5 version @BeforeAll 
doesn't work in suites right now. It is also mentioned in #744

The parameterised tests is another big issue: current JU5 version supports 
@ParameteizedTest which executes single test with several parameters (actually 
a stream of params). We have several tests that rely on exact opposite 
mechanism: run all tests in a class with one params preset, change preset and 
run all of the tests again, etc. This feature is requested and it would be very 
nice to have, otherwise some test runs would take forever or simply time out. 
Discussion about that feature is here 
https://stackoverflow.com/questions/54260954/junit-5-multiple-parametrized-tests-with-same-parameters-migrate-parameterized.
 

To sum it up: not ready for JU5 without some custom questionable mechanisms. 
The description to the whole migration process is quite inaccurate and is 
available here 
https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4. 

Made some progress in migrating ignite to JU5 here 
https://github.com/ymolochkov/ignite/tree/junit5




was (Author: yamolochkov):
Right now we, contrary to comments in other tickets, particularly here 
IGNITE-10973, we are not quite ready to migrate, because of two main things, 
that ignite tests rely heavily upon: suites and parameterized tests.

Thing about suites is it's done with an old api using static methods to gather 
all needed classes in particular suite. That won't be an issue if JU5 would 
have supported that feature, but current solution is to use @RunWith and 
@SelectClasses/@SelectPackages. And the discussion about it is here 
https://github.com/junit-team/junit5/issues/744. This should be available 
relatively shortly and without that feature there would be a lot of repeated 
code.

The parameterised tests is another big issue: current JU5 version supports 
@ParameteizedTest which executes single test with several parameters (actually 
a stream of params). We have several tests that rely on exact opposite 
mechanism: run all tests in a class with one params preset, change preset and 
run all of the tests again, etc. This feature is requested and it would be very 
nice to have, otherwise some test runs would take forever or simply time out. 
Discussion about that feature is here 
https://stackoverflow.com/questions/54260954/junit-5-multiple-parametrized-tests-with-same-parameters-migrate-parameterized.
 

To sum it up: not ready for JU5 without some custom questionable mechanisms. 
The description is quite inaccurate and is available here 
https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4. 

Made some progress in migrating ignite to JU5 here 
https://github.com/ymolochkov/ignite/tree/junit5



> Migrate from Junit 4 to 5
> -------------------------
>
>                 Key: IGNITE-10958
>                 URL: https://issues.apache.org/jira/browse/IGNITE-10958
>             Project: Ignite
>          Issue Type: Task
>            Reporter: Ivan Fedotov
>            Assignee: Yaroslav Molochkov
>            Priority: Major
>              Labels: iep-30
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Starting with maven-surefire-plugin version 2.22.0 there is full support for 
> JUnit 5 [1].
> Migration to the JUnit 5 includes multiple steps:
> 1. adding new JUnit dependencies to pom files. By artifactId: 
> junit-jupiter-engine, junit-vintage-engine, junit-platform-launcher, 
> junit-platform-runner
> 2. Replace all imports of old JUnit annotations by the newest: from 
> org.junit.Test to org.junit.jupiter.api.Test
> 3. Change annotations Before -> BeforeEach, After -> AfterEach, BeforeClass 
> -> BeforeAll, AfterClass -> AfterAll, Ignore -> Disabled, Categories -> Tag
> 4. Replace concept rules by extension model where it is necessary: 
> ExpectedException to assertThrows
> 5. Migrate Mockito tests: MockitoJUnitRunner becomes MockitoExtension
> 6. Update the Maven surefire plugin to make it work with JUnit 5 [1].
> 7. Replace checking timeouts according to JUnit 5 concept: via 
> {{@Test}}{{(timeout = }}{{1}}{{) or assertTimeout.}}
> 8. Change test suites running: @RunWith(Suit.class) to 
> @Runwith(JunitPlatform.class)
> Investigation about migration to JUnit5 is provided in the ticket 
> IGNITE-10180.
> [1] 
> [https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to