TestNG, POM, POF - Overview
TestNG, POM, POF - Overview
- An Introduction
Uma Shankar
Agenda
Maven Overview
TestNG Overview
TestNG Annotations
TestNG XML
TestNG Parameters and Data Provider
TestNG Listeners
TestNG Parallel Execution
Maven Overview
The TestNG XML contains all the test methods, classes, packages
that need to be executed
The TestNG XML can be used to specify which configurations
that need to be created
We can configure which groups should be run (include-groups)
and which groups should not be run (exclude-groups)
Thread Count, failure policy, parallel tests etc., can be configured
Sample TestNG XML
Parameterization
One of the important features of TestNG is parameterization.
This feature allows users to pass parameters to tests as arguments.
There are two ways through which we can pass parameter values to
TestNG tests.
Types of parameterization:
Using @Parameters
Using @DataProvider
TestNG Listeners
There are several interfaces that allow you to modify TestNG's behavior.
These interfaces are called "TestNG Listeners". Here are a few listeners:
ITestListener
ISuiteListener
IAnnotationTransformer
IAnnotationTransformer2
IHookable
IInvokedMethodListener
IMethodInterceptor
IReporter
TestNG Listeners - ITestListener
ITestListener: The Listener makes the call before and after the Test
not the Suite. It has seven methods in it.
onTestSuccess: Invoked after any test is successful
onTestFailure: Invoked after any test fails
onTestFailedButWithinSuccessPercentage: Invoked after test
method fails but has been annotated with successPercentage
onTestSkipped(ITestResult result): Invoked each time a test is
skipped
POM – Page Object Model