首页>代码>java企业考勤系统>/clocksimplejee4/intergrationtest/com/dovesoftware/clocksimplejee3/intergrationtest/LoginTest.java
package com.dovesoftware.clocksimplejee3.intergrationtest;
import junit.framework.Assert;
import junit.framework.TestCase;
import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.SubmitButton;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebForm;
import com.meterware.httpunit.WebLink;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
public class LoginTest extends TestCase {
public void testLogin() {
try {
long now = System.currentTimeMillis();
for (int i = 0; i < 100; i++){
WebConversation wc2 = new WebConversation();
//获取响应对象
WebResponse resp = wc2.getResponse( "http://localhost:8080/ClockSimpleJEE3/login/index.jsp" );
//获得对应的表单对象
WebForm webForm = resp.getForms()[0];
SubmitButton submitButton1 = webForm.getSubmitButton("login");
WebRequest req1 = webForm.getRequest();
webForm.setParameter("empid","160208");
webForm.setParameter("password","jerry");
resp = webForm.submit(submitButton1);
//用getText方法获取相应的全部内容
//用System.out.println将获取的内容打印在控制台上
Assert.assertTrue(resp.getText().contains("Welcome to the Clock Online System."));
}
long now2 = System.currentTimeMillis();
System.out.println("In miliseconds:"+ (now2-now));
// throw new Exception();
} catch (Exception e) {
System.err.println("Exception: " + e);
Assert.assertTrue("Test failed.", false);
}
}
}
最近下载更多
891087053 LV1
5月17日
balabalawuyu LV6
2022年11月17日
hu10086 LV1
2022年5月21日
xaiozhu LV7
2022年4月10日
liugtnb LV2
2022年3月24日
1819615780 LV1
2021年12月25日
kk1031 LV8
2021年9月6日
LYS_myheart LV2
2021年7月24日
monkalon LV14
2021年7月10日
weijiajun LV1
2021年6月29日
最近浏览更多
wz LV3
9月19日
891087053 LV1
5月17日
微信网友_7513981386297344
5月17日
暂无贡献等级
微信网友_7467320429481984
4月14日
暂无贡献等级
叉烧君 LV3
3月26日
嘲讽脸 LV5
1月15日
xianyu091012 LV5
2024年12月26日
xiquyiyuan LV10
2024年12月3日
gxh666857 LV1
2024年11月27日
黄志琴 LV1
2024年9月29日

