標籤:public accept lips set imp sof software name 單擊
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測試結束都調用+瀏覽器關閉");
}
}
Selenium-java-TestNg-的運行