У меня проблема с Pitest, которую я постараюсь описать ниже:
Структура проекта:
- project-folder:
- build. xml
- lib / *. Jar
- src / com / core / bank / impl / DefaultBankAccountService. java
- testsrc / com / core /bank/impl/DefaultBankAccountServiceUnitTest.java
- src / com / core / bank / impl / DefaultBankAccountService.class
- src / com / core / bank / impl / DefaultBankAccServiceUnit20.class *
Я создал Ant macrodef
с конфигурацией Pitest:
<macrodef name="mutation-tests">
<sequential>
<path id="pitest.path">
<pathelement location="lib/junit-4.12.jar"/>
<pathelement location="lib/xstream-1.4.11.1.jar"/>
<pathelement location="lib/xmlpull-1.1.3.1.jar"/>
<pathelement location="lib/pitest-1.4.11.jar"/>
<pathelement location="lib/pitest-entry-1.4.11.jar"/>
<pathelement location="lib/pitest-ant-1.4.11.jar"/>
</path>
<path id="test.path">
<pathelement location="classes"/>
<pathelement location="lib/junit-4.12.jar"/>
</path>
<path id="mutation.path">
<path refid="pitest.path"/>
<path refid="test.path"/>
</path>
<taskdef name="pitest" classname="org.pitest.ant.PitestTask" classpathref="pitest.path"/>
<pitest
pitClasspath="pitest.path"
classPath="mutation.path"
targetClasses="com.core.bank.impl.DefaultBankAccountService"
targetTests="com.core.bank.impl.DefaultBankAccountServiceUnitTest"
reportDir="report"
sourceDir="src"
threads="2"
verbose="true"
/>
</sequential>
</macrodef>
Это дает мне следующий результат :
[pitest] 14:25:06 PIT >> FINE : Maximum available memory is 7090 mb
[pitest] 14:25:06 PIT >> FINE : MINION : Installing PIT agent
[pitest]
[pitest] 14:25:06 PIT >> INFO : Sending 1 test classes to minion
[pitest] 14:25:06 PIT >> INFO : Sent tests to minion
[pitest] 14:25:06 PIT >> FINE : Coverage generator Minion exited ok
[pitest] 14:25:06 PIT >> INFO : Calculated coverage in 0 seconds.
[pitest] 14:25:06 PIT >> FINE : Used memory after coverage calculation 30 mb
[pitest] 14:25:06 PIT >> FINE : Free Memory after coverage calculation 449 mb
[pitest] 14:25:06 PIT >> INFO : Created 1 mutation test units
[pitest] 14:25:06 PIT >> FINE : Used memory before analysis start 57 mb
[pitest] 14:25:06 PIT >> FINE : Free Memory before analysis start 421 mb
[pitest] 14:25:06 PIT >> FINE : Running 1 units
[pitest] ================================================================================
[pitest] - Mutators
[pitest] ================================================================================
[pitest] > org.pitest.mutationtest.engine.gregor.mutators.BooleanTrueReturnValsMutator
[pitest] >> Generated 5 Killed 0 (0%)
[pitest] > KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0
[pitest] > MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
[pitest] > NO_COVERAGE 5
[pitest] --------------------------------------------------------------------------------
[pitest] > org.pitest.mutationtest.engine.gregor.mutators.EmptyObjectReturnValsMutator
[pitest] >> Generated 1 Killed 0 (0%)
[pitest] > KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0
[pitest] > MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
[pitest] > NO_COVERAGE 1
[pitest] --------------------------------------------------------------------------------
[pitest] > org.pitest.mutationtest.engine.gregor.mutators.NullReturnValsMutator
[pitest] >> Generated 2 Killed 0 (0%)
[pitest] > KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0
[pitest] > MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
[pitest] > NO_COVERAGE 2
[pitest] --------------------------------------------------------------------------------
[pitest] > org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator
[pitest] >> Generated 15 Killed 0 (0%)
[pitest] > KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0
[pitest] > MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
[pitest] > NO_COVERAGE 15
[pitest] --------------------------------------------------------------------------------
[pitest] > org.pitest.mutationtest.engine.gregor.mutators.BooleanFalseReturnValsMutator
[pitest] >> Generated 3 Killed 0 (0%)
[pitest] > KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0
[pitest] > MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
[pitest] > NO_COVERAGE 3
[pitest] --------------------------------------------------------------------------------
[pitest] > org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator
[pitest] >> Generated 14 Killed 0 (0%)
[pitest] > KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0
[pitest] > MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
[pitest] > NO_COVERAGE 14
[pitest] --------------------------------------------------------------------------------
[pitest] ================================================================================
[pitest] - Timings
[pitest] ================================================================================
[pitest] > scan classpath : < 1 second
[pitest] > coverage and dependency analysis : < 1 second
[pitest] > build mutation tests : < 1 second
[pitest] > run mutation analysis : < 1 second
[pitest] --------------------------------------------------------------------------------
[pitest] > Total : < 1 second
[pitest] --------------------------------------------------------------------------------
[pitest] ================================================================================
[pitest] - Statistics
[pitest] ================================================================================
[pitest] >> Generated 40 mutations Killed 0 (0%)
[pitest] >> Ran 0 tests (0 tests per mutation)
[pitest] 14:25:06 PIT >> INFO : Completed in 0 seconds
Когда я запускаю Pitest через плагин IntelliJ, он отлично работает со следующей конфигурацией:
- Целевые классы: com.core.bank.impl.DefaultBankAccountService
- Целевые тесты: com.core.bank.impl.DefaultBankAccountServiceUnitTest
- Исходный каталог: sr c
Можете ли вы увидеть какие-либо проблемы с моим Ant configur ция