Search code examples
command-linetestngtest-suite

TestNG testsuite not running from command line


I need some help running my testng testsuite from command line:

Project Structure

compiled classes

myproject\bin
myproject\bin\com\...

source classes

myproject\test
myproject\test\com\...

required libraries

myproject\libraries
myproject\libraries\xy.jar

test suite

myproject\test\com\...\test\mySuite.xml

command line call

cd myproject
java -cp libraries\* -Dtestng.test.classpath="bin\*;test\*" org.testng.TestNG test\com\...\test\mySuite.xml

result

[TestNG] Running:
  F:\...\myproject\test\com\...\test\mySuite.xml

===============================================
mySuite
Total tests run: 0, Failures: 0, Skips: 0
===============================================

UPDATE

mySuite.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="mySuite.xml" parallel="classes" thread-count="10">

    <test name="happy path">
        <packages>
            <package name="com...test.functional.happyPath" />
        </packages>
    </test>

    <test name="exception path">  
        <packages>
            <package name="com...test.functional.exceptionPath" />
        </packages>
    </test>

</suite>

Solution

  • I read the following: http://github.com/longhua/testng-test-classpath-property-issue-1

    After that I changed my command line call to:

    java -cp libraries*;bin org.testng.TestNG test\com\...\test\mySuite.xml
    

    That worked for me...