Open josevariquelme opened 7 years ago
This this the code:
public class BusinessLogic { public int getPrice(int amountOfThings, boolean coupon) { if (amountOfThings >= 20 || coupon) { return amountOfThings * 15; } return amountOfThings * 17; } }
and this is the unit test
@RunWith(ZohhakRunner.class) public class BusinessLogicTest { @TestWith({ "1 , false, 17", "1 , true , 15", "20 , false, 300", "100, false, 1500" }) public void shouldGetPrice(int amount, boolean hasCoupon, int price) { assertEquals(price, new BusinessLogic().getPrice(amount, hasCoupon)); } }
And this is Pitest output:
Connecting to: localhost/127.0.0.1:36828 Connected Received request: PitRequest [options=PitOptions [reportDir=/home/developer/workspace/.metadata/.plugins/org.pitest.pitclipse.core/html_results, classUnderTest=null, classesToMutate=[katas.BusinessLogic], sourceDirs=[/home/developer/workspace/Katas/src/main/java, /home/developer/workspace/Katas/src/test/java], packages=[katas.*], threads=4, historyLocation=null, excludedClasses=[], excludedMethods=[], avoidCallsTo=[], mutators=[DEFAULTS], timeoutConst=3000, timeoutFactor=1.25], projects=[Katas]] 10:12:34 PM PIT >> FINE : Running report with ReportOptions [targetClasses=[^katas\.BusinessLogic$], excludedMethods=[], excludedClasses=[], codePaths=[], reportDir=/home/developer/workspace/.metadata/.plugins/org.pitest.pitclipse.core/html_results, historyInputLocation=null, historyOutputLocation=null, sourceDirs=[/home/developer/workspace/Katas/src/main/java, /home/developer/workspace/Katas/src/test/java], classPathElements=[/home/developer/workspace/Katas/bin, /home/developer/Downloads/eclipse/plugins/org.junit_4.12.0.v201504281640/junit.jar, /home/developer/Downloads/eclipse/plugins/org.hamcrest.core_1.3.0.v201303031735.jar, /home/developer/.gradle/caches/modules-2/files-2.1/com.googlecode.zohhak/zohhak/1.0.2/427a6f1b9a3ab26f87da74bf166a3a1d4c4388f6/zohhak-1.0.2.jar, /home/developer/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.4/5fe28b9518e58819180a43a850fbc0dd24b7c050/commons-lang3-3.4.jar, /home/developer/Downloads/eclipse/plugins/org.pitest.command-line-osgi_1.1.9.jar, /home/developer/Downloads/eclipse/plugins/org.pitest.html-report-osgi_1.1.9.jar, /home/developer/Downloads/eclipse/plugins/org.pitest.osgi_1.1.9.jar, /home/developer/Downloads/eclipse/plugins/org.pitest.pitrunner_1.1.6.201607050705.jar, /home/developer/Downloads/eclipse/plugins/org.pitest.guava-shade-osgi_18.0.0.jar], mutators=[DEFAULTS], dependencyAnalysisMaxDistance=-1, mutateStaticInitializers=false, jvmArgs=[], numberOfThreads=4, timeoutFactor=1.25, timeoutConstant=3000, targetTests=[^katas\..*$], loggingClasses=[], maxMutationsPerClass=0, verbose=true, failWhenNoMutations=false, outputs=[HTML, PITCLIPSE_MUTATIONS], groupConfig=TestGroupConfig [excludedGroups=[], includedGroups=[]], mutationUnitSize=0, shouldCreateTimestampedReports=true, detectInlinedCode=false, exportLineCoverage=false, mutationThreshold=0, coverageThreshold=0, mutationEngine=gregor, javaExecutable=null, includeLaunchClasspath=true] 10:12:34 PM PIT >> FINE : System class path is /home/developer/workspace/Katas/bin:/home/developer/Downloads/eclipse/plugins/org.junit_4.12.0.v201504281640/junit.jar:/home/developer/Downloads/eclipse/plugins/org.hamcrest.core_1.3.0.v201303031735.jar:/home/developer/.gradle/caches/modules-2/files-2.1/com.googlecode.zohhak/zohhak/1.0.2/427a6f1b9a3ab26f87da74bf166a3a1d4c4388f6/zohhak-1.0.2.jar:/home/developer/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.4/5fe28b9518e58819180a43a850fbc0dd24b7c050/commons-lang3-3.4.jar:/home/developer/Downloads/eclipse/plugins/org.pitest.command-line-osgi_1.1.9.jar:/home/developer/Downloads/eclipse/plugins/org.pitest.html-report-osgi_1.1.9.jar:/home/developer/Downloads/eclipse/plugins/org.pitest.osgi_1.1.9.jar:/home/developer/Downloads/eclipse/plugins/org.pitest.pitrunner_1.1.6.201607050705.jar:/home/developer/Downloads/eclipse/plugins/org.pitest.guava-shade-osgi_18.0.0.jar 10:12:34 PM PIT >> FINE : Maximum available memory is 1749 mb 10:12:34 PM PIT >> FINE : MINION : Installing PIT agent 10:12:34 PM PIT >> INFO : Sending 1 test classes to minion 10:12:34 PM PIT >> INFO : Sent tests to minion 10:12:34 PM PIT >> INFO : MINION : 10:12:34 PM PIT >> INFO : Checking environment 10:12:34 PM PIT >> FINE : Expecting 1 tests classes from parent 10:12:34 PM PIT >> FINE : Tests classes received 10:12:34 PM PIT >> INFO : MINION : 10:12:34 PM PIT >> INFO : Found 0 tests 10:12:34 PM PIT >> INFO : MINION : 10:12:34 PM PIT >> INFO : Dependency analysis reduced number of potential tests by 0 10:12:34 PM PIT >> INFO : MINION : 10:12:34 PM PIT >> INFO : 0 tests received 10:12:34 PM PIT >> INFO : MINION : 10:12:34 PM PIT >> FINE : Running 0 units 10:12:34 PM PIT >> FINE : Coverage generator Minion exited ok 10:12:34 PM PIT >> INFO : Calculated coverage in 0 seconds. 10:12:34 PM PIT >> FINE : Used memory after coverage calculation 17 mb 10:12:34 PM PIT >> FINE : Free Memory after coverage calculation 101 mb 10:12:34 PM PIT >> FINE : According to coverage no tests hit the mutation MutationDetails [id=MutationIdentifier [location=Location [clazz=katas.BusinessLogic, method=getPrice, methodDesc=(IZ)I], indexes=[5], mutator=org.pitest.mutationtest.engine.gregor.mutators.ConditionalsBoundaryMutator], filename=BusinessLogic.java, block=1, lineNumber=13, description=changed conditional boundary, testsInOrder=[]] 10:12:34 PM PIT >> FINE : According to coverage no tests hit the mutation MutationDetails [id=MutationIdentifier [location=Location [clazz=katas.BusinessLogic, method=getPrice, methodDesc=(IZ)I], indexes=[5], mutator=org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator], filename=BusinessLogic.java, block=1, lineNumber=13, description=negated conditional, testsInOrder=[]] 10:12:34 PM PIT >> FINE : According to coverage no tests hit the mutation MutationDetails [id=MutationIdentifier [location=Location [clazz=katas.BusinessLogic, method=getPrice, methodDesc=(IZ)I], indexes=[7], mutator=org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator], filename=BusinessLogic.java, block=2, lineNumber=13, description=negated conditional, testsInOrder=[]] 10:12:34 PM PIT >> FINE : According to coverage no tests hit the mutation MutationDetails [id=MutationIdentifier [location=Location [clazz=katas.BusinessLogic, method=getPrice, methodDesc=(IZ)I], indexes=[13], mutator=org.pitest.mutationtest.engine.gregor.mutators.MathMutator], filename=BusinessLogic.java, block=3, lineNumber=14, description=Replaced integer multiplication with division, testsInOrder=[]] 10:12:34 PM PIT >> FINE : According to coverage no tests hit the mutation MutationDetails [id=MutationIdentifier [location=Location [clazz=katas.BusinessLogic, method=getPrice, methodDesc=(IZ)I], indexes=[14], mutator=org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator], filename=BusinessLogic.java, block=3, lineNumber=14, description=replaced return of integer sized value with (x == 0 ? 1 : 0), testsInOrder=[]] 10:12:34 PM PIT >> FINE : According to coverage no tests hit the mutation MutationDetails [id=MutationIdentifier [location=Location [clazz=katas.BusinessLogic, method=getPrice, methodDesc=(IZ)I], indexes=[20], mutator=org.pitest.mutationtest.engine.gregor.mutators.MathMutator], filename=BusinessLogic.java, block=4, lineNumber=16, description=Replaced integer multiplication with division, testsInOrder=[]] 10:12:34 PM PIT >> FINE : According to coverage no tests hit the mutation MutationDetails [id=MutationIdentifier [location=Location [clazz=katas.BusinessLogic, method=getPrice, methodDesc=(IZ)I], indexes=[21], mutator=org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator], filename=BusinessLogic.java, block=4, lineNumber=16, description=replaced return of integer sized value with (x == 0 ? 1 : 0), testsInOrder=[]] 10:12:34 PM PIT >> INFO : Created 1 mutation test units 10:12:34 PM PIT >> FINE : Used memory before analysis start 23 mb 10:12:34 PM PIT >> FINE : Free Memory before analysis start 95 mb 10:12:34 PM PIT >> FINE : Running 1 units 10:12:35 PM PIT >> INFO : Completed in 0 seconds ================================================================================ - Timings ================================================================================ > scan classpath : < 1 second > coverage and dependency analysis : < 1 second > build mutation tests : < 1 second > run mutation analysis : < 1 second -------------------------------------------------------------------------------- > Total : < 1 second -------------------------------------------------------------------------------- ================================================================================ - Statistics ================================================================================ >> Generated 7 mutations Killed 0 (0%) >> Ran 0 tests (0 tests per mutation) ================================================================================ - Mutators ================================================================================ > org.pitest.mutationtest.engine.gregor.mutators.ConditionalsBoundaryMutator >> Generated 1 Killed 0 (0%) > KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 > MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 > NO_COVERAGE 1 -------------------------------------------------------------------------------- > org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator >> Generated 2 Killed 0 (0%) > KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 > MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 > NO_COVERAGE 2 -------------------------------------------------------------------------------- > org.pitest.mutationtest.engine.gregor.mutators.MathMutator >> Generated 2 Killed 0 (0%) > KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 > MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 > NO_COVERAGE 2 -------------------------------------------------------------------------------- > org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator >> Generated 2 Killed 0 (0%) > KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 > MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 > NO_COVERAGE 2 -------------------------------------------------------------------------------- Sending results: PitResults [htmlResultFile=/home/developer/workspace/.metadata/.plugins/org.pitest.pitclipse.core/html_results/201612012212/index.html, projects=[Katas]] Closing server Closed
any comment about this?
This is most likely a result of the problem described in #281.
As a short term fix ZohhakRunner can be added to the black list, but ultimately #281 needs to be implemented.
This this the code:
and this is the unit test
And this is Pitest output: