스 크 립 트 를 녹음 할 수 없 는 업무 압축 테스트
public class UserController extends Controller{
/**
* , http://localhost:8000/user/login
*/
public void login() {
Map map = new HashMap();
String name = this.getPara("name");//
String password = this.getPara("password");//
String code = this.getPara("code"); //
if(this.getSessionAttr("code").equals(code)){
if(User.login(name, password) == true){
map.put("msg", " ");
}
else{
map.put("msg", " ");
}
}
else{
map.put("msg", " ");
}
this.renderJson(JSONValue.toJSONString(map));
}
}
테스트 인원 이 강하 지 않 은 경우 (녹화 할 수 없고 강력 한 식별 인증 코드 스 크 립 트 를 손 으로 작성 할 능력 도 없 음) 서버 측 에 압력 측정 방법 을 추가 하여 jmeter 를 사용 하여 압력 테스트 를 편리 하 게 할 수 있 습 니 다.
/**
* : ,
* jmeter http://localhost:8000/user/testLogin1
*/
public void testLogin1(){
Random rand = new Random();
String[][] user = {{"user1", "psw1"}, {"user2", "psw2"}};
String[] u = user[rand.nextInt(10) / user.length];
Map map = new HashMap();
String name = u[0];//
String password = u[1];//
String code = this.getSessionAttr("code"); //
if(this.getSessionAttr("code").equals(code)){
if(User.login(name, password) == true){
map.put("msg", " ");
}
else{
map.put("msg", " ");
}
}
else{
map.put("msg", " ");
}
this.renderJson(JSONValue.toJSONString(map));
}
/**
* : HTTP
* jmeter http://localhost:8000/user/testLogin2
*/
public void testLogin2(){
Random rand = new Random();
String[][] user = {{"user1", "psw1"}, {"user2", "psw2"}};
String[] u = user[rand.nextInt(10) / user.length];
String code = "test";
String body = "";
try{
Document doc = Jsoup.connect("http://localhost:8000/user/login")
.data("name", u[0]).data("password", u[1]).data("code", code)
.ignoreContentType(true).post();
body = doc.body().text();
System.out.println(body);
}
catch(Exception e){
e.printStackTrace();
}
this.renderText(body);
}
복잡 한 업무, jmeter 나 loadrunner 도 스 크 립 트 를 녹음 하거나 복잡 한 스 크 립 트 를 작성 하지 않 아 도 스트레스 테스트 를 할 수 있 습 니 다. 다만 서버 개발 자 는 테스트 코드 를 하나 더 써 야 합 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.