siqbal
siqbal

Reputation: 33

Cannot run TestNG from command line

I am trying to run testng.xml from command line. I have testng7.2.jar and JCommander jar file in the lib folder of the root project.

I am setting the classpath in the following way:

set classpath=C:\Users\test-automation\bin;C:\Users\test-automation\lib\*

The lib folder has the following jar files:

com.beust.jcommander_1.72.0.jar
org.apache-extras.beanshell.bsh_2.0.0.b6.jar
org.testng_7.2.0.r202003151902.jar
org.yaml.snakeyaml_1.21.0.jar

I am running the following command to execute testng from command prompt.

java -Dtestng.dtd.http=true org.testng.TestNG C:\Users\test-automation\testng.xml

But getting the following error:

[TestNG] [ERROR]
Cannot find class in classpath: main.IConductorRunner

TestNG suite runs perfectly from eclipse console. But when I try to do so from command line (windows command prompt), I get the above error. Not sure what to do excactly as I am new to testng.

Upvotes: 0

Views: 327

Answers (1)

Alexey R.
Alexey R.

Reputation: 8676

You have everything in your classpath except of your test classes where your test logic is coded. Add the path to your test classes to that TestNG knows where to take the test code.

Upvotes: 0

Related Questions