Reputation: 1
I am designing a customized automation framework for testing, using Selenium Webdriver and Java.
Now for reporting purpose I am trying to integrate TestNG framework with my project.
Now I am having a GUI based interface which is containing some specifications, where particular feature and testcases can be selected. Now I need to run this application first,then in turn it is going to trigger the TestNG framework using testng.xml .
So I need to know how I should do this thing ?
And also through different links I found to run the testng.xml some package named org.testng.TestNg is required, But I am not able to figure it out where it is existing?
Upvotes: 0
Views: 1698
Reputation: 648
You may need to include testng jar file in your project to get the package. You can create testng.xml programatically refer this link.
Also you can run tests by adding a class having main function as below :
public static void main(String[] args)
{
org.testng.TestNG.main(args);
}
Where arguments will be testNG arguments e.g. java org.testng.TestNG testng1.xml [testng2.xml testng3.xml ...]
Update : To start using maven you can refer this link. If you are using Elipse IDE than you can also configure Maven with using M2E plugin for eclipse. To confuigure Eclipse with maven please refere link.
Now to use Maven with testNG and selenium you need to configure your Maven pom.xml file to inculde testNG and Selenium webdriver dependancies. Second please add my above main function in your class to run Testng form Jar. Now using maven build commands please create a jar file for your project. Maven provides variety of plugins and you can use some of them as per your use. However I will suggest you use maven-jar-plugin,maven-assembly-plugin.
Once you will run the Maven commands. the jar or zip will be created in Target folder in your project directory. You can run jar using java-jar jarname testng.xml.
Upvotes: 1