Reputation: 1796
The Project as follows:
while running the ** TestngTestSuiteUsingXML** java file in eclipse it is fetching the Test.XML and it is working fine.
But when i verified the same in command Prompt getting error as follows:
C:\Jars>javac TestngTestSuiteUsingXML.java
TestngTestSuiteUsingXML.java:6: error: package org.testng does not exist
import org.testng.TestNG;
^
TestngTestSuiteUsingXML.java:7: error: package org.testng.xml does not exist
import org.testng.xml.XmlSuite;
^
TestngTestSuiteUsingXML.java:15: error: cannot find symbol
XmlSuite suite = new XmlSuite();
^
symbol: class XmlSuite
location: class TestngTestSuiteUsingXML
TestngTestSuiteUsingXML.java:15: error: cannot find symbol
XmlSuite suite = new XmlSuite();
^
symbol: class XmlSuite
location: class TestngTestSuiteUsingXML
TestngTestSuiteUsingXML.java:17: error: cannot find symbol
List<XmlSuite> suites = new ArrayList<XmlSuite>();
^
symbol: class XmlSuite
location: class TestngTestSuiteUsingXML
TestngTestSuiteUsingXML.java:17: error: cannot find symbol
List<XmlSuite> suites = new ArrayList<XmlSuite>();
^
symbol: class XmlSuite
location: class TestngTestSuiteUsingXML
TestngTestSuiteUsingXML.java:19: error: cannot find symbol
TestNG tng = new TestNG();
^
symbol: class TestNG
location: class TestngTestSuiteUsingXML
TestngTestSuiteUsingXML.java:19: error: cannot find symbol
TestNG tng = new TestNG();
^
symbol: class TestNG
location: class TestngTestSuiteUsingXML
8 errors
Upvotes: 2
Views: 5861
Reputation: 3776
You have to add testNG.jar to the classpath. The following links might be helpful :-
Java command line with external .jar
How to include jar files with java file and compile in command prompt
You would have to download testNG jar and add it as well as selenium jar files to your class path. I suggest you to use a build and dependency tools such as maven or ant
Upvotes: 1