Commit f12851d3 authored by panyuli's avatar panyuli

核销二期代码

parent bb0a2b6e
......@@ -53,7 +53,7 @@ public class 权益二期线上用户核销匹配权益及兑换码兑换_DuibaT
logger.info("权益类表数据返回正确 -结束了");
}
//@Test
@Test
//(invocationCount=5)一个组件下面多少个权益数据
public void 权益列表首页接口返回正确() throws Exception {
......@@ -64,28 +64,12 @@ public class 权益二期线上用户核销匹配权益及兑换码兑换_DuibaT
Response response = equityPrizeService.chwvisualeditorfindEquityListByIds(authorization.dafuwengLogin(uid),list);
response.prettyPrint();
String code = response.jsonPath().getString("code");
/* Assert.assertEquals(code,"0000000000","权益类表数据返回正确接口 失败,code:"+code );
String data= JSON.parseObject(response.asString()).getString("data");
JSONArray jsonArray = JSON.parseArray(data);
List<String> list1 = new ArrayList();*/
List<Integer> ids = response.jsonPath().getList("data.id");
Assert.assertTrue(response.jsonPath().getBoolean("success"),"接口返回失败");
// Assert.assertEquals(code,"0000000000","权益类表数据返回正确接口 失败,code:"+code );
Assert.assertEquals(ids.size(), list.size(),"数据条数不匹配");
/* for (Object jsonobject:
jsonArray) {
String s = jsonobject.toString();
JSONObject js = JSON.parseObject(s);
String appitem = js.getString("appItemId");
list.add(appitem);
}*/
/* //数组长度的校验 长度判断
Assert.assertEquals(list.size()+"","2","接口数据返回listsize()数值 不一致,size:"+list.size() );
String appItemId= list.get(0);
logger.info("list.get(0) appItemId:"+appItemId+"list.get(1) appItemId1:"+ list.get(1));
Assert.assertEquals(appItemId,"199281","接口获取商品的1id 不一致,code:"+appItemId );
String appItemId1= list.get(1);
Assert.assertEquals(appItemId1,"199282","接口获取商品的2id 不一致,code:"+appItemId1 );*/
logger.info("权益类表数据返回正确 -结束了");
logger.info("权益列表首页接口返回正确 -结束了");
}
@Test
......
package http.service.Activity;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.service.Authorization;
import io.restassured.http.Cookies;
import io.restassured.response.Response;
......@@ -9,9 +11,7 @@ import org.springframework.stereotype.Service;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import static base.Postman.logger;
import static io.restassured.RestAssured.given;
......@@ -136,12 +136,13 @@ public Response gawequityPrizeexchange( Map cookies,String excCode,String app
*
* */
public Response chwvisualeditorfindEquityListByIds(Map cookies, ArrayList array) throws Exception {
Map<String , ArrayList> map = new HashMap<>();
public Response chwvisualeditorfindEquityListByIds(Map cookies, List<Integer> array) throws Exception {
// JSONObject json = new JSONObject();
// json.put("equityIds", array);
Map<String, List<Integer>> map = new HashMap<>();
map.put("equityIds", array);
// Response response = given().contentType("application/json;charset=UTF-8").cookies(cookies).params(map).get("http://" + url);
Response response = given().contentType("application/json;charset=UTF-8").cookies(cookies).params(map).post(activityHost + "/chw/visual-editor/findEquityListByIds");
Response response = given().contentType("application/json;charset=UTF-8").cookies(cookies).body(map).post(activityHost + "/chw/visual-editor/findEquityListByIds");
//Response response = given().contentType("application/json;charset=UTF-8").body("{\"equityIds\":[25,24]}").cookies(cookies).post(activityHost + "/chw/visual-editor/findEquityListByIds");
try {
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", " /chw/visual-editor/findEquityListByIds接口失败");
} catch (Exception e) {
......
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