Skip to content

[Bug]: TestContainers cannot be used without JUnit4 dependency #7434

Closed as not planned

Description

Module

Core

Testcontainers version

1.19.0

Using the latest Testcontainers version?

Yes

Host OS

doesn't matter

Host Arch

doesn't matter

Docker version

doesn't matter

What happened?

I want to use TestContainers in a project with JUnit 5.
I want to exclude JUnit 4 dependency to avoid the risk that some of our developers occasionally use wrong annotations.

dependencies {
  testImplementation("org.testcontainers:junit-jupiter:1.19.0") { exclude group: 'junit' }
  testImplementation("org.testcontainers:selenium:1.19.0") { exclude group: 'junit' }
}

But my project doesn't even compile without JUnit 4.

Relevant log output

> Task :compileTestJava FAILED
/Users/andrei/projects/selenide-examples/testcontainers/src/test/java/org/selenide/examples/SearchTestWithDocker.java:31: error: cannot access TestRule
      .withRecordingMode(RECORD_ALL, new File("build"))
      ^
  class file for org.junit.rules.TestRule not found

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions