注解实战BeforeMethed和afterMethed

package com.course.testng;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class BasicAnnotation {
//最基本的注解,用来把方法标记为测试的一部分
@Test
public void testCase1() {
System.out.println("这是测试用例1");
}
@Test
public void testCase2() {
System.out.println("这是测试用例2");
}
//测试方法之前运行的
@BeforeMethod
public void beforeMethed() {
System.out.println("这是在测试方法之前运行的");
}
//测试方法之后运行的
@AfterMethod
public void afterMethed() {
System.out.println("这是在测试方法之后运行的");
}
}


原文地址:https://www.cnblogs.com/xuzhongtao/p/9005671.html