hcoles / pitest

State of the art mutation testing system for the JVM
Apache License 2.0
1.7k stars 357 forks source link

>> Ran 0 tests (0 tests per mutation) #1352

Open sakthivee opened 2 months ago

sakthivee commented 2 months ago

I have a maven project where there are two folders with source code and unit test cases in each folder. There are three pom.xml files in total - one in root level and one in each folder. The source code folder does not have any test cases and has the standard maven directory structure of src/main/java/. The unit test folder also does not have any of the source code and the directory structure inside that folder will be src/test/java/. However, the unit test case pom.xml has a dependency on the source code pom.xml and I also have a maven-resources plugin from which I've moved the generated class files to the target folder inside the unit test folder.

But when I run pitest, there are no errors and there are no tests which are getting run either. This is the output I'm getting.

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

8:18:33 PM PIT >> INFO : MINION : 8:18:33 PM PIT >> INFO : Found 0 tests

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

8:18:33 PM PIT >> INFO : MINION : 8:18:33 PM PIT >> INFO : 0 tests received

8:18:33 PM PIT >> INFO : Calculated coverage in 2 seconds. 8:18:33 PM PIT >> INFO : Created 1 mutation test units /8:18:34 PM PIT >> INFO : Completed in 3 seconds

  • Mutators

    org.pitest.mutationtest.engine.gregor.mutators.ConditionalsBoundaryMutator

    Generated 2 Killed 0 (0%) KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 NO_COVERAGE 2

    org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator Generated 2 Killed 0 (0%) KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 NO_COVERAGE 2

    org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator Generated 2 Killed 0 (0%) KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 NO_COVERAGE 2

    ================================================================================

  • Timings

    scan classpath : < 1 second coverage and dependency analysis : 2 seconds build mutation tests : < 1 second run mutation analysis : < 1 second

    Total : 3 seconds

    ================================================================================

  • Statistics

    Generated 6 mutations Killed 0 (0%) Ran 0 tests (0 tests per mutation) [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for pitest-examples 1.0-SNAPSHOT: [INFO] [INFO] pitest-examples .................................... SUCCESS [ 3.903 s] [INFO] pitest-examples-application ........................ SUCCESS [ 0.102 s] [INFO] pitest-examples-unittests .......................... SUCCESS [ 5.215 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 10.046 s

How do I configure Pit to take the test classes? I've tried and and they won't work.

hcoles commented 2 months ago

You may not have the relevant pitest test plugin installed (JUnit5, testng etc).

If this is not the problem, you'll need to post a complete, minimal project that reproduces the issue.

sakthivee commented 2 months ago

I've tried various combinations of all of the pitest plugins and none of them worked. I've just created this repository which has the same folder structure of my project.

https://github.com/sakthivee/pitest.git

Hope this helps. And, I've also tried the pitmp plugin and even that didn't help.

hcoles commented 2 months ago

Thanks for the example, I understand the structure now. Pitest does not support projects where the tests are not within the same module as the code they test. To use pitest you'd need to restructure the project, or create your own tooling based on the pitest command line app.

sakthivee commented 2 months ago

May I know how can I create my tooling using the command line app? I've tried to follow the command line quick start documentation and it still had the same error.