测试NG属性"delegateCommandSystemProperties"在专家万无一失



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

我正在尝试在testng中运行单个测试.xml该测试使用名为"count"的参数

即使我按如下方式传递变量

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

引发的错误是

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

有没有人尝试将委托命令系统属性与 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 万无一失的命令进行测试测试!

delegateCommandSystemProperties 是一个 ant 任务。为了从 maven surefire 在命令行中传递参数,以下是以下方式

mvn test -DargLine="-Dcount=2"

最新更新