Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven surefire测试-包括和不包括_Maven_Testing - Fatal编程技术网

Maven surefire测试-包括和不包括

Maven surefire测试-包括和不包括,maven,testing,Maven,Testing,我有一个类a.java和两个测试类ATest.java和AITests.java。ITest是用于集成的。试验必须按照以下要求进行: 如果未选择Maven配置文件,则只需测试Atest 当ITEST配置文件激活时,必须同时测试ATest和AITest 问题是,当我使用命令 mvn -P itests test 然后只测试ATest,不测试AITest。但我不知道我在这里错过了什么。有什么提示吗 我的pom.xml是: 对于集成测试,请使用Maven failsafe插件: 如果愿意,可以在命令

我有一个类a.java和两个测试类ATest.java和AITests.java。ITest是用于集成的。试验必须按照以下要求进行:

如果未选择Maven配置文件,则只需测试Atest

当ITEST配置文件激活时,必须同时测试ATest和AITest

问题是,当我使用命令

mvn -P itests test
然后只测试ATest,不测试AITest。但我不知道我在这里错过了什么。有什么提示吗

我的pom.xml是:


对于集成测试,请使用Maven failsafe插件:


如果愿意,可以在命令行中跳过它。

还有一件事。当故障保护插件执行it测试时,是否可以排除surefire测试?
...
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M4</version>
            <configuration>
                <excludes>
                    <exclude>**/*ITest.java</exclude>
                </excludes>
            </configuration>
        </plugin>
    </plugins>
</build>

<profiles>
    <profile>
        <id>itests</id>
        <activation>
            <property>
                <name>itests</name>
                <value>true</value>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.0.0-M4</version>
                    <configuration>
                        <includes>
                            <include>**/*Test.java</include>
                        </includes>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>
...