简体   繁体   中英

Maven command line to run TestNG which are packaged to jar

I have packaged my test project into a .jar file with pom and dependencies as test-SNAPSHOT-jar-with-dependencies.jar . How can I use the Maven command line to run it?

I tried this, but it doesn't work:

cd target
mvn test -DtestNG.file=testng.xml test-SNAPSHOT-jar-with-dependencies.jar 

Run command

mvn test -DtestNG.file=/path/to/testng.xml 

from root of your project or module (one level with pom.xml, src and target folders).

Test classes are not copied to the result jar and always run in the fixed phase (test phase).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM