基于 SELENIUM 的自動化測試架構(23)
發表于:2017-04-11來源:gitbook作者:凌俁Linty?點擊數:
標簽:selenium
@BeforeTest public void setUp () { this .baseDriver = new FirefoxDriver(); this .baseUrl = http://demo.ranzhi.org/ ; } /** * 測試清理操作 * 在所有的測試結束后 執行一次 */ @AfterTest
@BeforeTest
public void setUp() {
this.baseDriver =
new FirefoxDriver();
this.baseUrl =
"http://demo.ranzhi.org/";
}
/**
* 測試清理操作
* 在所有的測試結束后 執行一次
*/
@AfterTest
public void tearDown() {
this.baseDriver.quit();
}
}
unittest
接下來我們將會使用 Python 語言的unittest
框架展開“檢查”。unittest
框架的原本的名字是PyUnit。是從JUnit 這樣一個被廣泛使用的 經典的Java應用開發的單元測試框架創造而來。類似的框架還有NUnit(.Net開發的單元測試框架)等。我們可以使用unittest框架為任意Python項目編寫可理解的單元測試集合?,F在這個unittest已經作為Python的標準庫模塊發布。我們安裝完Python以后,便可以直接使用unittest。
原文轉自:http://gitbook.cn/books/58e54b57cfcd6fa52dcef1d2/index.html