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.

cmd3

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-

CMD

Set the class path and libraries path by running below command-

set classpath=<Project Home Path>\bin;<Project Home Path>\lib\*

cmd1

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.

CMD2

I hope it would help people to run testng.xml file from the command prompt.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s