Commit 92d0c3dd authored by Su-Yi's avatar Su-Yi

修改日志打印方式

parent d6d56c57
This diff is collapsed.
...@@ -39,8 +39,8 @@ public class Boss { ...@@ -39,8 +39,8 @@ public class Boss {
Response response = network.getResponse(BOSS_VERSIONINFO); Response response = network.getResponse(BOSS_VERSIONINFO);
int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion");//判断是否为保险版:1是通用版 2是保险版 int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion");//判断是否为保险版:1是通用版 2是保险版
boolean isVip = response.jsonPath().getBoolean("data.find {it.openType == 1}.vip");//判断是否为会员 boolean isVip = response.jsonPath().getBoolean("data.find {it.openType == 1}.vip");//判断是否为会员
Assert.assertEquals(userVersion, 2,network.message(BOSS_VERSIONINFO,"获取版本有误 此版本为非保险版")); Assert.assertEquals(userVersion, 2,network.message(BOSS_VERSIONINFO,"获取版本有误 此版本为非保险版",response.body().asString()));
Assert.assertTrue(isVip,network.message(BOSS_VERSIONINFO,"会员判断错误 为非会员")); Assert.assertTrue(isVip,network.message(BOSS_VERSIONINFO,"会员判断错误 为非会员",response.body().asString()));
} }
//获取info接口的代理人id //获取info接口的代理人id
...@@ -49,8 +49,8 @@ public class Boss { ...@@ -49,8 +49,8 @@ public class Boss {
Response response = network.getResponse(BOSS_USERINFO); Response response = network.getResponse(BOSS_USERINFO);
sellerId = response.jsonPath().getString("data.sellerId"); sellerId = response.jsonPath().getString("data.sellerId");
sellername = response.jsonPath().getString("data.sellerName"); sellername = response.jsonPath().getString("data.sellerName");
Assert.assertNotNull(sellerId,network.message(BOSS_USERINFO,"获取sellerid失败")); Assert.assertNotNull(sellerId,network.message(BOSS_USERINFO,"获取sellerid失败",response.body().asString()));
Assert.assertNotNull(sellername,network.message(BOSS_USERINFO,"获取sellerName失败")); Assert.assertNotNull(sellername,network.message(BOSS_USERINFO,"获取sellerName失败",response.body().asString()));
} }
//代理人有无上下级判断; //代理人有无上下级判断;
...@@ -61,8 +61,8 @@ public class Boss { ...@@ -61,8 +61,8 @@ public class Boss {
Response response = network.getResponse(params,BOSS_ROLE); Response response = network.getResponse(params,BOSS_ROLE);
boolean hasSubordinate = response.jsonPath().getBoolean("data.hasSubordinate");//判断是否有下级 boolean hasSubordinate = response.jsonPath().getBoolean("data.hasSubordinate");//判断是否有下级
boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");//判断是否有上级 boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");//判断是否有上级
Assert.assertFalse(hasSubordinate, network.message(params,BOSS_ROLE,"暂无下级")); Assert.assertFalse(hasSubordinate, network.message(params,BOSS_ROLE,"暂无下级",response.body().asString()));
Assert.assertFalse(hasSuperior,network.message(params,BOSS_ROLE,"暂无上级")); Assert.assertFalse(hasSuperior,network.message(params,BOSS_ROLE,"暂无上级",response.body().asString()));
} }
...@@ -73,7 +73,7 @@ public class Boss { ...@@ -73,7 +73,7 @@ public class Boss {
params.put("inviteType",2); params.put("inviteType",2);
Response response = network.getResponse(params,BOSS_CODE); Response response = network.getResponse(params,BOSS_CODE);
boolean invite = response.jsonPath().getBoolean("success"); boolean invite = response.jsonPath().getBoolean("success");
Assert.assertTrue(invite,network.message(params,BOSS_CODE,"分享链接失败")); Assert.assertTrue(invite,network.message(params,BOSS_CODE,"分享链接失败",response.body().asString()));
} }
...@@ -86,7 +86,7 @@ public class Boss { ...@@ -86,7 +86,7 @@ public class Boss {
params.put("sellerId",usellerId); params.put("sellerId",usellerId);
Response response = network.getResponse(params,BOSS_IDENTITY); Response response = network.getResponse(params,BOSS_IDENTITY);
int identity = response.jsonPath().getInt("data.identity"); //1团长、2成员、3没有团队 int identity = response.jsonPath().getInt("data.identity"); //1团长、2成员、3没有团队
Assert.assertEquals(identity, 3, network.message(params,BOSS_IDENTITY,"被邀请人已有团队或已绑定上级,不能再接受邀请")); Assert.assertEquals(identity, 3, network.message(params,BOSS_IDENTITY,"被邀请人已有团队或已绑定上级,不能再接受邀请",response.body().asString()));
} }
//获取info接口的代理人id //获取info接口的代理人id
...@@ -95,8 +95,8 @@ public class Boss { ...@@ -95,8 +95,8 @@ public class Boss {
Response response = network.getResponse(BOSS_USERINFO); Response response = network.getResponse(BOSS_USERINFO);
usellerId = response.jsonPath().getString("data.sellerId"); usellerId = response.jsonPath().getString("data.sellerId");
visitorame = response.jsonPath().getString("data.sellerName"); visitorame = response.jsonPath().getString("data.sellerName");
Assert.assertNotNull(usellerId,network.message(BOSS_USERINFO,"获取usellerid失败")); Assert.assertNotNull(usellerId,network.message(BOSS_USERINFO,"获取usellerid失败",response.body().asString()));
Assert.assertNotNull(visitorame,network.message(BOSS_USERINFO,"获取sellerName失败")); Assert.assertNotNull(visitorame,network.message(BOSS_USERINFO,"获取sellerName失败",response.body().asString()));
} }
//邀请结果判断 //邀请结果判断
...@@ -107,14 +107,14 @@ public class Boss { ...@@ -107,14 +107,14 @@ public class Boss {
params.put("inviteType",2); params.put("inviteType",2);
Response response = network.getResponse(params,BOSS_BOUND); Response response = network.getResponse(params,BOSS_BOUND);
boolean data = response.jsonPath().getBoolean("data"); //1 true:邀请成功;2 false:邀请失败 boolean data = response.jsonPath().getBoolean("data"); //1 true:邀请成功;2 false:邀请失败
Assert.assertTrue(data, network.message(params,BOSS_BOUND,"接受邀请失败")); Assert.assertTrue(data, network.message(params,BOSS_BOUND,"接受邀请失败",response.body().asString()));
//获取被邀请人上级昵称 //获取被邀请人上级昵称
Map<String, Object> inviteparams = new HashMap<String, Object>(); Map<String, Object> inviteparams = new HashMap<String, Object>();
params.put("sellerId",usellerId); params.put("sellerId",usellerId);
Response responses = network.getResponse(inviteparams,BOSS_BOSS); Response responses = network.getResponse(inviteparams,BOSS_BOSS);
String name = responses.jsonPath().getString("data"); String name = responses.jsonPath().getString("data");
Assert.assertEquals(name,visitorame,network.message(params,BOSS_BOSS,"昵称不匹配")); Assert.assertEquals(name,visitorame,network.message(params,BOSS_BOSS,"昵称不匹配",response.body().asString()));
} }
//重新获取列表,代理人有无上下级判断; //重新获取列表,代理人有无上下级判断;
...@@ -127,8 +127,8 @@ public class Boss { ...@@ -127,8 +127,8 @@ public class Boss {
Response response = network.getResponse(params,BOSS_ROLE); Response response = network.getResponse(params,BOSS_ROLE);
boolean hasSubordinate = response.jsonPath().getBoolean("data.hasSubordinate");//判断是否有下级 boolean hasSubordinate = response.jsonPath().getBoolean("data.hasSubordinate");//判断是否有下级
boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");//判断是否有上级 boolean hasSuperior = response.jsonPath().getBoolean("data.hasSuperior");//判断是否有上级
Assert.assertTrue(hasSubordinate, network.message(params,BOSS_ROLE,"暂无下级")); Assert.assertTrue(hasSubordinate, network.message(params,BOSS_ROLE,"暂无下级",response.body().asString()));
Assert.assertFalse(hasSuperior,network.message(params,BOSS_ROLE,"暂无上级")); Assert.assertFalse(hasSuperior,network.message(params,BOSS_ROLE,"暂无上级",response.body().asString()));
} }
...@@ -141,7 +141,7 @@ public class Boss { ...@@ -141,7 +141,7 @@ public class Boss {
Response response = network.getResponse(params,BOSS_BOSS); Response response = network.getResponse(params,BOSS_BOSS);
String data = response.jsonPath().getString("data"); String data = response.jsonPath().getString("data");
superiorname = response.jsonPath().getString("data"); superiorname = response.jsonPath().getString("data");
Assert.assertEquals(data,superiorname,network.message(params,BOSS_BOSS,"昵称不匹配")); Assert.assertEquals(data,superiorname,network.message(params,BOSS_BOSS,"昵称不匹配",response.body().asString()));
} }
//获取代理人团队人数 //获取代理人团队人数
...@@ -151,7 +151,7 @@ public class Boss { ...@@ -151,7 +151,7 @@ public class Boss {
params.put("sellerId",sellerId); params.put("sellerId",sellerId);
Response response = network.getResponse(params,BOSS_ROLE); Response response = network.getResponse(params,BOSS_ROLE);
boolean teamNumber = response.jsonPath().getBoolean("data.teamNumber");//获取团队人数包含自己 boolean teamNumber = response.jsonPath().getBoolean("data.teamNumber");//获取团队人数包含自己
Assert.assertNotNull(teamNumber,network.message(params,BOSS_ROLE,"获取团队人数失败")); Assert.assertNotNull(teamNumber,network.message(params,BOSS_ROLE,"获取团队人数失败",response.body().asString()));
} }
...@@ -160,7 +160,7 @@ public class Boss { ...@@ -160,7 +160,7 @@ public class Boss {
public void 获取成员sids() throws IOException{ public void 获取成员sids() throws IOException{
Response response = network.getResponse(BOSS_MEMBER); Response response = network.getResponse(BOSS_MEMBER);
sids = response.jsonPath().getString("data.list[0].sellerId"); sids = response.jsonPath().getString("data.list[0].sellerId");
Assert.assertNotNull(sids,network.message(BOSS_MEMBER,"获取sids失败")); Assert.assertNotNull(sids,network.message(BOSS_MEMBER,"获取sids失败",response.body().asString()));
} }
//移除团队成员 //移除团队成员
...@@ -172,7 +172,7 @@ public class Boss { ...@@ -172,7 +172,7 @@ public class Boss {
Response response = network.postResponse(params,BOSS_REMOVE); Response response = network.postResponse(params,BOSS_REMOVE);
System.out.println(response.getBody().prettyPrint()); System.out.println(response.getBody().prettyPrint());
boolean data = response.jsonPath().getBoolean("data"); //true:删除成功;false:删除失败 boolean data = response.jsonPath().getBoolean("data"); //true:删除成功;false:删除失败
Assert.assertEquals(data,true,network.message(params,BOSS_REMOVE, "移除失败")); Assert.assertEquals(data,true,network.message(params,BOSS_REMOVE, "移除失败",response.body().asString()));
} }
...@@ -184,7 +184,7 @@ public class Boss { ...@@ -184,7 +184,7 @@ public class Boss {
Response response = network.getResponse(params,BOSS_BOSS); Response response = network.getResponse(params,BOSS_BOSS);
String data = response.jsonPath().getString("data"); String data = response.jsonPath().getString("data");
superiorname = response.jsonPath().getString("data"); superiorname = response.jsonPath().getString("data");
Assert.assertEquals(data,superiorname,network.message(params,BOSS_BOSS,"昵称不匹配")); Assert.assertEquals(data,superiorname,network.message(params,BOSS_BOSS,"昵称不匹配",response.body().asString()));
} }
...@@ -196,7 +196,7 @@ public class Boss { ...@@ -196,7 +196,7 @@ public class Boss {
params.put("inviteType",2); params.put("inviteType",2);
Response response = network.getResponse(params,BOSS_CODE); Response response = network.getResponse(params,BOSS_CODE);
boolean invite = response.jsonPath().getBoolean("success"); boolean invite = response.jsonPath().getBoolean("success");
Assert.assertTrue(invite,network.message(params,BOSS_CODE,"分享链接失败")); Assert.assertTrue(invite,network.message(params,BOSS_CODE,"分享链接失败",response.body().asString()));
} }
......
...@@ -36,22 +36,18 @@ public class CircleFriends { ...@@ -36,22 +36,18 @@ public class CircleFriends {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
Response response = network.getResponse(FRIENDS_ISUSERFIRSTENTERANDCOLLECT); Response response = network.getResponse(FRIENDS_ISUSERFIRSTENTERANDCOLLECT);
String desc = response.jsonPath().getString("desc"); String desc = response.jsonPath().getString("desc");
Assert.assertEquals(desc,"OK",network.message(FRIENDS_ISUSERFIRSTENTERANDCOLLECT,"是否首次进入和首次收藏发圈素材列表-接口有误")); Assert.assertEquals(desc,"OK",network.message(FRIENDS_ISUSERFIRSTENTERANDCOLLECT,"是否首次进入和首次收藏发圈素材列表-接口有误",response.body().asString()));
} }
// tab列表 后端根据tku自行判断 // tab列表 后端根据tku自行判断
@Test(description="获取tab列表",priority = 2) @Test(description="获取tab列表",priority = 2)
public void 获取tab列表() throws IOException { public void 获取tab列表() throws IOException {
Response response = network.getResponse(FRIENDS_GETMATERIALTAGS); Response response = network.getResponse(FRIENDS_GETMATERIALTAGS);
System.out.println("======tab列表=====");
response.body().prettyPrint();
int tabCount = response.jsonPath().getInt("data.size()"); int tabCount = response.jsonPath().getInt("data.size()");
int id = response.jsonPath().getInt("data.find {it.name == '保险'}.id"); //标签tab int id = response.jsonPath().getInt("data.find {it.name == '保险'}.id"); //标签tab
firstTagId = response.jsonPath().getInt("data[0].id");//第一个标签的ID firstTagId = response.jsonPath().getInt("data[0].id");//第一个标签的ID
Assert.assertEquals(tabCount,6,network.message(FRIENDS_GETMATERIALTAGS,"获取tab数量有误")); Assert.assertEquals(tabCount,6,network.message(FRIENDS_GETMATERIALTAGS,"获取tab数量有误",response.body().asString()));
Assert.assertEquals(id,595,network.message(FRIENDS_GETMATERIALTAGS,"获取tab中不包含保险")); Assert.assertEquals(id,595,network.message(FRIENDS_GETMATERIALTAGS,"获取tab中不包含保险",response.body().asString()));
} }
@Test(description="获取推荐(未读)列表",priority = 3) @Test(description="获取推荐(未读)列表",priority = 3)
...@@ -59,14 +55,11 @@ public class CircleFriends { ...@@ -59,14 +55,11 @@ public class CircleFriends {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("firstTagId",firstTagId); params.put("firstTagId",firstTagId);
Response response = network.getResponse(params,FRIENDS_GETUNREADTIMELINSLIST); Response response = network.getResponse(params,FRIENDS_GETUNREADTIMELINSLIST);
System.out.println("======推荐列表====="+params);
response.body().prettyPrint();
int count = response.jsonPath().getInt("data.size()"); int count = response.jsonPath().getInt("data.size()");
contentId = response.jsonPath().getString("data[0].contentId"); //素材ID contentId = response.jsonPath().getString("data[0].contentId"); //素材ID
tagId = response.jsonPath().getString("data[0].materialTag"); //素材频道ID tagId = response.jsonPath().getString("data[0].materialTag"); //素材频道ID
tagName = response.jsonPath().getString("data[0].tagName"); //素材频道名称 tagName = response.jsonPath().getString("data[0].tagName"); //素材频道名称
Assert.assertEquals(count,30,network.message(params,FRIENDS_GETUNREADTIMELINSLIST,"获取推荐列表有误")); Assert.assertEquals(count,30,network.message(params,FRIENDS_GETUNREADTIMELINSLIST,"获取推荐列表有误",response.body().asString()));
} }
@Test(description="获取全部列表",priority = 4) @Test(description="获取全部列表",priority = 4)
...@@ -87,12 +80,8 @@ public class CircleFriends { ...@@ -87,12 +80,8 @@ public class CircleFriends {
params.put("contentId",contentId); params.put("contentId",contentId);
params.put("firstTagId",firstTagId); params.put("firstTagId",firstTagId);
Response response = network.postResponse(params,FRIENDS_ASYNCMARKTIMELINEREAD); Response response = network.postResponse(params,FRIENDS_ASYNCMARKTIMELINEREAD);
System.out.println("====标记为已读===="+params);
response.body().prettyPrint();
boolean data = response.jsonPath().getBoolean("data"); boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,network.message(params,FRIENDS_ASYNCMARKTIMELINEREAD,"标记已读-接口有误")); Assert.assertTrue(data,network.message(params,FRIENDS_ASYNCMARKTIMELINEREAD,"标记已读-接口有误",response.body().asString()));
//延迟2秒,存入ES //延迟2秒,存入ES
Thread.sleep(2000); Thread.sleep(2000);
...@@ -101,7 +90,7 @@ public class CircleFriends { ...@@ -101,7 +90,7 @@ public class CircleFriends {
response = network.getResponse(params,FRIENDS_GETUNREADTIMELINSLIST); response = network.getResponse(params,FRIENDS_GETUNREADTIMELINSLIST);
List<String> contentList = response.jsonPath().getList("data.contentId"); List<String> contentList = response.jsonPath().getList("data.contentId");
boolean unRead = contentList.contains(contentId); //检查是否未读,false为已读,true为未读 boolean unRead = contentList.contains(contentId); //检查是否未读,false为已读,true为未读
Assert.assertFalse(unRead,network.message(params,FRIENDS_GETUNREADTIMELINSLIST,"已读后,未读接口没有过滤已读素材")); Assert.assertFalse(unRead,network.message(params,FRIENDS_GETUNREADTIMELINSLIST,"已读后,未读接口没有过滤已读素材",response.body().asString()));
} }
@Test(description="收藏素材",priority = 6) @Test(description="收藏素材",priority = 6)
...@@ -111,23 +100,20 @@ public class CircleFriends { ...@@ -111,23 +100,20 @@ public class CircleFriends {
params.put("contentId",contentId); params.put("contentId",contentId);
params.put("operate",1); params.put("operate",1);
Response response = network.getResponse(params,FRIENDS_ADDORCANCELCOLLECT); Response response = network.getResponse(params,FRIENDS_ADDORCANCELCOLLECT);
System.out.println("====收藏素材===="+params);
response.body().prettyPrint();
boolean isAdd = response.jsonPath().getBoolean("data"); boolean isAdd = response.jsonPath().getBoolean("data");
Assert.assertTrue(isAdd,network.message(params,FRIENDS_ADDORCANCELCOLLECT,"收藏素材失败")); Assert.assertTrue(isAdd,network.message(params,FRIENDS_ADDORCANCELCOLLECT,"收藏素材失败",response.body().asString()));
// 查看收藏列表 // 查看收藏列表
params.put("pageSize",12); params.put("pageSize",12);
response = network.getResponse(params,FRIENDS_QUERYLISTFORCOLLECT); response = network.getResponse(params,FRIENDS_QUERYLISTFORCOLLECT);
String collectContentId = response.jsonPath().getString("data[0].contentId"); String collectContentId = response.jsonPath().getString("data[0].contentId");
Assert.assertEquals(collectContentId,contentId,network.message(params,FRIENDS_QUERYLISTFORCOLLECT,"收藏列表有误")); Assert.assertEquals(collectContentId,contentId,network.message(params,FRIENDS_QUERYLISTFORCOLLECT,"收藏列表有误",response.body().asString()));
// 取消收藏 // 取消收藏
params.put("operate",2); params.put("operate",2);
response = network.getResponse(params,FRIENDS_ADDORCANCELCOLLECT); response = network.getResponse(params,FRIENDS_ADDORCANCELCOLLECT);
boolean isCancel = response.jsonPath().getBoolean("data"); boolean isCancel = response.jsonPath().getBoolean("data");
Assert.assertTrue(isCancel,network.message(params,FRIENDS_ADDORCANCELCOLLECT,"取消收藏素材失败")); Assert.assertTrue(isCancel,network.message(params,FRIENDS_ADDORCANCELCOLLECT,"取消收藏素材失败",response.body().asString()));
} }
@Test(description="素材频道页",priority = 7) @Test(description="素材频道页",priority = 7)
...@@ -136,11 +122,8 @@ public class CircleFriends { ...@@ -136,11 +122,8 @@ public class CircleFriends {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("tagId",tagId); params.put("tagId",tagId);
Response response = network.getResponse(params,FRIENDS_CHANNELDETAIL); Response response = network.getResponse(params,FRIENDS_CHANNELDETAIL);
System.out.println("====频道页===="+params);
response.body().prettyPrint();
String name = response.jsonPath().getString("data.tagName"); String name = response.jsonPath().getString("data.tagName");
Assert.assertEquals(name,tagName,network.message(params,FRIENDS_CHANNELDETAIL,"素材频道页-头部获取有误")); Assert.assertEquals(name,tagName,network.message(params,FRIENDS_CHANNELDETAIL,"素材频道页-头部获取有误",response.body().asString()));
//频道页 列表 //频道页 列表
params.put("pageSize",10); params.put("pageSize",10);
...@@ -148,8 +131,8 @@ public class CircleFriends { ...@@ -148,8 +131,8 @@ public class CircleFriends {
response = network.getResponse(params,FRIENDS_GETCHANNELLIST); response = network.getResponse(params,FRIENDS_GETCHANNELLIST);
String collectTagtId = response.jsonPath().getString("data[0].materialTag"); //素材ID String collectTagtId = response.jsonPath().getString("data[0].materialTag"); //素材ID
boolean hasList = response.jsonPath().getInt("data.size()") > 0; boolean hasList = response.jsonPath().getInt("data.size()") > 0;
Assert.assertEquals(collectTagtId,tagId,network.message(params,FRIENDS_GETCHANNELLIST, "素材列表获取有误")); Assert.assertEquals(collectTagtId,tagId,network.message(params,FRIENDS_GETCHANNELLIST, "素材列表获取有误",response.body().asString()));
Assert.assertTrue(hasList,network.message(params,FRIENDS_GETCHANNELLIST,"素材频道列表-获取有误")); Assert.assertTrue(hasList,network.message(params,FRIENDS_GETCHANNELLIST,"素材频道列表-获取有误",response.body().asString()));
} }
@Test(description="从首页发圈列表页进入",priority = 8) @Test(description="从首页发圈列表页进入",priority = 8)
...@@ -157,7 +140,7 @@ public class CircleFriends { ...@@ -157,7 +140,7 @@ public class CircleFriends {
// 获取首页发圈素材列表 // 获取首页发圈素材列表
Response response = network.getResponse(HOME_GETHOMETIMELINECONTENT); Response response = network.getResponse(HOME_GETHOMETIMELINECONTENT);
String currentId = response.jsonPath().getString("data.materialVos[0].contentId"); String currentId = response.jsonPath().getString("data.materialVos[0].contentId");
Assert.assertNotNull(currentId,network.message(HOME_GETHOMETIMELINECONTENT,"获取首页发圈列表有误")); Assert.assertNotNull(currentId,network.message(HOME_GETHOMETIMELINECONTENT,"获取首页发圈列表有误",response.body().asString()));
// 如果有推荐列表,进入发圈 // 如果有推荐列表,进入发圈
if (currentId.length() > 0){ if (currentId.length() > 0){
...@@ -165,7 +148,7 @@ public class CircleFriends { ...@@ -165,7 +148,7 @@ public class CircleFriends {
params.put("currentId",currentId); params.put("currentId",currentId);
response = network.getResponse(params,FRIENDS_GETCURRENTINFO); response = network.getResponse(params,FRIENDS_GETCURRENTINFO);
String topContentId = response.jsonPath().getString("data.contentId"); String topContentId = response.jsonPath().getString("data.contentId");
Assert.assertEquals(topContentId,currentId,network.message(params,FRIENDS_GETCURRENTINFO,"从首页进入发圈的头部素材有误")); Assert.assertEquals(topContentId,currentId,network.message(params,FRIENDS_GETCURRENTINFO,"从首页进入发圈的头部素材有误",response.body().asString()));
} }
} }
......
...@@ -33,7 +33,7 @@ public class GreetingCard { ...@@ -33,7 +33,7 @@ public class GreetingCard {
public void BANNER() throws IOException { public void BANNER() throws IOException {
Response response = network.getResponse(GREETING_BANNER); Response response = network.getResponse(GREETING_BANNER);
boolean hasList = response.jsonPath().getInt("data.size()") > 0; boolean hasList = response.jsonPath().getInt("data.size()") > 0;
Assert.assertTrue(hasList,network.message(GREETING_BANNER,"获取Banner列表失败")); Assert.assertTrue(hasList,network.message(GREETING_BANNER,"获取Banner列表失败",response.body().asString()));
} }
// 转发最多 // 转发最多
...@@ -41,7 +41,7 @@ public class GreetingCard { ...@@ -41,7 +41,7 @@ public class GreetingCard {
public void 大家都在发() throws IOException { public void 大家都在发() throws IOException {
Response response = network.getResponse(GREETING_ALLFORWARD); Response response = network.getResponse(GREETING_ALLFORWARD);
boolean hasList = response.jsonPath().getInt("data.size()") > 0; boolean hasList = response.jsonPath().getInt("data.size()") > 0;
Assert.assertTrue(hasList,network.message(GREETING_ALLFORWARD,"获取大家都在发列表失败")); Assert.assertTrue(hasList,network.message(GREETING_ALLFORWARD,"获取大家都在发列表失败",response.body().asString()));
} }
// 贺卡tab // 贺卡tab
...@@ -53,7 +53,7 @@ public class GreetingCard { ...@@ -53,7 +53,7 @@ public class GreetingCard {
Response response = network.getResponse(params,GREETING_FINDBYTYPE); Response response = network.getResponse(params,GREETING_FINDBYTYPE);
int totalCount = response.jsonPath().getInt("data.list.size()"); int totalCount = response.jsonPath().getInt("data.list.size()");
tagId = response.jsonPath().getInt("data.list[-1].id"); tagId = response.jsonPath().getInt("data.list[-1].id");
Assert.assertEquals(totalCount,3,network.message(params,GREETING_FINDBYTYPE,"获取贺卡tab失败")); Assert.assertEquals(totalCount,3,network.message(params,GREETING_FINDBYTYPE,"获取贺卡tab失败",response.body().asString()));
} }
// 获取539的贺卡列表 // 获取539的贺卡列表
...@@ -68,7 +68,7 @@ public class GreetingCard { ...@@ -68,7 +68,7 @@ public class GreetingCard {
boolean hasList = response.jsonPath().getInt("data.list.size()") > 0; boolean hasList = response.jsonPath().getInt("data.list.size()") > 0;
contentId = response.jsonPath().getString("data.list[0].id"); contentId = response.jsonPath().getString("data.list[0].id");
greetingName = response.jsonPath().getString("data.list[0].title"); greetingName = response.jsonPath().getString("data.list[0].title");
Assert.assertTrue(hasList,network.message(params,GREETING_PAGELIST,"获取贺卡tab失败")); Assert.assertTrue(hasList,network.message(params,GREETING_PAGELIST,"获取贺卡tab失败",response.body().asString()));
} }
// 贺卡详情页 // 贺卡详情页
...@@ -85,7 +85,7 @@ public class GreetingCard { ...@@ -85,7 +85,7 @@ public class GreetingCard {
infoParams.put("scid",scid); infoParams.put("scid",scid);
response = network.getResponse(infoParams,GREETING_H5INFO); response = network.getResponse(infoParams,GREETING_H5INFO);
String name = response.jsonPath().getString("data.title"); String name = response.jsonPath().getString("data.title");
Assert.assertEquals(name,greetingName, network.message(infoParams,GREETING_H5INFO,"获取贺卡信息失败")); Assert.assertEquals(name,greetingName, network.message(infoParams,GREETING_H5INFO,"获取贺卡信息失败",response.body().asString()));
} }
// 获取H5分享信息 // 获取H5分享信息
...@@ -102,7 +102,7 @@ public class GreetingCard { ...@@ -102,7 +102,7 @@ public class GreetingCard {
response = network.getResponse(shareParams,GREETING_H5SHARE); response = network.getResponse(shareParams,GREETING_H5SHARE);
shareId = response.jsonPath().getString("data.id"); shareId = response.jsonPath().getString("data.id");
String title = response.jsonPath().getString("data.title"); String title = response.jsonPath().getString("data.title");
Assert.assertEquals(title,greetingName,network.message(shareParams,GREETING_H5SHARE,"获取H5分享信息失败")); Assert.assertEquals(title,greetingName,network.message(shareParams,GREETING_H5SHARE,"获取H5分享信息失败",response.body().asString()));
} }
// 我送出的贺卡列表 // 我送出的贺卡列表
...@@ -113,7 +113,7 @@ public class GreetingCard { ...@@ -113,7 +113,7 @@ public class GreetingCard {
params.put("pageSize", 10); params.put("pageSize", 10);
Response response = network.getResponse(params,GREETING_CONFLIST); Response response = network.getResponse(params,GREETING_CONFLIST);
boolean hasList = response.jsonPath().getInt("data.list.size()") > 0; boolean hasList = response.jsonPath().getInt("data.list.size()") > 0;
Assert.assertFalse(hasList,network.message(params,GREETING_CONFLIST,"获取我的贺卡初始列表数量有误")); Assert.assertFalse(hasList,network.message(params,GREETING_CONFLIST,"获取我的贺卡初始列表数量有误",response.body().asString()));
} }
......
This diff is collapsed.
...@@ -31,27 +31,27 @@ public class Pay { ...@@ -31,27 +31,27 @@ public class Pay {
@Test (description = "默认付费_付费页",priority = 1) //priorty 方法执行优先级 @Test (description = "默认付费_付费页",priority = 1) //priorty 方法执行优先级
public void 默认付费_付费页() throws IOException { public void 默认付费_付费页() throws IOException {
//付款中间页判断 //付款中间页判断
Response skipTypeResponse = network.getResponse(PAY_GETMIDDLEDETAIL); Response response = network.getResponse(PAY_GETMIDDLEDETAIL);
int skipType = skipTypeResponse.jsonPath().getInt("data.skipType"); int skipType = response.jsonPath().getInt("data.skipType");
Assert.assertEquals(skipType,2,network.message(PAY_GETMIDDLEDETAIL,"付款中间页:不是2020新版")); Assert.assertEquals(skipType,2,network.message(PAY_GETMIDDLEDETAIL,"付款中间页:不是2020新版",response.body().asString()));
//会销资格判断 //会销资格判断
Response SiteSaleValidresponse = network.getResponse(PAY_HASSITESALEVALID); response = network.getResponse(PAY_HASSITESALEVALID);
boolean siteSaleValid = SiteSaleValidresponse.jsonPath().getBoolean("data"); boolean siteSaleValid = response.jsonPath().getBoolean("data");
Assert.assertEquals(siteSaleValid,false,network.message(PAY_HASSITESALEVALID,"会销资格判断:判断错误,有会销资格")); Assert.assertEquals(siteSaleValid,false,network.message(PAY_HASSITESALEVALID,"会销资格判断:判断错误,有会销资格",response.body().asString()));
//会员类型版本判断 //会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("t",System.currentTimeMillis()); params.put("t",System.currentTimeMillis());
Response userVersionResponse = network.getResponse(params, VERSION_INFO); response = network.getResponse(params, VERSION_INFO);
int userVersion = userVersionResponse.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型 1为通用版 2为保险版 int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型 1为通用版 2为保险版
Assert.assertEquals(userVersion,2,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为通用版")); Assert.assertEquals(userVersion,2,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为通用版",response.body().asString()));
//获取当前用户可用优惠码 //获取当前用户可用优惠码
Response promoCodeResponse = network.getResponse(params,PAY_GETPROMOCODE); response = network.getResponse(params,PAY_GETPROMOCODE);
String promoCode = promoCodeResponse.jsonPath().getString("data"); String promoCode = response.jsonPath().getString("data");
Assert.assertEquals(promoCode,null, network.message(params,PAY_GETPROMOCODE,"是否优惠判断:判断错误,当前有优惠")); Assert.assertEquals(promoCode,null, network.message(params,PAY_GETPROMOCODE,"是否优惠判断:判断错误,当前有优惠",response.body().asString()));
//获取付费价格 //获取付费价格
// Response actualPayMoneyResponse = network.getResponse(PAY_COMBOLIST); // Response actualPayMoneyResponse = network.getResponse(PAY_COMBOLIST);
...@@ -69,10 +69,9 @@ public class Pay { ...@@ -69,10 +69,9 @@ public class Pay {
payParams.put("paySource","2"); payParams.put("paySource","2");
payParams.put("sellerFrom",""); payParams.put("sellerFrom","");
Response orderAppId = network.postResponse(payParams,PAY_ORDERCREATE); Response response = network.postResponse(payParams,PAY_ORDERCREATE);
String appId = orderAppId.jsonPath().getString("data.appId"); String appId = response.jsonPath().getString("data.appId");
Assert.assertEquals(appId,"wxcb8c36279dd7dff2",network.message(payParams, PAY_ORDERCREATE,"拉起支付:拉起微信支付失败")); //判断返回的微信调起参数中appId是否正确 Assert.assertEquals(appId,"wxcb8c36279dd7dff2",network.message(payParams, PAY_ORDERCREATE,"拉起支付:拉起微信支付失败",response.body().asString())); //判断返回的微信调起参数中appId是否正确
orderAppId.body().prettyPrint();
} }
@Test (description = "默认付费_取消支付",priority = 3) @Test (description = "默认付费_取消支付",priority = 3)
...@@ -84,15 +83,15 @@ public class Pay { ...@@ -84,15 +83,15 @@ public class Pay {
payParams.put("oaId","1"); payParams.put("oaId","1");
payParams.put("paySource","2"); payParams.put("paySource","2");
payParams.put("sellerFrom",""); payParams.put("sellerFrom","");
Response orderAppId = network.postResponse(payParams,PAY_ORDERCREATE); Response response = network.postResponse(payParams,PAY_ORDERCREATE);
String tradeNo = orderAppId.jsonPath().getString("data.tradeNo"); String tradeNo = response.jsonPath().getString("data.tradeNo");
//会员类型版本判断 //会员类型版本判断
Map<String, Object> cancelParams = new HashMap<String, Object>(); Map<String, Object> cancelParams = new HashMap<String, Object>();
cancelParams.put("tradeNo",tradeNo); cancelParams.put("tradeNo",tradeNo);
Response resultResponse = network.getResponse(cancelParams,PAY_ORDERCANCEL); response = network.getResponse(cancelParams,PAY_ORDERCANCEL);
String result = resultResponse.jsonPath().getString("desc"); String result = response.jsonPath().getString("desc");
Assert.assertEquals(result,"OK",network.message(cancelParams, PAY_ORDERCANCEL,"取消支付:取消支付失败")); //判断返回的微信调起参数中appId是否正确 Assert.assertEquals(result,"OK",network.message(cancelParams, PAY_ORDERCANCEL,"取消支付:取消支付失败",response.body().asString())); //判断返回的微信调起参数中appId是否正确
} }
// @Test (description = "默认付费_成功支付",priority = 4) // @Test (description = "默认付费_成功支付",priority = 4)
...@@ -105,23 +104,23 @@ public class Pay { ...@@ -105,23 +104,23 @@ public class Pay {
//会员类型版本判断 //会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("t",System.currentTimeMillis()); params.put("t",System.currentTimeMillis());
Response userVersionResponse = network.getResponse(params,VERSION_INFO); Response response = network.getResponse(params,VERSION_INFO);
int userVersion = userVersionResponse.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型 int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型
int changeVersion = userVersion == 1 ? 2 : 1; // 判断当前开启的版本,如果当前版本是1,则改为2,反之; int changeVersion = userVersion == 1 ? 2 : 1; // 判断当前开启的版本,如果当前版本是1,则改为2,反之;
//切换版本 //切换版本
Map<String, Object> versionParams = new HashMap<String, Object>(); Map<String, Object> versionParams = new HashMap<String, Object>();
versionParams.put("targetVersion",changeVersion); versionParams.put("targetVersion",changeVersion);
Response resultResponse = network.postResponse(versionParams,PAY_VERSIONEXCHANGE); response = network.postResponse(versionParams,PAY_VERSIONEXCHANGE);
String result = resultResponse.jsonPath().getString("desc"); String result = response.jsonPath().getString("desc");
Assert.assertEquals(result,"OK",network.message(versionParams,PAY_VERSIONEXCHANGE,"会员类型切换:切换失败")); //判断返回的微信调起参数中appId是否正确 Assert.assertEquals(result,"OK",network.message(versionParams,PAY_VERSIONEXCHANGE,"会员类型切换:切换失败",response.body().asString())); //判断返回的微信调起参数中appId是否正确
//会员类型再次判断 //会员类型再次判断
params.put("t",System.currentTimeMillis()); params.put("t",System.currentTimeMillis());
userVersionResponse = network.getResponse(params,VERSION_INFO); response = network.getResponse(params,VERSION_INFO);
userVersion = userVersionResponse.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型 userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型
Assert.assertEquals(userVersion,changeVersion,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为尊享版")); Assert.assertEquals(userVersion,changeVersion,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为尊享版",response.body().asString()));
} }
/*// 支付成功回调 /*// 支付成功回调
......
This diff is collapsed.
...@@ -6,7 +6,7 @@ public class BasicConfig { ...@@ -6,7 +6,7 @@ public class BasicConfig {
// *************** 配置信息,每次重新配置以下信息就ok *************** // *************** 配置信息,每次重新配置以下信息就ok ***************
// 是否推送 // 是否推送
public static final boolean isPushReport = true; //true public static final boolean isPushReport = false; //true
// 用户微信昵称 // 用户微信昵称
public static final String WECHAT_NAME = "小疙瘩人寿"; //true public static final String WECHAT_NAME = "小疙瘩人寿"; //true
// 用户tku // 用户tku
......
...@@ -125,16 +125,18 @@ public class NetworkUtil { ...@@ -125,16 +125,18 @@ public class NetworkUtil {
} }
//带参的接口信息 //带参的接口信息
public String message(Map<String, Object> params, String path, String errorMessage){ public String message(Map<String, Object> params, String path, String errorMessage, String responseBody){
return "\n" + "path: " + path + return "\n" + "path: " + path +
"\n" + "params: " + params + "\n" + "params: " + params +
"\n" + "message: " + errorMessage; "\n" + "message: " + errorMessage +
"\n" + "response:" + responseBody;
} }
//不带参的接口信息 //不带参的接口信息
public String message(String path, String errorMessage){ public String message(String path, String errorMessage, String responseBody){
return "\n" + "path: " + path + return "\n" + "path: " + path +
"\n" + "message: " + errorMessage; "\n" + "message: " + errorMessage +
"\n" + "response:" + responseBody;
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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