You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Matt Sicker (JIRA)" <ji...@apache.org> on 2019/07/13 21:22:00 UTC

[jira] [Updated] (LOG4J2-2653) Migrate to JUnit 5

     [ https://issues.apache.org/jira/browse/LOG4J2-2653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Sicker updated LOG4J2-2653:
--------------------------------
    Description: 
JUnit 5 has a ton of neat features that make writing tests easier and more expressive. It provides a compatibility layer for JUnit 4 and 3, so we should be able to migrate pretty easily there.

In order to migrate v4 tests to v5, we'll need to support the following:

* LoggerContextRule should have an equivalent ParameterResolver [extension|https://junit.org/junit5/docs/current/user-guide/#extensions] which injects a LoggerContext parameter among other types. (This class should remain for JUnit 4 users, and an abstraction might help in making something equivalent available for JMH tests as well).
* Test categories should be converted to [tags|https://junit.org/junit5/docs/current/user-guide/#writing-tests-tagging-and-filtering].
* {{@Ignore}} should be replaced with {{@Disabled}} or appropriate conditional disabled annotations (also useful for replacing assumeThat() tests).
* Hamcrest must be added as an explicit dependency and/or replaced by something better like AssertJ.
* The other test annotations need to be updated to the new ones.
* Parameterized tests can use the new parameters annotations to simplify things a lot.
* TemporaryFolder rule can be replaced with {{@TempDir}} parameter injection (experimental feature).
* Other rule usage needs to be converted to use appropriate v5 features or turned into extensions.

Note that this upgrade can only happen in the 3.x branch as JUnit 5 requires Java 8.

  was:
JUnit 5 has a ton of neat features that make writing tests easier and more expressive. It provides a compatibility layer for JUnit 4 and 3, so we should be able to migrate pretty easily there.

In order to migrate v4 tests to v5, we'll need to support the following:

* LoggerContextRule should be converted into a ParameterResolver [extension|https://junit.org/junit5/docs/current/user-guide/#extensions] which injects a LoggerContext parameter among other types.
* Test categories should be converted to [tags|https://junit.org/junit5/docs/current/user-guide/#writing-tests-tagging-and-filtering].
* {{@Ignore}} should be replaced with {{@Disabled}} or appropriate conditional disabled annotations (also useful for replacing assumeThat() tests).
* Hamcrest must be added as an explicit dependency and/or replaced by something better like AssertJ.
* The other test annotations need to be updated to the new ones.
* Parameterized tests can use the new parameters annotations to simplify things a lot.
* TemporaryFolder rule can be replaced with {{@TempDir}} parameter injection (experimental feature).
* Other rule usage needs to be converted to use appropriate v5 features or turned into extensions.

Note that this upgrade can only happen in the 3.x branch as JUnit 5 requires Java 8.


> Migrate to JUnit 5
> ------------------
>
>                 Key: LOG4J2-2653
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2653
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Tests
>    Affects Versions: 3.0.0
>            Reporter: Matt Sicker
>            Priority: Major
>
> JUnit 5 has a ton of neat features that make writing tests easier and more expressive. It provides a compatibility layer for JUnit 4 and 3, so we should be able to migrate pretty easily there.
> In order to migrate v4 tests to v5, we'll need to support the following:
> * LoggerContextRule should have an equivalent ParameterResolver [extension|https://junit.org/junit5/docs/current/user-guide/#extensions] which injects a LoggerContext parameter among other types. (This class should remain for JUnit 4 users, and an abstraction might help in making something equivalent available for JMH tests as well).
> * Test categories should be converted to [tags|https://junit.org/junit5/docs/current/user-guide/#writing-tests-tagging-and-filtering].
> * {{@Ignore}} should be replaced with {{@Disabled}} or appropriate conditional disabled annotations (also useful for replacing assumeThat() tests).
> * Hamcrest must be added as an explicit dependency and/or replaced by something better like AssertJ.
> * The other test annotations need to be updated to the new ones.
> * Parameterized tests can use the new parameters annotations to simplify things a lot.
> * TemporaryFolder rule can be replaced with {{@TempDir}} parameter injection (experimental feature).
> * Other rule usage needs to be converted to use appropriate v5 features or turned into extensions.
> Note that this upgrade can only happen in the 3.x branch as JUnit 5 requires Java 8.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)