軟件測試案例——HttpUnit-測試用例
(1)環境設置:導入 HttpUnit (2)開始實踐,寫一個 軟件測試 接口,起名為LoginTestInf: 請/* * Created on 2004-12-17 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ pac
(1)環境設置:導入
HttpUnit (2)開始實踐,寫一個
軟件測試接口,起名為LoginTestInf:
請/*
* Created on 2004-12-17
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.apollo.test.util;
/**
* @author SixSun
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
*
測試用例編號 : 0001
*測試用例名稱 : HttpUnit 登陸驗證測試用例
*測試目標 : 驗證用戶登陸是否成功
*
測試過程 :
*1、輸入登陸地址的頁面地址,驗證該頁面是否可被正常訪問。
*2、驗證被訪問的頁面是否是登陸頁面。
*3、輸入非法用戶名、密碼,驗證登陸失敗。
*4、輸入合法用戶名、密碼,驗證登陸成功。
*/
public interface LoginTestInf {
public void testValidPage() throws Exception;
public void testIsLoginPage() throws Exception;
public void testBadLogin() throws Exception;
public void testGoodLogin() throws Exception;
}
(3)實現一個
Junit TestCase 同時 implements LoginTestInf 接口:
/*
* Created on 2004-12-17
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.apollo.test.util;
import
java.net.URL;
import
junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
原文轉自:http://www.anti-gravitydesign.com