package com.day.www;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/*
* 使用Testng之前需加载插件。方法如下:
* 启动Eclipse,选择“Install New Software”
* 单击“Add”Name:TestNG、
* location:http://beust.com/eclipse
* 填写完毕,然后点击“OK”
* 选择“Select All”和“TestNG”,点击“Next”继续
* 勾选“Accept the License Agreement”,然后单击“Finish”
* 后面一直同意就可以了
* 安装完成才能运行使用
*/
public class day_test {
@BeforeClass
public void befo(){
System.out.println("Befor运行测试都调用 +做浏览器初始化 ");
}
@BeforeMethod
public void setup(){
System.out.println("BeforeMethod+每次运行测试都调用 ");
}
@Test
public void test1() {
System.out.println("测试用例1");
}
@Test
public void test2() {
System.out.println("测试用例2");
}
@AfterMethod
public void teardo(){
System.out.println("AfterMethod+每次运行测试结束都调用");
}
@AfterClass
public void afte(){
System.out.println("Afte测试结束都调用+浏览器关闭");
}
}