You are on page 1of 3

TestNG:

## What is TestNG and its benefits?

Ans:-> TestNG is a Testing Framework which has lot of useful features like

 Parallel Execution.
 Dependency on one or more test Method.
public class Dependent {

@Test (dependsOnMethods = { "OpenBrowser" })


public void SignIn() {
System.out.println("This will execute second (SignIn)");
}
@Test
public void OpenBrowser() {
System.out.println("This will execute first (Open Browser)");
}
}

 We can assign priority to test methods also.

 It allow grouping of test methods.

 It supports parameterizing using @DataProvider Annotation.


 TestNG has a different assertions also which is helpful as check point.
 It has built in reporting as well.
## What are TestNG annotations?

o @BeforeSuite
o @BeforeTest
o @BeforeClass
o @BeforeMethod
o @Test
o @AfterMethod
o @AfterClass
o @AfterTest
o @AfterSuite

## What is correct order of TestNG tags in xml?

## What is TestNG xml file?

 using TestNG xml we can do:


o Test run.
o Set test dependency.
o Include or exclude any test, method, class or package.
o Set Priority
o Parallel execution
o Parameterize the test cases
o Group

## How to disable a run for any Test method?

Ans:-> @Test(enabled = false)

## How to run any specific test multiple times?

## Timeout at Test Level

@Test( timeOut = 700)


## Use of Parameterized in TestNG

 First we need to add @parameter annotation in test

 Below stuff need to be done in testNG xml file.

## Parallel run in TestNG

You might also like