0

TestNG 属性“delegateCommandSystemProperties”不适用于 maven surefire 插件。

我正在尝试在 testng.xml 中运行一个使用名为“count”的参数的测试

尽管我将变量传递如下

mvn test -Dcount=2 -Dtest=<XXXXXX>

抛出的错误是

@Test 在方法 XXXXXX 上需要参数“count”,但尚未标记为 @Optional 或已定义

有没有人尝试将delegateCommandSystemProperties与maven surefire一起使用???

我配置属性的 pom.xml 片段

 <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
            <suiteXmlFiles>
                <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
            </suiteXmlFiles>
            <properties>
                <property>
                 <name>delegateCommandSystemProperties</name>
                 <value>true</value>
                </property>
            </properties>
            :
            :

简而言之,我需要帮助从 maven surefire 命令将参数传递给 testng 测试!

4

1 回答 1

0

delegateCommandSystemProperties 是一个蚂蚁任务。为了从maven surefire在命令行中传递参数,方法如下

mvn test -DargLine="-Dcount=2"
于 2013-09-30T13:36:37.567 回答