2

I have a problem executing TestNG from command line. Everything works perfect when I invoke it directly from IntellIJ but when I try to do this from command line I'm constantly gettinng:

=============================================== Parallel Tests Suite Total tests run: 0, Passes: 0, Failures: 0, Skips: 0 =============================================== [TestNG] No tests found. Nothing was run 

I've tried every solution from: TestNG not running tests in testing suite but still nothing is working for me.

My test classes are extending base class where driver is iniciated. Once I've tried to not use inheritance but simple driver calling (driver is static) from base class and with verbose option something more appeared in output:

Tests run: 1, Failures: 1, Skips: 0 

But this way I'm getting java.lang.NoClassDefFoundError in every test class invoked so I guess it's not a solution.

My testng.xml file looks like:

<suite name="Parallel Tests Suite" parallel="tests" thread-count="1" verbose ="5"> <test name="TestExample" > <classes> <class name = "package.ExampleClass"/> .... </classes> </test> </suite> 

I'm trying to execute tests by:

Java -cp "...\ProjectName\lib\*;...\ProjectName\target\test-classes" org.testng.TestNG testng.xml 

In lib directory there are:

  • jcommander,
  • selenium-java-client-driver,
  • selenium-server-standalone,
  • testng

jars.

In test-classes there are .class files.

Stucture of my project is like:

  • ProjectName
    • src
      • test
        • java
          • package
            • tests
            • pages
            • ...
    • target
      • test-classes
      • ...
    • testng.xml
    • ...

Would really appreciate some help with this. Thank you!

2
  • possible duplicate of stackoverflow.com/questions/11896791/… Commented May 16, 2019 at 9:15
  • I've also seen this post but there is nothing helpful for me. Thanks anyway. Commented May 16, 2019 at 9:24

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.