注解实战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("这是在测试方法之后运行的");
}
}

 


posted @ 2018-05-07 23:15  taotao12  阅读(505)  评论(0编辑  收藏  举报