Question

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!

Était-ce utile?

La solution

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

mvn test -DargLine="-Dcount=2"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top