在Ant中配置的Pitest找不到测试,但在IntelliJ插件中却能正常工作。

问题描述 投票:0回答:1

我在使用Pitest时遇到了一些问题,我将试着描述如下。

  1. 项目结构:

    • project-folder:
      • build.xml
      • lib*.jar
      • srccomcorebankimplDefaultBankAccountService.java。
      • testsrccomcorebankimplDefaultBankAccountServiceUnitTest.java。
      • srccomcorebankimplDefaultBankAccountService.class。
      • srccomcorebankimplDefaultBankAccountServiceUnitTest.class。
  2. 我创造了一个蚂蚁 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

当我通过IntelliJ插件运行Pitest时,在以下配置下运行正常。

  • 目标类:com.core.bank.impl.DefaultBankAccountService。
  • 目标测试:com.core.bank.impl.DefaultBankAccountServiceUnitTest。
  • 来源部门:SRC

你能看出我的Ant配置有什么问题吗?

java intellij-idea ant intellij-plugin pitest
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.