Skip to content

Problem finding tests in IntelliJ using Gradle test runner #2615

@sebersole

Description

@sebersole

No idea if this is a IntelliJ, Gradle or JUnit issue. I've tried with both JUnit 5.4 and 5.7 - same issue. Ditto for JUnit 4 btw

For a reproducer, this is happening with the Hibernate project (http://github.com/hibernate/hibernate-orm) with the wip/6.0 branch. Totally understand if you want a smaller reproducer - let me know.

I played around a little bit to see if I could narrow down possible causes. It seems like the projects that have multiple test tasks (how we expose testing the different available databases) are the ones experiencing this problem. That is most of the Java sub-projects.

To reproduce:

  1. Set IntelliJ to run tests using Gradle (Settings > Build, Execution, Deployment > Build tools > Gradle : "Run tests using : Gradle"). I see the same behavior with "Chose per test"
  2. Select an individual test class/method from a Java sub-project (e.g. hibernate-core) and run or debug it

I expect the tests to run. IJ fails to find them. E.g.

Execution failed for task ':documentation:matrix_derby'.
> No tests found for given includes: [org.hibernate.userguide.mapping.basic.NationalizedStringMappingTests](filter.includeTestsMatching)

As a counter-point, if you use that same IJ set-up and try to do the same with tests in the hibernate-testing sub-project, it works fine. That project has just the one test task.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions