0% found this document useful (0 votes)
559 views2 pages

TestNG Anotations Handson

Selenium WebDriver Hands-on Solutions | TCS Fresco Play
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
559 views2 pages

TestNG Anotations Handson

Selenium WebDriver Hands-on Solutions | TCS Fresco Play
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

TestNG Annotation Hands-On

File Name - TestNG_Annotations.java

package Testng;

import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.AfterSuite;

public class TestNG_Annotations {

// Write your code here

@AfterSuite
public void afterSuite(){
System.out.println("After Suite has been executed as no.9");
}
@BeforeClass
public void beforeClass(){
System.out.println("Before Class has been executed as no.3");
}
@BeforeTest
public void beforeTest(){
System.out.println("Before Test has been executed as no.2");
}
@BeforeMethod
public void beforeMethod(){
System.out.println("Before Method has been executed as no.4");
}
@Test
public void GetpageTitle(){
System.out.println("Test has been executed as no.5");
}
@AfterMethod
public void afterMethod(){
System.out.println("After Method has been executed as no.6");
}
@AfterTest
public void afterTest(){
System.out.println("After Test has been executed as no.8");
}
@BeforeSuite
public void beforeSuite(){
System.out.println("Before Suite has been executed as no.1");
}
@AfterClass
public void afterClass(){
System.out.println("After Class has been executed as no.7");
}

You might also like