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

Problem executing dspot-diff-test-selection:list with a fresh patch.diff file generated from diff unix command #793

Closed nicolabertazzo closed 5 years ago

nicolabertazzo commented 5 years ago

Characteristics

Description

Problem executing eu.stamp-project:dspot-diff-test-selection:2.1.0:list without patch.diff or with a patch.diff created from diff unix command.

Steps to reproduce

Without patch.diff

Execute these commands:

git clone https://github.com/STAMP-project/dspot.git

cd dspot/dspot-diff-test-selection/src/test/resources/tavern

rm patch.diff

mvn clean eu.stamp-project:dspot-diff-test-selection:2.1.0:list -Dpath-dir-second-version=../tavern-refactor

output error:

Writing HTML report to '/home/bertazzo/Scrivania/tmp/dspot_diff_test/dspot/dspot-diff-test-selection/src/test/resources/tavern/target/clover/report' Done. Processed 2 packages in 982ms (491ms per package). java.io.FileNotFoundException: /home/bertazzo/Scrivania/tmp/dspot_diff_test/dspot/dspot-diff-test-selection/src/test/resources/tavern/patch.diff (File o directory non esistente) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.<init>(FileInputStream.java:138) at java.io.FileReader.<init>(FileReader.java:72) at eu.stamp_project.diff_test_selection.DiffTestSelection.getTestThatExecuteChanges(DiffTestSelection.java:49) at eu.stamp_project.diff_test_selection.Main.run(Main.java:28) at eu.stamp_project.diff_test_selection.maven.DiffTestSelectionMojo.execute(DiffTestSelectionMojo.java:57) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) [INFO] Saving result in /home/bertazzo/Scrivania/tmp/dspot_diff_test/dspot/dspot-diff-test-selection/src/test/resources/tavern/testsThatExecuteTheChange.csv ... [INFO] [INFO] Writing Coverage in /home/bertazzo/Scrivania/tmp/dspot_diff_test/dspot/dspot-diff-test-selection/src/test/resources/tavern/testsThatExecuteTheChange_coverage.csv [INFO] total;0;0

With a freshed patch.diff

Execute these commands

git clone https://github.com/STAMP-project/dspot.git

cd dspot/dspot-diff-test-selection/src/test/resources/tavern

rm patch.diff

diff -ru . ../tavern-refactor/ > patch.diff

mvn clean eu.stamp-project:dspot-diff-test-selection:2.1.0:list -Dpath-dir-second-version=../tavern-refactor

output:

... [INFO] Writing Coverage in /home/bertazzo/Scrivania/tmp/dspot_diff_test/dspot/dspot-diff-test-selection/src/test/resources/tavern/testsThatExecuteTheChange_coverage.csv [INFO] total;0;0 I attached the generated patch.diff (renamed in patch.diff.txt) patch.diff.txt

Relationships

Help on issue template

Preview to follow the link or open file .github/ISSUE_DOC.md

nicolabertazzo commented 5 years ago

It works if the patch.diff is generated with git diff > patch.diff

danglotb commented 5 years ago

Hi @nicolabertazzo

I'm working on it.

When you do not specify a path to a patch file, DSpot-diff-test-selection tries to generate one but it seems that this generation is buggy.

danglotb commented 5 years ago

Hello, #795 should fix the issue.

danglotb commented 5 years ago

795 has been merged. Please reopen this issue if you have any more trouble.

nicolabertazzo commented 5 years ago

I test it on 2.1.1-SNAPSHOT and it works!