Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

java - Pitest can't detect class of test

i have problem with my configuration of maven and pitest.

Pitest generation mutation is ok but he can't see my class of test ..

if you have any solution :D


I have main source like that /src/main/java/com.plugin..... .java

I have test source like that /src/test/java/com.plugin.... .java


pom.xml config :

<plugin>
            <groupId>org.pitest</groupId>
            <artifactId>pitest-maven</artifactId>
            <version>1.1.9</version>
            <configuration>
                <targetClasses>
                    <param>com.plugin.business.centre*</param>
                </targetClasses>
                <targetTests>
                    <param> com.plugin.business.centre*</param>
                </targetTests>
            </configuration>
    </plugin>

in < targetTests > .. he know only my source class with autocomplete and not my test class.


[INFO] --- pitest-maven:1.1.9:mutationCoverage (default-cli) @ Polux ---
[INFO] Found plugin : Default csv report plugin
[INFO] Found plugin : Default xml report plugin
[INFO] Found plugin : Default html report plugin
[INFO] Found plugin : Default limit mutations plugin
[INFO] Found shared classpath plugin : Default mutation engine
[INFO] Adding org.pitest:pitest to SUT classpath
[INFO] Mutating from /Users/Mods/Documents/*****/target/classes
08:35:36 PIT >> INFO : Verbose logging is disabled. If you encounter an problem please enable it before reporting an issue.
08:35:36 PIT >> INFO : MINION : objc[677]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be us
08:35:36 PIT >> INFO : MINION : ed. Which one is undefined.

08:35:37 PIT >> INFO : Sending 0 test classes to minion
08:35:37 PIT >> INFO : Sent tests to minion
08:35:37 PIT >> INFO : MINION : 08:35:37 PIT >> INFO : Checking environment

08:35:37 PIT >> INFO : MINION : 08:35:37 PIT >> INFO : Found  0 tests

08:35:37 PIT >> INFO : MINION : 08:35:37 PIT >> INFO : Dependency analysis reduced number of potential tests by 0

08:35:37 PIT >> INFO : MINION : 08:35:37 PIT >> INFO : 0 tests received

08:35:37 PIT >> INFO : Calculated coverage in 0 seconds.
08:35:37 PIT >> INFO : Created  20 mutation test units
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I need to add the junit5 plugin as a dependency (as I'm using JUnit 5).

<plugin>
    <groupId>org.pitest</groupId>
    <artifactId>pitest-maven</artifactId>
    <version>1.4.5</version>
    <dependencies>
        <dependency>
            <groupId>org.pitest</groupId>
            <artifactId>pitest-junit5-plugin</artifactId>
            <version>0.8</version>
        </dependency>
    </dependencies>
    <configuration>
        ...
    </configuration>
</plugin>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...