0
votes

I've been working on developing java based tests using the TestNG framework. I'm trying execute the tests from the command line and am running into the error that is stated in this thread title. The tests run fine through Eclipse on Mac, and they also run fine on Windows command line (as well as Eclipse on Win). I'm fairly new to Mac OS, so i'm probably leaving something out of the CLASSPATH variable. Any thoughts?

The setup I've tried to do is below:

export CLASSPATH=/Users/administrator/git/webdriver/lib/*
java org.testng.TestNG main_site_test_suite.xml

The output is:

[TestNG] [ERROR]
Cannot find class in classpath: platform.mainsite.LogIn

My XML file looks like this:

<test name="Log In Test">
    <classes>
        <class name="platform.mainsite.LogIn"/>
    </classes>
</test>

<test name="Header Test">
    <classes>
        <class name="platform.mainsite.Header"/>
    </classes>
</test>

<test name="Footer Test">
    <classes>
        <class name="platform.mainsite.Footer"/>
    </classes>
</test>

<test name="Body Test">
    <classes>
        <class name="platform.mainsite.Body"/>
    </classes>
</test>

1

1 Answers

0
votes

make sure you pointed full package path to your tests: e..g my testNg xml:

<suite name="Main Test Suite" verbose="2" parallel="tests" thread-count="8">

    <test name="Suite1">
        <classes>

            <class name="com.tanjarine.automation.testcases.LoginPageTest"/>

            <!--<class name="com.tanjarine.automation.testcases.ModifiersTest"/>-->

        </classes>
    </test>
    <test name="Suite2">
        <classes>

            <class name="com.tanjarine.automation.testcases.VenueManagementTest"/>
            <class name="com.tanjarine.automation.testcases.SetupFullVenueTest"/>

        </classes>
    </test>

    <test name="Suite3">
        <classes>

            <class name="com.tanjarine.automation.testcases.GameManagementTest"/>

        </classes>
    </test>

    <test name="Suite4">
        <classes>

            <class name="com.tanjarine.automation.testcases.AdminHomePageTest"/>
            <class name="com.tanjarine.automation.testcases.ApkRegisterTest"/>

        </classes>
    </test>

    <test name="Suite5">
        <classes>

            <class name="com.tanjarine.automation.testcases.PromotionsPageTest"/>

        </classes>
    </test>


</suite>

full package path + TestClassName without extension