質問

TestNG property "delegateCommandSystemProperties" is not working with maven surefire plugin.

I am trying to run a single test in testng.xml which uses parameter named "count"

Eventhough I pass the variable as below

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

the error thrown is

Parameter 'count' is required by @Test on method XXXXXX but has not been marked @Optional or defined

Has anyone tried to use delegateCommandSystemProperties with maven surefire???

pom.xml snippet where I configured the property

 <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>
            :
            :

In a nutshell, I need help in passing parameter to testng test from maven surefire command!

役に立ちましたか?

解決

delegateCommandSystemProperties is an ant task. In order to pass parameter in commandline from maven surefire following is the way

mvn test -DargLine="-Dcount=2"
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top