Cannot find class in classpath running testng from command line

389 views
Skip to first unread message

Mark N

unread,
Feb 21, 2014, 3:59:42 PM2/21/14
to testng...@googlegroups.com
I have done this successfully, but it has been a few years.
I am trying to use the -Dtestng.test.classpath argument to tell TestNG where to find my test class and it cannot find it.

My setup:

A Java program called SmokeTest.java

public class SmokeTest {
  public static void main(String[]args) {
    System.out.println("hello");
  }
}

javac SmokeTest.java -->  I get SmokeTest.class in current directory

set CLASSPATH=.

java SmokeTest
hello

My testng.xml file:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="UNP">
  <test name="SmokeTest" annotations="JDK" verbose="2" >
    <classes>
        <class name="SmokeTest"></class>
    </classes>
  </test>
</suite>

my current directory:
C:\Users\mike\unpnotifyserv

I put testng-6.8.jar in my local directory and set CLASSPATH to   C:\Users\mike\unpnotifyserv\testng-6.8.jar

my command to run TestNG
java -Dtestng.test.classpath="C:\Users\mike\unpnotifyserv" org.testng.TestNG testng.xml

the result:  
[TestNG] [Error]
Cannot find class in classpath: SmokeTest

I also tried turning the "\" s  to "/" s in the testng.test.classpath

Please help !   thanks

Reply all
Reply to author
Forward
0 new messages