TestNG Tutorial
- Introduction to TestNG:
In Automation testing for Java Selenium tool, the TestNG is a framework that is based on Junit. Since Selenium doesn't have many features that made a tester work easier that will be covered by TestNg such as easy execution of automation scripts, end-to-end testing, generates logs, read data from xml file, parallel execution of test cases, parametrization and reporting tools. The following flow chart helps you to get an idea of how TestNG works.
TestNG annotation:
To remember:
SUITE ka TEST kiya CLASS METHOD ka hi TEST kiya
---------------------------------------------------------------
Paramterization using :
1. Parametrization using (@Parameter inside TestNG .xml)
2. DataProvider (@dataProvider)
---------------------------------------------------------------
1. Using @Parameter:
Let see how to enter @ Paratemer inside the test script:
Check using the first program, down here :
import org.testng.annotations.Paramters;
import org.testng.annotations.Test;
public class testClass {
@Parameters({"paramName"})
@Test
public void paramTestOne(String param)
{
System.out.println(" the value is :"+param);
}
}
To run here using TestNG xml:
<suite name = "Enter Suite Name Here" verbose = "1" >
<parameter name = "param name which place in the @ parameter" value = "enterParamValue " >
<test name = "enterTestName">
<classes>
<class name = "package.className">
<methods>
<include name = "enterMethodName"/>
</methods>
</class>
</classes>
</test>
-----------------------------------------------------------
paramName = param name which place in the @ parameter , value = "hello world"
paramTestOne = enterMethodName
testClass = className
------------------------------------------------------------
Comments
Post a Comment