szpak / gradle-pitest-plugin

Gradle plugin for PIT Mutation Testing
http://gradle-pitest-plugin.solidsoft.info/
221 stars 58 forks source link

Junit5 parameterized tests are not being run #238

Closed lalithsuresh closed 4 years ago

lalithsuresh commented 4 years ago

I have a project where I'm using JUnit5's parameterized tests, where the parameters are supplied by a MethodSource.

Here's the test file in question, which has both the parameterized tests and the corresponding method source: https://github.com/vmware/declarative-cluster-management/blob/pitest/dcm/src/test/java/com/vmware/dcm/ModelTest.java

The basic structure of these tests are as follows:

    @ParameterizedTest
    @MethodSource("solvers")
    public void sometest(final SolverConfig solver) {
           // test
    }

    static Stream<SolverConfig> solvers() {
        return Stream.of(SolverConfig.OrToolsSolver, SolverConfig.MinizincSolver);
    }

    enum SolverConfig {
        MinizincSolver,
        OrToolsSolver
    }

The problem is that all these parameterized tests are ignored. What am I missing?

> Task :dcm:pitest
8:49:01 PM PIT >> INFO : Verbose logging is disabled. If you encounter a problem, please enable it before reporting an issue.
8:49:01 PM PIT >> INFO : Sending 3 test classes to minion
8:49:01 PM PIT >> INFO : Sent tests to minion
8:49:01 PM PIT >> INFO : MINION : 8:49:01 PM PIT >> INFO : Checking environment

8:49:02 PM PIT >> INFO : MINION : 8:49:02 PM PIT >> INFO : Found  0 tests

8:49:02 PM PIT >> INFO : MINION : 8:49:02 PM PIT >> INFO : Dependency analysis reduced number of potential tests by 0

8:49:02 PM PIT >> INFO : MINION : 8:49:02 PM PIT >> INFO : 0 tests received

8:49:02 PM PIT >> INFO : Calculated coverage in 0 seconds.
8:49:02 PM PIT >> INFO : Incremental analysis reduced number of mutations by 0
8:49:02 PM PIT >> INFO : Created  76 mutation test units

Here's the gradle configuration I'm using: https://github.com/vmware/declarative-cluster-management/blob/pitest/dcm/build.gradle

szpak commented 4 years ago

It could be a limitations of pitest-junit5-plugin. I propose to report it there.

(nevertheless, feel free to reopen if you think it could be Gradle-specific)