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

targetModule in properties file causes dspot to exit immediately with no result #798

Closed gibello closed 5 years ago

gibello commented 5 years ago

Characteristics

Description

When specifying a targetModule in DSpot properties file, DSpot maven plugin runs fine, but exits with "BUILD SUCCESS" within a few seconds with no output at all.

Steps to reproduce

Tested on authzforce core project (https://gitlab.ow2.org/authzforce/core).

dspot.properties file contains just one line: targetModule: pdp-engine

Then DSpot is launched as follows: mvn eu.stamp-project:dspot-maven:2.1.1-SNAPSHOT:amplify-unit-tests -Dpath-to-properties=dspot.properties

Exits with "BUILD SUCCESS" after 6 seconds, and DSpot does not seem to be invoked at all.

danglotb commented 5 years ago

Hi @gibello

Thank you for reporting this.

There is an issue between default values and (not) specified values in the properties.

I'll work on this and propose a fix ASAP.

Meanwhile, you can either specify the project property in your properties file or use dspot-maven from your module instead of from its parent.

For the latter option, you may face classpath issue and need to run mvn dependency:resolve before.

danglotb commented 5 years ago

Hello, #808 should fix this.

gibello commented 5 years ago

Hi @danglotb , does not seem to fix anything... Did I do something wrong ?

git checkout -b danglotb-refactor-inputs-management master
git pull https://github.com/danglotb/dspot.git refactor-inputs-management
mvn clean install package -DskipTests

Then test again...

danglotb commented 5 years ago

From where do you run DSpot? You should run it from the top parent of your project, i.e core folder.

Your properties file is not well formatted, it should be:

targetModule=pdp-engine

using the = symbol instead of :. Thus, you have a white space in the value, that can lead to a wrong folder in DSpot (DSpot will concatenate this value with the root of the project to reach the root of the targeted module).

gibello commented 5 years ago

Tried this, no change. No surprise: the ":" syntax is valid as well (if you don't put a white space after the value - the reason why it is always better to trim props before use, but the "=" does not solve that).

gibello commented 5 years ago

@danglotb : Just added "project=/home/gibello/STAMP/STAMP-project/authzforce-gibello/core" in the dspot.properties, AND IT WORKS.

There is definitely an issue with that "project" stuff (I have a java invoker to call DSpot, and without "project" set, it fails with a "null" inserted in the path... I mean the way the path is built is buggy, and unpredictable depending on runtime environment).

danglotb commented 5 years ago

@danglotb : Just added "project=/home/gibello/STAMP/STAMP-project/authzforce-gibello/core" in the dspot.properties, AND IT WORKS.

Seems weird. I saw that there is a bug in the maven-plugin in the detection of the targeted module. I'm looking at it.

There is definitely an issue with that "project" stuff (I have a java invoker to call DSpot, and without "project" set, it fails with a "null" inserted in the path... I mean the way the path is built is buggy, and unpredictable depending on runtime environment).

Yes, the property project MUST be specified (as said in the documentation).

The dspot-maven plugin infers this information, if not specified, from the pom.xml to make the usage easier.

However, from the command line, one must specify this property.

If you do use DSpot's API, I suggest you use also the eu.stamp_project.utils.options.check.Checker class, to ensure that you have correct inputs.