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

ASF subversion and git services commented on GEODE-4181:
--------------------------------------------------------

Commit fc75182ae02bd90f7513cfce30fead6817f7f7b3 in geode's branch 
refs/heads/develop from Dale Emery
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=fc75182 ]

GEODE-4181: Add JUnit 5 Support (#6911)

Added JUnit 5 support to all Geode projects that use `geode-junit`.

This is a re-do of PR 6740 with the addition of a new parameterized test
runner. See the GEODE PARAMS RUNNER section (below) for details.

STANDARD TEST TASKS

Updated **./gradle/test.gradle** to configure these standard test tasks
to use JUnit Platform to run tests:
- `test` and `repeatUnitTest`
- `acceptanceTest` and `repeatAcceptanceTest`
- `distributedTest` and `repeatDistributedTest`
- `integrationTest` and `repeatIntegrationTest`
- `performanceTest`
- `uiTest`
- `upgradeTest` and `repeatUpgradeTest`

STANDARD TEST MODULES

Updated **./geode-junit/build.gradle**:
- Added `junit-jupiter-api` and `junit-jupiter-params` as API
  dependencies.
- Added `junit-jupiter-engine` and `junit-vintage-engine` as
  implementation dependencies.

These changes add JUnit 5 support to any source set that depends on
`geode-junit`, either directly or via `geode-dunit`.

OTHER PROJECTS

Added `junit-vintage-engine` dependency directly to each project that
runs tests without `geode-junit` or `geode-dunit`:
- `geode-common`
- `geode-concurrency-test`
- `geode-jmh`
- `geode-modules`
- `geode-rebalancer`
- `static-analysis:pmd-rules`

These changes **do not** add JUnit 5 support to these projects.
Developers who want JUnit 5 support in these projects can declare
dependencies on `junit-jupiter-api`, `junit-jupiter-params`, and
`junit-jupiter-engine`.

SPECIFIC TESTS

Change `ConcurrencyRuleTest` to expect the exception types and exception
messages thrown by AssertJ when `opentest4j` is on the classpath.

GEODE PARAMS RUNNER

**Problem:** Geode commonly uses `JUnitParamsRunner` to run
parameterized tests. This runner is incompatible with JUnit Vintage, the
test engine that JUnit 5 uses to run JUnit 4 tests. Specifically:
- `JUnitParamsRunner` discards `@Category` annotations when describing
  parameterized tests. JUnit Vintage needs this information to filter
  tests by category.
- When JUnit Vintage asks `JUnitParamsRunner` to exclude a parameterized
  test by name, the runner applies the filter not to the individual
  tests with parameterizations, but to the suite that the runner created
  to contain the parameterized tests. The filter fails to exclude
  parameterized tests.

As a result of these issues, Geode's Windows Gfsh distributed test CI
job ends up running hundreds of unwanted tests. Numerous of these fail
on Windows.

**Solution:** Introduce `GeodeParamsRunner`, which extends and adapts
`JUnitParamsRunner` to be compatible with JUnit Vintage.

**Caveat:** When `GeodeParamsRunner` is asked to exclude a specific
parameterization of a test method, it excludes *all* parameterizations
of that test method. This makes it impossible to run a single
parameterization of a given test method, or to exclude a single
parameterization. This quirk does not affect any CI jobs, but may
confuse a developer who tries to use `--tests` to run a single
parameterization.

> Update to JUnit 5.x
> -------------------
>
>                 Key: GEODE-4181
>                 URL: https://issues.apache.org/jira/browse/GEODE-4181
>             Project: Geode
>          Issue Type: Improvement
>          Components: general, tests
>            Reporter: Patrick Rhomberg
>            Assignee: Dale Emery
>            Priority: Major
>              Labels: GeodeOperationAPI, pull-request-available
>
> In addition to the expected benefits that come with new versions, updating to 
> JUnit 5.x should allow us to remove the workaround required in GEODE-1350 / 
> GEODE-4122.
> If migration guides are to be believed, migration from JUnit 4.x to 5.x in 
> and of itself should not be difficult.  However, interaction with Mockito and 
> PowerMock appears to be significantly different and will require 
> investigation.



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

Reply via email to