Selenium TestNG get started Method 1 & execution hierearchy
- Create new sample test class with TestNG and run for understanding the execution
package com.test.practice;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;
public class NewTest {
@Test
public void f() {
System.out.println("TEst method");
}
@BeforeMethod
public void beforeMethod() {
System.out.println("before method");
}
@AfterMethod
public void afterMethod() {
System.out.println(" after method");
}
}
Output:[RemoteTestNG] detected TestNG version 6.14.2
before method
TEst method
after method
PASSED: f
Below is the execution hierarchy for the TESTNG
Below is the execution hierarchy for the TESTNG
- before Test suite
- before Test
- before Class
- before Method
- TEST METHODS
- After method
- After class
- After test
- After Test Suite
Comments
Post a Comment