This is an alternate way to execute our selenium script from command prompt. Here, I am considering few points-
- Your project is already set-up in Eclipse
- Project already has testng.xml file.
- All selenium and other third party jar files are located under project home folder (lib folder).
- You are able to execute your script by running testng.xml file.
If above conditions are matching then very few steps are there to execute same script from command prompt. Follow the below steps-
Open Command Prompt and Go to Project home directory-
Set the class path and libraries path by running below command-
set classpath=<Project Home Path>\bin;<Project Home Path>\lib\*
Now run the testng.xml file by running below command-
java org.testng.TestNG testng.xml—-Make sure “org.testng.TestNG” TestNG word should have ‘T’ and ‘NG’ in caps.
I hope it would help people to run testng.xml file from the command prompt.