You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Zoran Regvart <zo...@regvart.com> on 2018/05/23 08:07:36 UTC

JUnit5, was: testcontainers

Hi,
on the testcontainers thread I mentioned that we can switch to JUnit5.
I've attended a talk by Sam Brannen at the local JUG. I think it was a
variant of the talk[1] he gave at SpringOne 2017.

The key takeaway for me was that JUnit5 is forward and backward
compatible, so you can run the same tests written with JUnit4
annotations on JUnit5, but you can also run JUnit5 tests on JUnit4, if
for some reason that would make sense in a particular case.

What I understood is that we could upgrade to JUnit5 by simply
upgrading the surefire/failsafe Maven plugins and adding the
junit-vintage-engine dependency but only to a module that has mixed
JUnit4 and JUnit5 tests[2]. The only issue is limited @Rule support.

Now on to the benefits, I think it makes much sense to move over to
JUnit5 for the conditional test execution[3], better categorization of
tests via tags[4] and the much better extension model[5].

I propose that we schedule this for the one release after the pending
one (so in 2.23), and that we add camel-test-jupiter component that
would help developers write nicer tests for their integrations with
support for dependency injection for example[6].

zoran

[1] https://www.youtube.com/watch?v=h0Idcz71Aog
[2] https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4
[3] https://junit.org/junit5/docs/current/user-guide/#writing-tests-conditional-execution
[4] https://junit.org/junit5/docs/current/user-guide/#writing-tests-tagging-and-filtering
[5] https://junit.org/junit5/docs/current/user-guide/#extensions
[6] https://junit.org/junit5/docs/current/user-guide/#writing-tests-dependency-injection
-- 
Zoran Regvart

Re: JUnit5, was: testcontainers

Posted by Pascal Schumacher <pa...@gmx.net>.
Thanks for the information!

Part of camel already uses this version 
(https://github.com/apache/camel/commit/1ddd9311111d5cf2faea41e2d7454a9f04ed3985) 
and Zoran is looking into updating the remaining parts in 
https://issues.apache.org/jira/browse/CAMEL-12586

Cheers,
Pascal

Am 17.06.2018 um 00:29 schrieb David Karlsen:
> It is released now!
>
> Den ons. 23. mai 2018 kl. 10:32 skrev Zoran Regvart <zo...@regvart.com>:
>
>> Hi David,
>> yes we can wait for that and the Surefire/Failsafe release that
>> includes it. I think we can also add
>> org.junit.platform:junit-platform-surefire-provider:1.2.0 dependency
>> to the existing Surefire/Failsafe plugin configurations.
>>
>> As far as I understand that issue is tracking the incorporation of the
>> existing codebase from JUnit5 into Surefire.
>>
>> zoran
>>
>> On Wed, May 23, 2018 at 10:15 AM, David Karlsen <da...@gmail.com>
>> wrote:
>>> Would you have to await for
>>> https://issues.apache.org/jira/browse/SUREFIRE-1330 to be merged to get
>>> surefire support?
>>>
>>> Den ons. 23. mai 2018 kl. 10:08 skrev Zoran Regvart <zo...@regvart.com>:
>>>
>>>> Hi,
>>>> on the testcontainers thread I mentioned that we can switch to JUnit5.
>>>> I've attended a talk by Sam Brannen at the local JUG. I think it was a
>>>> variant of the talk[1] he gave at SpringOne 2017.
>>>>
>>>> The key takeaway for me was that JUnit5 is forward and backward
>>>> compatible, so you can run the same tests written with JUnit4
>>>> annotations on JUnit5, but you can also run JUnit5 tests on JUnit4, if
>>>> for some reason that would make sense in a particular case.
>>>>
>>>> What I understood is that we could upgrade to JUnit5 by simply
>>>> upgrading the surefire/failsafe Maven plugins and adding the
>>>> junit-vintage-engine dependency but only to a module that has mixed
>>>> JUnit4 and JUnit5 tests[2]. The only issue is limited @Rule support.
>>>>
>>>> Now on to the benefits, I think it makes much sense to move over to
>>>> JUnit5 for the conditional test execution[3], better categorization of
>>>> tests via tags[4] and the much better extension model[5].
>>>>
>>>> I propose that we schedule this for the one release after the pending
>>>> one (so in 2.23), and that we add camel-test-jupiter component that
>>>> would help developers write nicer tests for their integrations with
>>>> support for dependency injection for example[6].
>>>>
>>>> zoran
>>>>
>>>> [1] https://www.youtube.com/watch?v=h0Idcz71Aog
>>>> [2]
>>>> https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4
>>>> [3]
>>>>
>> https://junit.org/junit5/docs/current/user-guide/#writing-tests-conditional-execution
>>>> [4]
>>>>
>> https://junit.org/junit5/docs/current/user-guide/#writing-tests-tagging-and-filtering
>>>> [5] https://junit.org/junit5/docs/current/user-guide/#extensions
>>>> [6]
>>>>
>> https://junit.org/junit5/docs/current/user-guide/#writing-tests-dependency-injection
>>>> --
>>>> Zoran Regvart
>>>>
>>>
>>> --
>>> --
>>> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>>
>>
>> --
>> Zoran Regvart
>>
>


Re: JUnit5, was: testcontainers

Posted by David Karlsen <da...@gmail.com>.
It is released now!

Den ons. 23. mai 2018 kl. 10:32 skrev Zoran Regvart <zo...@regvart.com>:

> Hi David,
> yes we can wait for that and the Surefire/Failsafe release that
> includes it. I think we can also add
> org.junit.platform:junit-platform-surefire-provider:1.2.0 dependency
> to the existing Surefire/Failsafe plugin configurations.
>
> As far as I understand that issue is tracking the incorporation of the
> existing codebase from JUnit5 into Surefire.
>
> zoran
>
> On Wed, May 23, 2018 at 10:15 AM, David Karlsen <da...@gmail.com>
> wrote:
> > Would you have to await for
> > https://issues.apache.org/jira/browse/SUREFIRE-1330 to be merged to get
> > surefire support?
> >
> > Den ons. 23. mai 2018 kl. 10:08 skrev Zoran Regvart <zo...@regvart.com>:
> >
> >> Hi,
> >> on the testcontainers thread I mentioned that we can switch to JUnit5.
> >> I've attended a talk by Sam Brannen at the local JUG. I think it was a
> >> variant of the talk[1] he gave at SpringOne 2017.
> >>
> >> The key takeaway for me was that JUnit5 is forward and backward
> >> compatible, so you can run the same tests written with JUnit4
> >> annotations on JUnit5, but you can also run JUnit5 tests on JUnit4, if
> >> for some reason that would make sense in a particular case.
> >>
> >> What I understood is that we could upgrade to JUnit5 by simply
> >> upgrading the surefire/failsafe Maven plugins and adding the
> >> junit-vintage-engine dependency but only to a module that has mixed
> >> JUnit4 and JUnit5 tests[2]. The only issue is limited @Rule support.
> >>
> >> Now on to the benefits, I think it makes much sense to move over to
> >> JUnit5 for the conditional test execution[3], better categorization of
> >> tests via tags[4] and the much better extension model[5].
> >>
> >> I propose that we schedule this for the one release after the pending
> >> one (so in 2.23), and that we add camel-test-jupiter component that
> >> would help developers write nicer tests for their integrations with
> >> support for dependency injection for example[6].
> >>
> >> zoran
> >>
> >> [1] https://www.youtube.com/watch?v=h0Idcz71Aog
> >> [2]
> >> https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4
> >> [3]
> >>
> https://junit.org/junit5/docs/current/user-guide/#writing-tests-conditional-execution
> >> [4]
> >>
> https://junit.org/junit5/docs/current/user-guide/#writing-tests-tagging-and-filtering
> >> [5] https://junit.org/junit5/docs/current/user-guide/#extensions
> >> [6]
> >>
> https://junit.org/junit5/docs/current/user-guide/#writing-tests-dependency-injection
> >> --
> >> Zoran Regvart
> >>
> >
> >
> > --
> > --
> > David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>
>
>
> --
> Zoran Regvart
>


-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen

Re: JUnit5, was: testcontainers

Posted by Zoran Regvart <zo...@regvart.com>.
Hi David,
yes we can wait for that and the Surefire/Failsafe release that
includes it. I think we can also add
org.junit.platform:junit-platform-surefire-provider:1.2.0 dependency
to the existing Surefire/Failsafe plugin configurations.

As far as I understand that issue is tracking the incorporation of the
existing codebase from JUnit5 into Surefire.

zoran

On Wed, May 23, 2018 at 10:15 AM, David Karlsen <da...@gmail.com> wrote:
> Would you have to await for
> https://issues.apache.org/jira/browse/SUREFIRE-1330 to be merged to get
> surefire support?
>
> Den ons. 23. mai 2018 kl. 10:08 skrev Zoran Regvart <zo...@regvart.com>:
>
>> Hi,
>> on the testcontainers thread I mentioned that we can switch to JUnit5.
>> I've attended a talk by Sam Brannen at the local JUG. I think it was a
>> variant of the talk[1] he gave at SpringOne 2017.
>>
>> The key takeaway for me was that JUnit5 is forward and backward
>> compatible, so you can run the same tests written with JUnit4
>> annotations on JUnit5, but you can also run JUnit5 tests on JUnit4, if
>> for some reason that would make sense in a particular case.
>>
>> What I understood is that we could upgrade to JUnit5 by simply
>> upgrading the surefire/failsafe Maven plugins and adding the
>> junit-vintage-engine dependency but only to a module that has mixed
>> JUnit4 and JUnit5 tests[2]. The only issue is limited @Rule support.
>>
>> Now on to the benefits, I think it makes much sense to move over to
>> JUnit5 for the conditional test execution[3], better categorization of
>> tests via tags[4] and the much better extension model[5].
>>
>> I propose that we schedule this for the one release after the pending
>> one (so in 2.23), and that we add camel-test-jupiter component that
>> would help developers write nicer tests for their integrations with
>> support for dependency injection for example[6].
>>
>> zoran
>>
>> [1] https://www.youtube.com/watch?v=h0Idcz71Aog
>> [2]
>> https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4
>> [3]
>> https://junit.org/junit5/docs/current/user-guide/#writing-tests-conditional-execution
>> [4]
>> https://junit.org/junit5/docs/current/user-guide/#writing-tests-tagging-and-filtering
>> [5] https://junit.org/junit5/docs/current/user-guide/#extensions
>> [6]
>> https://junit.org/junit5/docs/current/user-guide/#writing-tests-dependency-injection
>> --
>> Zoran Regvart
>>
>
>
> --
> --
> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen



-- 
Zoran Regvart

Re: JUnit5, was: testcontainers

Posted by David Karlsen <da...@gmail.com>.
Would you have to await for
https://issues.apache.org/jira/browse/SUREFIRE-1330 to be merged to get
surefire support?

Den ons. 23. mai 2018 kl. 10:08 skrev Zoran Regvart <zo...@regvart.com>:

> Hi,
> on the testcontainers thread I mentioned that we can switch to JUnit5.
> I've attended a talk by Sam Brannen at the local JUG. I think it was a
> variant of the talk[1] he gave at SpringOne 2017.
>
> The key takeaway for me was that JUnit5 is forward and backward
> compatible, so you can run the same tests written with JUnit4
> annotations on JUnit5, but you can also run JUnit5 tests on JUnit4, if
> for some reason that would make sense in a particular case.
>
> What I understood is that we could upgrade to JUnit5 by simply
> upgrading the surefire/failsafe Maven plugins and adding the
> junit-vintage-engine dependency but only to a module that has mixed
> JUnit4 and JUnit5 tests[2]. The only issue is limited @Rule support.
>
> Now on to the benefits, I think it makes much sense to move over to
> JUnit5 for the conditional test execution[3], better categorization of
> tests via tags[4] and the much better extension model[5].
>
> I propose that we schedule this for the one release after the pending
> one (so in 2.23), and that we add camel-test-jupiter component that
> would help developers write nicer tests for their integrations with
> support for dependency injection for example[6].
>
> zoran
>
> [1] https://www.youtube.com/watch?v=h0Idcz71Aog
> [2]
> https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4
> [3]
> https://junit.org/junit5/docs/current/user-guide/#writing-tests-conditional-execution
> [4]
> https://junit.org/junit5/docs/current/user-guide/#writing-tests-tagging-and-filtering
> [5] https://junit.org/junit5/docs/current/user-guide/#extensions
> [6]
> https://junit.org/junit5/docs/current/user-guide/#writing-tests-dependency-injection
> --
> Zoran Regvart
>


-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen