Commit eb1da9fa authored by 马博's avatar 马博

test

parent 8399d051
...@@ -152,7 +152,10 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase { ...@@ -152,7 +152,10 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
//获取未登录场景cookie //获取未登录场景cookie
Response responses = authorization.autoLogin(); Response responses = authorization.autoLogin();
//进行接口测试传参 //进行接口测试传参
Response response = newActivityService.doJoin(responses.getDetailedCookies(),data.get("token"),data.get("activityId")); Map<String,String> map = responses.getCookies();
logger.info("cookies:"+map.toString());
Response response = newActivityService.doJoinMap(map,data.get("token"),data.get("activityId"));
// Response response = newActivityService.doJoin(responses.getDetailedCookies(),data.get("token"),data.get("activityId"));
response.prettyPrint(); response.prettyPrint();
String success = String.valueOf(response.jsonPath().getString("success")); String success = String.valueOf(response.jsonPath().getString("success"));
//根据case选择校验项 //根据case选择校验项
......
...@@ -80,6 +80,25 @@ public class NewActivityService { ...@@ -80,6 +80,25 @@ public class NewActivityService {
} }
return response; return response;
} }
public Response doJoinMap(Map cookies, String token,String activityId) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("token",token);
map.put("activityId",activityId);
map.put("oaId",activityId);
logger.info("请求/hdtool/doJoin接口,activityId="+activityId);
logger.info("url:"+url+"/hdtool/doJoin");
Response response = given().cookies(cookies).params(map).post(url+"/hdtool/doJoin");
try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200");
logger.info("/hdtool/doJoin接口成功,返回信息:"+response.asString());
}catch(Exception e){
throw new Exception("/hdtool/doJoin接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/hdtool/doJoin接口失败,返回信息:"+response.asString());
}
return response;
}
public Response doJoin2( String activityId,String token) throws Exception{ public Response doJoin2( String activityId,String token) throws Exception{
Map<String,String> map = new HashMap<>(); Map<String,String> map = new HashMap<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment