Junit5 migration

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Junit5 migration

kiwiwings
Hi Devs,

I've finished the migration to Junit5 for the ant target.
I'm now focusing on the maven builds, but I don't expect problems with the surefire plugin.

The following changes will be visible after I committed the 1000+ file changes:

a) Junit5 uses different annotations and different packages

b) expected exceptions are now handled via assertThrows

c) ant lacks support for direct test feedback - see https://bz.apache.org/bugzilla/show_bug.cgi?id=64836
   I'm using a custom test listener to print the summary, but this will only be shown when all tests of the current module are processed

d) JaCoCo is not handling Junit5 in the "coverage" tag - see https://github.com/jacoco/jacoco/issues/673
   I've worked around it with the "agent" tag, but I haven't test it yet

e) I've deleted all TestSuites (like AllFormulaTests)  locally, as the described annotations weren't found.
   now that I have all the junit plattform dependencies available, I might revert/migrate those to the Junit5 - see https://howtodoinjava.com/junit5/junit5-test-suites-examples/

Now (i.e. before I commit the tests) would be a good time to give me your two pence.


Background info:
it all started when I've seen the migration wizard in IntelliJ and thought, it might be a piece of cake to convert our tests.
But 3-5 days later after cumbersome copy&pasting the test comment from the left to the right of assertEquals(<comment>, ...), I've realized that I could have done it more efficiently with IntelliJs structural search replacement.
After fixing all the compile errors, I've realized that various tools (ant, junitlauncher, JaCoCo) might have also some homework to do with Junit5. But after spending/wasting so much time, I'm reluctant to go back to Junit4 just because we might have a problem with the gradle builds (which I probably don't convert) ... you probably know that psychological effect, that given a certain amount of time(/money) spent, one is unable to reflect and go back ... just like with our airport in Berlin ...
In general I would say the move to Junit5 makes sense, as this is were the current development of the junit team takes place, even when we discover a few more bumps.

Andi


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Junit5 migration

Dominik Stadler
FYI, I ran into a bug in Apache Ant locally caused by invalid XML in the
test-result-files which prevents test-reports from being created, see
https://bz.apache.org/bugzilla/show_bug.cgi?id=65030, seems the new
"junitlauncher" and support for JUnit 5 is a bit "rough around the edges"
still in Apache Ant as there are a few more bug-reports...


Workaround for me was to unset some environment-variables which include
some ESC-control-char:

unset LESS_TERMCAP_mb=
unset LESS_TERMCAP_md=
unset LESS_TERMCAP_me=
unset LESS_TERMCAP_se=
unset LESS_TERMCAP_so=
unset LESS_TERMCAP_us=


Regards... Dominik.


On Wed, Dec 23, 2020 at 8:09 PM Andreas Beeker <[hidden email]> wrote:

> Hi Devs,
>
> I've finished the migration to Junit5 for the ant target.
> I'm now focusing on the maven builds, but I don't expect problems with the
> surefire plugin.
>
> The following changes will be visible after I committed the 1000+ file
> changes:
>
> a) Junit5 uses different annotations and different packages
>
> b) expected exceptions are now handled via assertThrows
>
> c) ant lacks support for direct test feedback - see
> https://bz.apache.org/bugzilla/show_bug.cgi?id=64836
>    I'm using a custom test listener to print the summary, but this will
> only be shown when all tests of the current module are processed
>
> d) JaCoCo is not handling Junit5 in the "coverage" tag - see
> https://github.com/jacoco/jacoco/issues/673
>    I've worked around it with the "agent" tag, but I haven't test it yet
>
> e) I've deleted all TestSuites (like AllFormulaTests)  locally, as the
> described annotations weren't found.
>    now that I have all the junit plattform dependencies available, I might
> revert/migrate those to the Junit5 - see
> https://howtodoinjava.com/junit5/junit5-test-suites-examples/
>
> Now (i.e. before I commit the tests) would be a good time to give me your
> two pence.
>
>
> Background info:
> it all started when I've seen the migration wizard in IntelliJ and
> thought, it might be a piece of cake to convert our tests.
> But 3-5 days later after cumbersome copy&pasting the test comment from the
> left to the right of assertEquals(<comment>, ...), I've realized that I
> could have done it more efficiently with IntelliJs structural search
> replacement.
> After fixing all the compile errors, I've realized that various tools
> (ant, junitlauncher, JaCoCo) might have also some homework to do with
> Junit5. But after spending/wasting so much time, I'm reluctant to go back
> to Junit4 just because we might have a problem with the gradle builds
> (which I probably don't convert) ... you probably know that psychological
> effect, that given a certain amount of time(/money) spent, one is unable to
> reflect and go back ... just like with our airport in Berlin ...
> In general I would say the move to Junit5 makes sense, as this is were the
> current development of the junit team takes place, even when we discover a
> few more bumps.
>
> Andi
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>