Skip to content

Migrate tests to JUnit 6 #8684

@sissbruecker

Description

@sissbruecker

Currently all tests in flow-components use JUnit 4 APIs. However, Flow has started migrating tests to JUnit 6.

This has some side-effects:

  • flow-test-generic declares dependencies for JUnit 6
  • We use that in all Flow component modules to reuse ClassesSerializableTest
  • JUnit 6 is being pulled into all Flow component modules
  • Surefire plugin now runs tests with the JUnit 6 provider (org.apache.maven.surefire.junitplatform.JUnitPlatformProvider)

For now that seems to work fine, as the provider seems to automatically detect JUnit 4 and 6 being on the class path, and then picking a "vintage" engine that supports running both. However, this means our tests actually running depends on some heuristics in Surefire.

Short term we might want to configure Surefire so that, instead of relying auto-detection, we explicitly configure either:

  • A JUnit 4 provider. Works as long as all tests use JUnit 4.
  • Or configure the vintage engine explicitly. However not all modules currently pull in JUnit 6, so we might have to add explicit dependencies for that.

Long term we should migrate tests to JUnit 6:

  • Research what differences are between versions and which API usages need to be updated
  • Configure Surefire so that it supports running both JUnit 4 and JUnit 6 tests
  • Gradually convert individual modules

Then do the same for integration tests, needs checking if there are any issues regarding TestBench.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorInternal improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions