STAMP-project / dspot

Automatically detect and generate missing assertions for Junit test cases (also known as test amplification)
https://dspot-demo.stamp-project.eu/
GNU Lesser General Public License v3.0
114 stars 28 forks source link

Dspot fails on project javapoet #881

Closed borisbaldassari closed 5 years ago

borisbaldassari commented 5 years ago

Characteristics

Description

Executing dspot-maven on javapoet fails. The project compiles ok (mvn package) but executing mvn eu.stamp-project:dspot-maven:amplify-unit-tests fails (see logs).

Steps to reproduce

Run dspot on javapoet:

$ mvn eu.stamp-project:dspot-maven:amplify-unit-tests 
Properties file

No properties file is required when running the maven utility. However I tried with a dspot.properties added file (still using maven) and result is the same (see logs).

Command Line / Options

javapoet_mvn_dspot.log javapoet_mvn_dspot_properties.log javapoet_mvn_package.log

danglotb commented 5 years ago

Hello @borisbaldassari

Thank for reporting this. On my side, it is able to perform the amplification.

On your traces, we can see that the problem occurs when DSpot computes the baseline of the mutation score:

[INFO] run maven: /home/boris/Applis/apache-maven-3.6.0/bin/mvn org.pitest:pitest-maven:mutationCoverage 
[WARN] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

The most important is [INFO] run maven: /home/boris/Applis/apache-maven-3.6.0/bin/mvn org.pitest:pitest-maven:mutationCoverage meaning that DSpot is running PIT using the pit-maven-plugin.

Could you enable the verbose mode by using -Dverbose=true on your maven command line and provide me the log? With this flag, we will see the output of the internal maven goals run by DSpot.

It can come from a generated file by DSpot. Please check if you have generated hidden pom files named like .dspot_junit5_pom.xml or .dspot_pom.xml, and remove them.

Also, you could try to use the latest version of DSpot, on your traces, we can see that you are using dspot-maven:2.0.0:amplify-unit-tests (default-cli) @ javapoet.

borisbaldassari commented 5 years ago

Hello @danglotb!

It can come from a generated file by DSpot. Please check if you have generated hidden pom files named like .dspot_junit5_pom.xml or .dspot_pom.xml, and remove them.

There are indeed a couple of similar auto-generated files: .dspot__junit5_pom.xml .dspot_junit5_pom.xml .dspot_pom.xml

Removed them, re-running mvn now.

Also, you could try to use the latest version of DSpot, on your traces, we can see that you are using dspot-maven:2.0.0:amplify-unit-tests (default-cli) @ javapoet.

Hum. I thought that when using mvn we'd use the latest published jar of dspot, strange. I'll look into that.

Thanks!

borisbaldassari commented 5 years ago

Fixed. I had to remove manually all the dspot-* jars from my .m2 directory, so mvn had to download it again and I'm now using dspot 2.2.0 instead of 2.0.0. Don't know why it didn't pick the latest version automatically though.

Now it builds successfully. Only one test class is generated with the default set of options, so i'll try different options.

Thanks again for the support! :-)