0

I would like to run TestNG Suite from command line on Linux. I'm using eclipse to run test, but I have problem with command line. I know that I need to have testng.jar and I have it in /home/karcio/dev/testng-6.4.jar, location my suite xml is /home/karcio/git/java-test-automation/Automation/test-output/Default suite/TestSuite.xml . Commands what I tried,

  1. set classpath /home/karcio/dev/testng-6.4.jar
  2. cd /location to my suite xml file: java org.testing.TestNG TestSuite.xml

This is error what I see:

Exception in thread "main" java.lang.NoClassDefFoundError: org/testing/TestNG Caused by: java.lang.ClassNotFoundException: org.testing.TestNG

I'm new in those path and classpath, I'm little bit confusing :(

Thank you

Little update, I think I did all good, now when I put to terminal: java org.testng.TestNG Test.xml I've got this error:

Exception in thread "main" org.testng.TestNGException: No sourcedir was specified at org.testng.TestNG.checkConditions(TestNG.java:1170) at org.testng.TestNG.privateMain(TestNG.java:1010) at org.testng.TestNG.main(TestNG.java:997)

all path are exported, so maybe this is wrong version of testng.jar, tried with versions 5.5, 6.4, 6.5, 6.6, 6.7 but I think only version 5.5 is working,

3
  • 1
    Are you compiling your java classes first? I'd suggest looking into using Ant to compile and run your suite. Commented Apr 24, 2013 at 22:42
  • Yes. I also exported CLASSPATH for my class files (/bin/*class). I read that "No sourcedir was specified" I should remove java doc but I did not create any :( Commented Apr 25, 2013 at 9:08
  • There is typing mistake in your command. It should be testng instead of testing Commented Oct 7, 2015 at 10:35

1 Answer 1

4

There is a typo in the class package org.testing.TestNG

should be org.testng.TestNG

(There no i in the .testng. part)

http://testng.org/javadoc/org/testng/TestNG.html

Sign up to request clarification or add additional context in comments.

1 Comment

Hi patrungel thx. I did typo but after export classpath I used tab for AutoComplete, so now I'm free from any mistakes.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.