Pitest mutation coverage : No mutations found ERROR

已查看 1,645 次
跳至第一个未读帖子

Hamza

未读,
2021年7月12日 06:15:412021/7/12
收件人 PIT Users

Hello everyone , I really wish to use PITEST for mutation coverage, but I don't know why I get this error all the time and whatever I do :

[ERROR] Failed to execute goal org.pitest:pitest-maven:1.4.8:mutationCoverage (pitest) on project 2: Execution pitest of goal org.pitest:pitest-maven:1.4.8:mutationCoverage failed: No mutations found. This probably means there is an issue with either the supplied classpath or filters.

[ERROR] See http://pitest.org for more details.

Can you please help me with this, you can find my pom.xml below, and thank you for your answers.

pom.xml

Henry Coles

未读,
2021年7月12日 09:03:152021/7/12
收件人 pitu...@googlegroups.com
You have set the globs for the target classes set incorrectly. The filter should match the packages in your project eg "com.example.*"

If you update to a recent version of pitest (1.6.7 is the latest) you can omit this config entirely, the plugin will scan the project and determine which classes to mutate automatically.

--
You received this message because you are subscribed to the Google Groups "PIT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pitusers+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pitusers/fe63da60-e6cf-4014-9c04-cb0f659e6de7n%40googlegroups.com.

Hamza

未读,
2021年7月12日 13:33:192021/7/12
收件人 PIT Users
Thank you for your answer, but I tried to use Pitest 1.6.7 and I get the same error message with the pom.xml below ...
Do you have any ideas why this doesn't work ?
pom.xml

Henry Coles

未读,
2021年7月13日 03:30:202021/7/13
收件人 pitu...@googlegroups.com
A common mistake is to run pitest without ensuring the code and tests are compiled first. Make sure you run mvn test first, or bind pitest to the maven test phase.

Hamza

未读,
2021年7月14日 02:53:572021/7/14
收件人 PIT Users
I run mvn test first, and I use like you can see in the second pom.xml the line :  <phase>test</phase> to bind pitest ...
I still have this message below and I dont understand why I still get 0 mutations ...?

[...]
[INFO] Mutating from /home/hamza/Bureau/Test_Mutationnel/2/target/classes
[INFO] Defaulting target classes to match packages in build directory
[INFO] Defaulting target tests to match packages in test build directory
08:48:23 PIT >> INFO : Verbose logging is disabled. If you encounter a problem, please enable it before reporting an issue.
08:48:24 PIT >> INFO : Incremental analysis reduced number of mutations by 0
08:48:24 PIT >> INFO : Created  0 mutation test units in pre scan
[...]
Failed to execute goal org.pitest:pitest-maven:1.6.7:mutationCoverage (default-cli) on project 2: Execution default-cli of goal org.pitest:pitest-maven:1.6.7:mutationCoverage failed: No mutations found. This probably means there is an issue with either the supplied classpath or filters.
已删除帖子

Hamza

未读,
2021年7月14日 03:53:502021/7/14
收件人 PIT Users

You can find bellow my little project on my Google Drive (It content one Classe and one TestClasse) , If anyone can run pitest and generate mutations and a pit-report, it will help me a lot ... Thank you !

Henry Coles

未读,
2021年7月14日 11:10:332021/7/14
收件人 pitu...@googlegroups.com
This project is a little strange, the classes are in the default package, but have been placed on disk on a directory named '2'

src/main/java/2
src/test/java/2

I have no idea how that is working. '2' is not a valid package name, and it seems that the compiler is therefore ignoring it and treating the files as if they had been placed directly into src/main.

I'd highly recommend not putting your code in package default. If you do then pitest's auto scan will not work and you'll have to list the classes you want to mutate individually. If you move the classes into a proper package then the autoscan will work and pitest will find code to mutate.

On Wed, 14 Jul 2021 at 08:53, Hamza <hamz...@gmail.com> wrote:

You can find bellow my little project on my Google Drive (It content one Classe and one TestClasse) , If anyone can run pitest and generate mutations and a pit-report, it will help me a lot ... Thank you !

--
You received this message because you are subscribed to the Google Groups "PIT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pitusers+u...@googlegroups.com.

Hamza

未读,
2021年7月14日 21:00:032021/7/14
收件人 PIT Users
Thank you, your answer was very helpful, I specified a package in my classes and it works !
Thank you very much :)
回复全部
回复作者
转发
0 个新帖子