1

It seems i can't find a way to run only one test case using TestNG and maven, using an xml file to parameterize the test suite.

I can run specific test suite in the command line with the command:

mvn test -DsuiteXmlFile=path/to/resources/suite.xml

Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.758 sec - in TestSuite
testHighUserLoginNoPass_Ok(suitesApi.TestApi)  Time elapsed: 2.714 sec
testLowUserLoginNoPass_Error(suitesApi.TestApi)  Time elapsed: 0.168 sec
testLowUserLoginNoPass_Error(suitesApi.TestApi)  Time elapsed: 0.241 sec
testLowUserLoginNoPass_Error(suitesApi.TestApi)  Time elapsed: 1.047 sec
testLowUserLoginNoPass_Error(suitesApi.TestApi)  Time elapsed: 2.685 sec
testLowUserLoginNoPass_Error(suitesApi.TestApi)  Time elapsed: 1.017 sec
testLowUserLoginNoPass_Error(suitesApi.TestApi)  Time elapsed: 0.27 sec

Results :

Tests run: 7, Failures: 0, Errors: 0, Skipped: 0

But when i want to run an specific test case with the command:

mvn test -DsuiteXmlFile=path/to/resources/suite.xml -Dtest=TestApi#testHighUserLoginNoPass_Ok

I got an error showing that "TestApi#testHighUserLoginNoPass_Ok" are not getting the parameters in the xml suite file

org.testng.TestNGException:

Parameter 'apk_id' is required by BeforeMethod on method beforeMethod but has not been marked @Optional or defined
Lea2501
  • 311
  • 6
  • 22

0 Answers0