문제

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