testNG实战02_idea_java_@After&@Before相关注解
- @AfterMethod&@BeforeMethod
每一次运行测试方法时,如果写了@BeforeMethod,都会先运行BeforeMethod方法。
package com.ngtest;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class testNG {
//@Test是最基本的testng注解
@Test
public void testCase1(){
System.out.println("测试01");
}
@Test
public void testCase2(){
System.out.println("测试02");
}
@BeforeMethod
public void beforeMethod(){
System.out.println(