如何在Maven Surefire的一种测试方法中排除argLine配置?

问题描述

我正在尝试使用maven surefire插件执行中排除一种测试方法。 尝试使用标记并将测试放置在另一个文件中,标记也不能与@Tag(groupName = includedMethod)注释一起使用。有什么办法可以解决这种情况? test()应该与选项一起运行,而 test2()应该在没有这些选项的情况下运行。

测试类:

public class AcceptanceTests {

    @Test
    public void test(){
        System.out.println("This should run");
    }

    @Test
    public void test2(){
        System.out.println("This should be excluded");
    }
}

POM文件

<profile>
            <id>acceptanceTests</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <argLine>${argLine} -Dspring.profiles.active="PROFILE" -Dparameter.add=true
                            </argLine>
                            <suiteXmlFiles>
                                <suiteXmlFile>src/test/resources/testng/acceptance-tests.xml</suiteXmlFile>
                            </suiteXmlFiles>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

SuiteXMLFile:

<!DOCTYPE suite SYstem>
<suite name="ACCEPTANCE-TEST-SUITE">
    <test name="ACCEPTANCE-TESTS">
        <classes>
            <class name="acceptanceTests.AcceptanceTest" />
        </classes>
    </test>
</suite>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)