DSpot tries to amplify ignored test classes, causing a NPE
jesus-gorronogoitia opened this issue · 1 comments
Characteristics
- Issue Type: bug
- Reproducibility: always
- Severity: crash
- Tool/Service/Component: DSpot 1.2.2-SNAPSHOT
- Execution Environment: Linux Opensuse Tumbleweed
- Reporter: Jesús Gorroñogoitia jesus.gorronogoitia@atos.net
Description
Experiments with some Supersede IF test cases crashes with following exception stack trace.
Exception in thread "main" java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
at java.util.regex.Matcher.reset(Matcher.java:309)
at java.util.regex.Matcher.<init>(Matcher.java:229)
at java.util.regex.Pattern.matcher(Pattern.java:1093)
at eu.stamp_project.testrunner.runner.MethodFilter.lambda$null$1(MethodFilter.java:47)
at java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:449)
at eu.stamp_project.testrunner.runner.MethodFilter.lambda$new$2(MethodFilter.java:45)
at eu.stamp_project.testrunner.runner.MethodFilter.shouldRun(MethodFilter.java:32)
at org.junit.runners.ParentRunner.shouldRun(ParentRunner.java:434)
at org.junit.runners.ParentRunner.filter(ParentRunner.java:382)
at org.junit.runner.manipulation.Filter.apply(Filter.java:97)
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:37)
at eu.stamp_project.testrunner.runner.JUnit4Runner.run(JUnit4Runner.java:60)
at eu.stamp_project.testrunner.runner.JUnit4Runner.main(JUnit4Runner.java:27)
[WARNING] Something bad happened when DSpot tried to execute the tests before starting the amplification.
java.lang.RuntimeException: java.io.FileNotFoundException: /var/jenkins_home/workspace/supersede-if-dspot-script/IF/API/eu.supersede.if.api/target/dspot/TestResult.ser does not exist.
at eu.stamp_project.testrunner.runner.Loader.load(Loader.java:25)
at eu.stamp_project.testrunner.listener.impl.TestResultImpl.load(TestResultImpl.java:113)
at eu.stamp_project.testrunner.EntryPoint.runTests(EntryPoint.java:203)
at eu.stamp_project.testrunner.EntryPoint.runTests(EntryPoint.java:193)
at eu.stamp_project.testrunner.EntryPoint.runTests(EntryPoint.java:154)
at eu.stamp_project.utils.execution.TestRunner.run(TestRunner.java:98)
at eu.stamp_project.utils.execution.TestRunner.runGivenTestMethods(TestRunner.java:66)
at eu.stamp_project.utils.compilation.TestCompiler.compileAndRun(TestCompiler.java:99)
at eu.stamp_project.utils.compilation.TestCompiler.compileRunAndDiscardUncompilableAndFailingTestMethods(TestCompiler.java:55)
at eu.stamp_project.dspot.Amplification.amplification(Amplification.java:92)
at eu.stamp_project.dspot.DSpot._amplify(DSpot.java:274)
at eu.stamp_project.dspot.DSpot.lambda$amplifyTestClassesTestMethods$5(DSpot.java:255)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at eu.stamp_project.dspot.DSpot.amplifyTestClassesTestMethods(DSpot.java:256)
at eu.stamp_project.Main.run(Main.java:65)
at eu.stamp_project.DSpotMojo.execute(DSpotMojo.java:305)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
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)
Caused by: java.io.FileNotFoundException: /var/jenkins_home/workspace/supersede-if-dspot-script/IF/API/eu.supersede.if.api/target/dspot/TestResult.ser does not exist.
... 44 more
Debugging DSpot execution in Eclipse shows the following:
The MethodFilter in JUnit4Runner receives in its method shouldRun a wrong Description for a test class with not test methods. So, inspecting the Supersede IF test suite I realized it was ignored by @ignore annotation. Despite that, DSpot was trying to amplify this test.
I've created a PR #835 that fixes this issue.
Steps to reproduce
mvn -f pom_dspot.xml eu.stamp-project:dspot-maven:amplify-unit-tests -Dpath-to-properties=./dspot.properties -Diteration=3 -Dtest=eu.supersede.integration.api.tenants.test.IFTenantsManagerTest -Damplifiers=MethodAdd,MethodRemove,TestDataMutator,MethodGeneratorAmplifier,ReturnValueAmplifier,StringLiteralAmplifier,NumberLiteralAmplifier,BooleanLiteralAmplifier,CharLiteralAmplifier,AllLiteralAmplifiers,NullifierAmplifier -Dtest-criterion=JacocoCoverageSelector -DtimeOut=30000 -Dmax-test-amplified=200 -Dbudgetizer=RandomBudgetizer -Dclean -Dverbose
Other files and URLs
Relationships
Help on issue template
Preview to follow the link or open file .github/ISSUE_DOC.md