简体   繁体   中英

How to run the testng script of maven project through the command line in mac

I am trying to run the automation script through TestNG which starts the Appium session and execute the test cases on iPad application. I am able to run the script from eclipse but unable to run the the terminal. Could any one help me to run the script through terminal. I tried following command but i didn't get the expected output.

My-Mac:iPadAutong_clients jenkins$ java -cp "/Library/Java/Extensions/testng-6.11.jar:/Users/jenkins/Desktop/new_v8/SourceCode/iPadAutong_clients/lib/selenium-support-3.6.0.jar:/Users/jenkins/Desktop/new_v8/SourceCode/iPadAutong_clients/lib/selenium-java-3.6.0.jar:/Users/jenkins/Desktop/new_v8/SourceCode/iPadAutong_api/target/_iPadAutoNg_api-8.1.7.jar:/Users/jenkins/Desktop/new_v8/SourceCode/iPadAutong_ahm/target/_iPadAutoNg_ahm-8.1.7.jar:/Users/jenkins/Desktop/new_v8/SourceCode/iPadAutong_clients/target/_iPadAutomation_Clients-8.1.7.jar" org.testng.TestNG /Users/jenkins/Desktop/new_v8/SourceCode/iPadAutong_clients/suites/programs/EngagementBasedProgram/InitiateEngagementBasedConsultingProgram.xml

===============================================
ConsultingPrograms
Total tests run: 0, Failures: 0, Skips: 0
===============================================

You should use mvn command to build and run your tests. Try using mvn clean compile test -Dtest=<your class name> from your terminal.

You can also use Automator to create a bash script and call it easily. Just create a new Automator application and select "Run Bash Script" utility and enter the below code

source ~/.bash_profile 
cd <Your Maven project location>
mvn clean compile test -Dtest=<your class name>

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