Commit d93f4990 authored by Su-Yi's avatar Su-Yi

新增常量类、首页case

parent 7e774f54
package com.kjj.qa.cases;
import static com.kjj.qa.config.BasicConfig.*;
import com.kjj.qa.utils.NetworkUtil;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.*;
import org.testng.annotations.Test;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class Article {
NetworkUtil network = NetworkUtil.getInstance();
String scid = "";
String sid = "";
@BeforeClass
public void setUp() {
}
//文章内容页
@Test(description="文章内容页",priority = 1)
public void 文章内容页() throws IOException{
//根据ContentId获取Scid
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentId",ARTICLE_CONTENTID);
Response response = network.getResponse(params, GETSCID);
scid = response.jsonPath().getString("data");
Assert.assertNotNull(scid,network.message(params, GETSCID,"获取scId失败"));
Map<String, Object> infoParams = new HashMap<String, Object>();
infoParams.put("scid",scid);
response = network.getResponse(infoParams,ARTICLE_H5INFO);
String id = response.jsonPath().getString("data.id");
Assert.assertEquals(ARTICLE_CONTENTID,id, network.message(infoParams,ARTICLE_H5INFO,"获取文章内容页失败"));
}
//名片是否展示
@Test(description="名片是否展示",priority = 2)
public void 名片是否展示() throws IOException {
//关闭名片展示
Map<String, Object> sellerCardParams = new HashMap<String, Object>();
sellerCardParams.put("configKey","card_show_on_top");//素材头部名片
sellerCardParams.put("configValue",false);
Response response = network.postResponse(sellerCardParams,SELLERCONFIG_EDITCONFIG);
boolean isChanged = response.jsonPath().getBoolean("data");
Assert.assertTrue(isChanged,network.message(sellerCardParams,SELLERCONFIG_EDITCONFIG,"关闭素材头部名片失败"));
sellerCardParams.put("configKey","card_show_on_bottom");//素材尾部名片
sellerCardParams.put("configValue",false);
response = network.postResponse(sellerCardParams,SELLERCONFIG_EDITCONFIG);
isChanged = response.jsonPath().getBoolean("data");
Assert.assertTrue(isChanged,network.message(sellerCardParams,SELLERCONFIG_EDITCONFIG,"关闭素材底部名片失败"));
//检查文章内名片展示
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
response = network.getResponse(params,SELLERCARD_GETSELLERCARDCONFIG);
int openCount = response.jsonPath().getInt("data.findAll {it.val == true}.size()");
Assert.assertEquals(openCount,0,network.message(params,SELLERCARD_GETSELLERCARDCONFIG,"名片关闭状态与设置中心不一致"));
//开启名片展示
sellerCardParams.put("configKey","card_show_on_top");//素材尾部名片
sellerCardParams.put("configValue",true);
response = network.postResponse(sellerCardParams,SELLERCONFIG_EDITCONFIG);
sellerCardParams.put("configKey","card_show_on_bottom");//素材尾部名片
sellerCardParams.put("configValue",true);
response = network.postResponse(sellerCardParams,SELLERCONFIG_EDITCONFIG);
//再次检查文章内名片展示
response = network.getResponse(params,SELLERCARD_GETSELLERCARDCONFIG);
openCount = response.jsonPath().getInt("data.findAll {it.val == true}.size()");
Assert.assertEquals(openCount,2,network.message(params,SELLERCARD_GETSELLERCARDCONFIG,"名片开启状态与设置中心不一致"));
//名片样式
Map<String, Object> styleParams = new HashMap<String, Object>();
styleParams.put("id",scid);
response = network.getResponse(styleParams,SELLERCARD_GETSELLERCARDSTYLE);
String backgroundColor = response.jsonPath().getString("data.find {it.code == 'card_background_color'}.val");
Assert.assertEquals(backgroundColor,"1",network.message(styleParams,SELLERCARD_GETSELLERCARDSTYLE,"名片-背景色样式不对"));
}
// 头部名片
@Test(description="头部名片详情",priority = 3)
public void 头部名片详情() throws IOException {
//获取加密的销售ID
Response response = network.getResponse(USER_INFO);
sid = response.jsonPath().getString("data.encodeSellerId");
String sellerName = response.jsonPath().getString("data.sellerName");
//获取名片的姓名、公司等
Map<String, Object> params = new HashMap<String, Object>();
params.put("sid",sid);
params.put("t", System.currentTimeMillis());
response = network.getResponse(params,SELLERCARD_TOPOFCONTENT);
String scId = response.jsonPath().getString("data.scid");
String name = response.jsonPath().getString("data.sellerName");
Assert.assertEquals(name,sellerName,"头部名片信息显示有误");
//获取名片的点赞
Map<String, Object> likeParams = new HashMap<String, Object>();
likeParams.put("scId",scId);
response = network.getResponse(likeParams,HASALREADYLIKE);
int favourTimes = response.jsonPath().getInt("data.favourTimes");
Assert.assertEquals(favourTimes,0,"头部名片点赞数量显示有误");
}
// 底部名片
@Test(description="底部名片详情",priority = 4)
public void 底部名片详情() throws IOException {
//获取加密的销售ID
Response response = network.getResponse(USER_INFO);
sid = response.jsonPath().getString("data.encodeSellerId");
String sellerName = response.jsonPath().getString("data.sellerName");
//获取名片的姓名、公司等
Map<String, Object> params = new HashMap<String, Object>();
params.put("sid",sid);
params.put("t", System.currentTimeMillis());
response = network.getResponse(params,SELLERCARD_TOPOFCONTENT);
String name = response.jsonPath().getString("data.sellerName");
Assert.assertEquals(name, sellerName,"底部名片信息显示有误");
}
// 是否爆款素材
@Test(description="文章类型判断",priority = 5)
public void 文章类型判断() throws IOException {
//获得素材类型 种草、发圈
Map<String, Object> params = new HashMap<String, Object>();
params.put("id",ARTICLE_CONTENTID);
Response response = network.getResponse(params,ARTICLE_GETTAGTYPESBYCONTENTID);
boolean isContains = response.jsonPath().getBoolean("data.contains('grass_content')");
Assert.assertTrue(isContains,"类型判断错误-类型应该存在种草素材");
//获得爆款素材详情
Map<String, Object> infoParams = new HashMap<String, Object>();
infoParams.put("contentId",ARTICLE_CONTENTID);
response = network.getResponse(infoParams,ARTICLE_GETEXPINFO);
String tags = response.jsonPath().getString("data.tags");
Assert.assertEquals(tags,"放到沙发上",network.message(infoParams,ARTICLE_GETEXPINFO,"文章内标签-获取失败"));
}
//
}
......@@ -21,99 +21,5 @@ public class Home {
}
@Test (description = "JSSDK",priority = 1) //priorty 方法执行优先级
public void JSSDK() throws IOException {
//参数
Map<String, Object> params = new HashMap<String, Object>();
params.put("url","https://kjj.m.duiba.com.cn/#/?access_source=31");
params.put("retry","false");
Response response = network.getResponse(params,"/kjy/mp/seller/getOaJssdk");
boolean result = response.jsonPath().getBoolean("success");
Assert.assertEquals(result,true,"获取jssdk失败");
}
// @Test (description = "早中晚日报列表",priority = 2)
// public void 早中晚日报列表() throws IOException {
// Response response = network.getResponse("/kjy/mp/content/getInitDailyList");
// int status = response.jsonPath().get("data[0].status");
// Assert.assertEquals(status,2,"获取早中晚日报列表信息失败");
// }
//
// @Test (description = "精准素材库",priority = 3)
// public void 精准素材库() throws IOException {
// Response response = network.getResponse("/kjy/mp/accurate/usrDetail");
// int result = response.jsonPath().get("data.companyId");
// Assert.assertEquals(result,5,"获取精准素材成功");
//// Reporter.log("用例执行失败:服务器错误!");
// }
//
// @Test (description = "今日访问",priority = 4)
// public void 今日访问() throws IOException {
// //获取旧的今日访问数量
// Response response = network.getResponse("/kjy/mp/seller/todayVisit");
// int oldTodayCount = response.jsonPath().get("data.todayCount");
//
// //访问名片 具体啥接口得问开发
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("contentId",79040);
// params.put("scId","7703312855");
// params.put("comefrom",1);
// params.put("fromUserId","2477770");
// Response vistorRes = network.visitorBehavior(params,"/kjy/mp/sellerCard/visit");
//
// //获取新的今日访问数量
// response = network.getResponse("/kjy/mp/seller/todayVisit");
// int newTodayCOunt = response.jsonPath().get("data.todayCount");
//
// Assert.assertEquals(oldTodayCount + 1,newTodayCOunt,"今日访问量统计有误");
// }
//
// @Test (description = "分类列表",priority = 5)
// public void 分类列表() throws IOException {
// Response response = network.getResponse("/kjy/mp/classify/list");
// String classifyName = response.jsonPath().get("data.list[0].classifyName");
// Assert.assertEquals(classifyName ,"推荐","获取列表信息失败");
//
// // 检验是否有公司专区
// }
//
// @Test (description = "推荐分类下的内容列表",priority = 6)
// //首頁-信息
// public void 推荐分类下的内容列表() throws IOException {
// //穿的分页参数
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("classfiyId","1");
// params.put("pageIndex","1");
// params.put("pageSize","10");
//
// Response response = network.getResponse(params,"/kjy/mp/classify/contentList");
// int pageSize = response.jsonPath().get("data.pageSize");
// Assert.assertEquals(pageSize,10,"获取分类下的内容列表失败");
// }
//
// @Test (description = "用户信息",priority = 7)
// public void 用户信息() throws IOException {
// //获取旧的今日访问数量
// Response response = network.getResponse("/kjy/mp/user/info");
// String wxName = response.jsonPath().get("data.wxName");
// Assert.assertEquals(wxName ,"小葡萄","获取用户信息失败");
// }
//
// @Test (description = "销售员公司资料总数",priority = 8)
// //首頁-信息
// public void 销售员公司资料总数() throws IOException {
// Response response = network.getResponse("/kjy/mp/companyDocument/count");
// boolean result = response.jsonPath().getBoolean("success");
// Assert.assertEquals(result, true, "获取销售员公司资料总数失败");
//// Reporter.log("用例执行失败:服务器错误!");
// }
//
// @AfterSuite
// public void testSuite() throws IOException {
//
// }
}
package com.kjj.qa.cases;
import static com.kjj.qa.config.BasicConfig.*;
import com.kjj.qa.utils.NetworkUtil;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.*;
import org.testng.annotations.Test;
......@@ -9,11 +11,10 @@ import org.testng.annotations.Test;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class NewTask {
public class Novice {
NetworkUtil network = NetworkUtil.getInstance();
......@@ -25,25 +26,26 @@ public class NewTask {
//会员判断
@Test(description="会员判断",priority = 1)
public void 会员判断() throws IOException{
Response response = network.getResponse("/kjy/mp/seller/isVipSubscribe");
Response response = network.getResponse(ISVIPSUBSCRIBE);
boolean isVip = response.jsonPath().getBoolean("data.vip");
Assert.assertTrue(true, "新手任务-会员判断错误");
Assert.assertTrue(true, network.message(ISVIPSUBSCRIBE,"新手任务-会员判断错误"));
}
//用户信息
@Test(description = "用户信息",priority = 2)
public void 用户信息()throws IOException{
Response response = network.getResponse("/kjy/mp/user/info");
Response response = network.getResponse(USER_INFO);
String wxName = response.jsonPath().getString("data.wxName");
Assert.assertEquals(wxName,"Su Yi","新手任务-获取用户信息失败");
Assert.assertEquals(wxName,"Su Yi",network.message(USER_INFO,"新手任务-获取用户信息失败"));
}
//新手任务列表
@Test (description = "新手任务列表",priority = 3) //priorty 方法执行优先级
public void 新手任务列表() throws IOException {
Response response = network.getResponse("/kjy/mp/seller/novice/list");
Response response = network.getResponse(NOVICE_LIST);
System.out.println(response.getBody().prettyPrint());
int length = response.jsonPath().getInt("data.size()");
Assert.assertEquals(length,12,"新手任务-任务列表数量不对");
Assert.assertEquals(length,12,network.message(NOVICE_LIST,"新手任务-任务列表数量不对"));
}
// 关注公众号 需要微信回调,无法实现
......@@ -66,83 +68,83 @@ public class NewTask {
@Test (description = "新手任务_转发文章",priority = 5) //priorty 方法执行优先级
public void 新手任务_转发文章() throws IOException {
//获取列表中"转发文章"的任务
Response response = network.getResponse("/kjy/mp/seller/novice/list");
Response response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发文章"的任务状态 code: 0未完成 1可领奖励 2已完成
int code = response.jsonPath().getInt("data.find {it.taskName == '转发文章'}.taskStatus.code");
Assert.assertEquals(code,0,"转发文章-任务初始状态 获取失败");
Assert.assertEquals(code,0,network.message(NOVICE_LIST,"转发文章-任务初始状态 获取失败"));
//转发文章到朋友圈
Map<String, Object> params = new HashMap<String, Object>();
params.put("scId","Kj20MTMwMDM5");//文章scId
params.put("forwardType",2);// 1:个人/微信群 2:朋友圈
response = network.getResponse(params,"/kjy/mp/forward");
params.put("scId",getScId(ARTICLE_CONTENTID));//文章scId
params.put("forwardType",1);// 1:个人/微信群 2:朋友圈
response = network.getResponse(params,FORWARD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,"转发文章-转发到朋友圈 失败");
Assert.assertTrue(data, network.message(params, FORWARD,"转发文章-转发到朋友圈 失败"));
//重新获取任务名为"转发文章"的任务状态,验证任务是否生效
response = network.getResponse("/kjy/mp/seller/novice/list");
response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发文章"的任务状态 code: 0未完成 1可领奖励 2已完成
code = response.jsonPath().getInt("data.find {it.taskName == '转发文章'}.taskStatus.code");
Assert.assertEquals(code,1,"转发文章-新手任务完成状态 获取失败");
Assert.assertEquals(code,1,network.message(NOVICE_LIST,"转发文章-新手任务完成状态 获取失败"));
}
// 转发动画
@Test (description = "新手任务_转发动画",priority = 6) //priorty 方法执行优先级
public void 新手任务_转发动画() throws IOException {
//获取列表中"转发文章"的任务
Response response = network.getResponse("/kjy/mp/seller/novice/list");
//获取任务名为"转发文章"的任务状态 code: 0未完成 1可领奖励 2已完成
//获取列表中"转发动画"的任务
Response response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发动画"的任务状态 code: 0未完成 1可领奖励 2已完成
int code = response.jsonPath().getInt("data.find {it.taskName == '转发动画'}.taskStatus.code");
Assert.assertEquals(code,0,"转发动画-任务初始状态 获取失败");
Assert.assertEquals(code,0, network.message(NOVICE_LIST,"转发动画-任务初始状态 获取失败"));
//转发文章到朋友圈
//转发动画到朋友圈
Map<String, Object> params = new HashMap<String, Object>();
params.put("scId","Kj20MTMyMTM1");//动画scId
params.put("scId",getScId(ANIMATION_CONTENTID));//动画scId
params.put("forwardType",2);// 1:个人/微信群 2:朋友圈
response = network.getResponse(params,"/kjy/mp/forward");
response = network.getResponse(params,FORWARD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,"转发动画-转发到朋友圈 失败");
Assert.assertTrue(data, network.message(params, FORWARD,"转发动画-转发到朋友圈 失败"));
//重新获取任务名为"转发文章"的任务状态,验证任务是否生效
response = network.getResponse("/kjy/mp/seller/novice/list");
//获取任务名为"转发文章"的任务状态 code: 0未完成 1可领奖励 2已完成
//重新获取任务名为"转发动画"的任务状态,验证任务是否生效
response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发动画"的任务状态 code: 0未完成 1可领奖励 2已完成
code = response.jsonPath().getInt("data.find {it.taskName == '转发动画'}.taskStatus.code");
Assert.assertEquals(code,1,"转发动画-新手任务完成状态 获取失败");
Assert.assertEquals(code,1,network.message(NOVICE_LIST,"转发动画-新手任务完成状态 获取失败"));
}
// 转发游戏
@Test (description = "新手任务_转发游戏",priority = 7) //priorty 方法执行优先级
public void 新手任务_转发游戏() throws IOException {
//获取列表中"转发文章"的任务
Response response = network.getResponse("/kjy/mp/seller/novice/list");
//获取任务名为"转发文章"的任务状态 code: 0未完成 1可领奖励 2已完成
//获取列表中"转发游戏"的任务
Response response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发游戏"的任务状态 code: 0未完成 1可领奖励 2已完成
int code = response.jsonPath().getInt("data.find {it.taskName == '转发游戏(内测中)'}.taskStatus.code");
Assert.assertEquals(code,0,"转发游戏-任务初始状态 获取失败");
Assert.assertEquals(code,0,network.message(NOVICE_LIST,"转发游戏-任务初始状态 获取失败"));
//转发文章到朋友圈
//转发游戏到朋友圈
Map<String, Object> params = new HashMap<String, Object>();
params.put("scId","Kj20MTMyMTQz");//游戏scId
params.put("scId",getScId(GAME_CONTENTID));//游戏scId
params.put("forwardType",2);// 1:个人/微信群 2:朋友圈
response = network.getResponse(params,"/kjy/mp/forward");
response = network.getResponse(params,FORWARD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,"转发游戏-转发到朋友圈 失败");
Assert.assertTrue(data,network.message(params,FORWARD,"转发游戏-转发到朋友圈 失败"));
//重新获取任务名为"转发文章"的任务状态,验证任务是否生效
response = network.getResponse("/kjy/mp/seller/novice/list");
//获取任务名为"转发文章"的任务状态 code: 0未完成 1可领奖励 2已完成
//重新获取任务名为"转发游戏"的任务状态,验证任务是否生效
response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发游戏"的任务状态 code: 0未完成 1可领奖励 2已完成
code = response.jsonPath().getInt("data.find {it.taskName == '转发游戏(内测中)'}.taskStatus.code");
Assert.assertEquals(code,1,"转发游戏-新手任务完成状态 获取失败");
Assert.assertEquals(code,1,network.message(NOVICE_LIST,"转发游戏-新手任务完成状态 获取失败"));
}
//上传文章
@Test (description = "新手任务_上传文章",priority = 8) //priorty 方法执行优先级
public void 新手任务_上传文章() throws IOException {
//获取列表中"上传文章"的任务
Response response = network.getResponse("/kjy/mp/seller/novice/list");
Response response = network.getResponse(NOVICE_LIST);
//获取任务名为"转发文章"的任务状态 code: 0未完成 1可领奖励 2已完成
//获取任务名为"上传文章"的任务状态 code: 0未完成 1可领奖励 2已完成
int code = response.jsonPath().getInt("data.find {it.taskName == '上传文章'}.taskStatus.code");
Assert.assertEquals(code,0,"上传文章-任务初始状态 获取失败");
Assert.assertEquals(code,0,network.message(NOVICE_LIST,"上传文章-任务初始状态 获取失败"));
//上传文章并发到朋友圈 (文章已经在上传case执行过,所以找到那篇文章进行转发就好)
Map<String, Object> params = new HashMap<String, Object>();
......@@ -152,29 +154,27 @@ public class NewTask {
//获取我的上传里文章的列表
params.put("type","article");
response = network.getResponse(params,"/kjy/mp/seller/import/list");
response = network.getResponse(params,UPLOAD_LIST);
String contentType = response.jsonPath().getString("data[0].contentType");
String contentId = response.jsonPath().getString("data[0].id");//获取文章的contentd
Assert.assertEquals(contentType, "article", "上传文章-获取我的上传-文章列表数量有误");
Assert.assertEquals(contentType, "article", network.message(params, UPLOAD_LIST,"上传文章-获取我的上传-文章列表数量有误"));
//根据contentId 拿到 scId
response = network.getResponse("/kjy/mp/seller/getScId?contentId="+contentId);
String scId = response.jsonPath().getString("data");
Assert.assertNotNull(scId,"上传文章-我的上传文章-获取scId失败");
//转发文章到朋友圈
Map<String, Object> shareParams = new HashMap<String, Object>();
shareParams.put("scId",scId);
shareParams.put("scId",getScId(contentId));
shareParams.put("forwardType",2);
response = network.getResponse(shareParams,"/kjy/mp/forward");
response = network.getResponse(shareParams,FORWARD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,"上传文章-发到朋友圈 失败");
Assert.assertTrue(data,network.message(shareParams, FORWARD,"上传文章-发到朋友圈 失败"));
//重新获取任务名为"上传文章"的任务状态,验证任务是否生效
response = network.getResponse("/kjy/mp/seller/novice/list");
//获取任务名为"转发文章"的任务状态 code: 0未完成 1可领奖励 2已完成
response = network.getResponse(NOVICE_LIST);
//获取任务名为"上传文章"的任务状态 code: 0未完成 1可领奖励 2已完成
code = response.jsonPath().getInt("data.find {it.taskName == '上传文章'}.taskStatus.code");
Assert.assertEquals(code,1,"上传文章-完成新手任务 失败");
Assert.assertEquals(code,1,network.message(NOVICE_LIST,"上传文章-完成新手任务 失败"));
}
// 收到好友转发访问 该接口已废弃
......@@ -213,60 +213,73 @@ public class NewTask {
@Test (description = "新手任务_查看访问客户",priority = 9) //priorty 方法执行优先级
public void 新手任务_查看访问客户() throws IOException {
//获取列表中"查看访问客户"的任务
Response response = network.getResponse("/kjy/mp/seller/novice/list");
Response response = network.getResponse(NOVICE_LIST);
//获取任务名为"查看访问客户"的任务状态 code: 0未完成 1可领奖励 2已完成
int code = response.jsonPath().getInt("data.find {it.taskName == '查看访问客户'}.taskStatus.code");
Assert.assertEquals(code,0,"获取新手任务初始状态-查看访问客户 失败");
Assert.assertEquals(code,0,network.message(NOVICE_LIST,"获取新手任务初始状态-查看访问客户 失败"));
//好友转发一篇我的素材
network.agentCookies.put("tku",network.visitorTku); //tku 切换为访客的
network.agentCookies.put("tku",VISITOR_TKU); //tku 切换为访客的
Map<String, Object> params = new HashMap<String, Object>();
params.put("scId","Kj20MTMwMDM5");//文章scId
params.put("scId",getScId(UPLOAD_CONTENTID));//文章scId
params.put("forwardType",2);// 1:个人/微信群 2:朋友圈
response = network.getResponse(params,"/kjy/mp/forward");
response = network.getResponse(params,FORWARD);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,"查看访问客户-好友转发到朋友圈 失败");
network.agentCookies.put("tku",network.agentTku); //tku 切换为代理人的
Assert.assertTrue(data,network.message(params,FORWARD,"查看访问客户-好友转发到朋友圈 失败"));
network.agentCookies.put("tku",AGENT_TKU); //tku 切换为代理人的
//进入谁看过我,查看访客列表
Map<String, Object> whoSawMeParams = new HashMap<String, Object>();
whoSawMeParams.put("pageIndex",1);
whoSawMeParams.put("pageSize",30);
response = network.getResponse(whoSawMeParams,"/kjy/mp/whoSawMe/custClueList/v2");
response = network.getResponse(whoSawMeParams, WHOSAWME_CUSTCLUELISTV2);
boolean hasnext = response.jsonPath().getBoolean("data.hasNext");
int length = response.jsonPath().getInt("data.list.size()");
Assert.assertNotEquals(0,"获取谁看过我列表成功");
Assert.assertNotEquals(0,network.message(whoSawMeParams, WHOSAWME_CUSTCLUELISTV2,"获取谁看过我列表成功"));
//点击查看,进入线索详情页
Map<String, Object> noviceParams = new HashMap<String, Object>();
noviceParams.put("sceneCode","noviceTask_visitorsCustomerInfoComplete");
response = network.postResponse(noviceParams,"/kjy/mp/seller/novice/mongolianLayerDisplay");
response = network.postResponse(noviceParams,NOVICE_MONGOLIANLAYERISPLAY);
String desc = response.jsonPath().getString("desc");
//重新获取任务名为"查看访问客户"的任务状态,验证任务是否生效
response = network.getResponse("/kjy/mp/seller/novice/list");
response = network.getResponse(NOVICE_LIST);
//获取任务名为"查看访问客户"的任务状态 code: 0未完成 1可领奖励 2已完成
code = response.jsonPath().getInt("data.find {it.taskName == '查看访问客户'}.taskStatus.code");
Assert.assertEquals(code,1,"查看访问客户-新手任务完成状态 获取失败");
Assert.assertEquals(code,1, network.message(NOVICE_LIST,"查看访问客户-新手任务完成状态 获取失败"));
}
//完善名片 名片改动,此处始终会处于未完成状态,待产品优化
@Test (description = "新手任务_完善名片",priority = 9) //priorty 方法执行优先级
public void 新手任务_完善名片() throws IOException {
//获取列表中"完善名片"的任务
Response response = network.getResponse("/kjy/mp/seller/novice/list");
Response response = network.getResponse(NOVICE_LIST);
//获取任务名为"完善名片"的任务状态 code: 0未完成 1可领奖励 2已完成
int code = response.jsonPath().getInt("data.find {it.taskName == '完善名片'}.taskStatus.code");
Assert.assertEquals(code,0,"获取新手任务初始状态-完善名片 失败");
Assert.assertEquals(code,0, network.message(NOVICE_LIST,"获取新手任务初始状态-完善名片 失败"));
//完善名片
//重新获取任务名为"完善名片"的任务状态,验证任务是否生效
}
//获取ScId
public String getScId (String contentId){
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentId",contentId);
Response response = network.getResponse(params, GETSCID);
String scId = response.jsonPath().getString("data");
Assert.assertNotNull(scId,network.message(params, GETSCID,"获取scId失败"));
return scId;
}
@AfterClass
public static void tearDown(){
apiCount += 6;
}
}
package com.kjj.qa.cases;
import static com.kjj.qa.config.BasicConfig.*;
import com.kjj.qa.utils.NetworkUtil;
import io.restassured.response.Response;
import org.testng.Assert;
......@@ -24,32 +25,32 @@ public class Pay {
@Test (description = "默认付费_付费页",priority = 1) //priorty 方法执行优先级
public void 默认付费_付费页() throws IOException {
//付款中间页判断
Response skipTypeResponse = network.getResponse("/kjy/mp/payMiddle/getMiddleDetail");
Response skipTypeResponse = network.getResponse(PAY_GETMIDDLEDETAIL);
int skipType = skipTypeResponse.jsonPath().getInt("data.skipType");
Assert.assertEquals(skipType,2,"付款中间页:不是2020新版");
Assert.assertEquals(skipType,2,network.message(PAY_GETMIDDLEDETAIL,"付款中间页:不是2020新版"));
//会销资格判断
Response SiteSaleValidresponse = network.getResponse("/kjy/mp/seller/dist/hasSiteSaleValid");
Response SiteSaleValidresponse = network.getResponse(PAY_HASSITESALEVALID);
boolean siteSaleValid = SiteSaleValidresponse.jsonPath().getBoolean("data");
Assert.assertEquals(siteSaleValid,false,"会销资格判断:判断错误,有会销资格");
Assert.assertEquals(siteSaleValid,false,network.message(PAY_HASSITESALEVALID,"会销资格判断:判断错误,有会销资格"));
//会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>();
params.put("t",System.currentTimeMillis());
Response userVersionResponse = network.getResponse(params,"/kjy/mp/version/info");
Response userVersionResponse = network.getResponse(params, VERSION_INFO);
int userVersion = userVersionResponse.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型
Assert.assertEquals(userVersion,1,"会员类型版本判断:判断错误,此版本为保险版");
Assert.assertEquals(userVersion,1,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为保险版"));
//获取当前用户可用优惠码
Response promoCodeResponse = network.getResponse(params,"/kjy/order/getPromoCode");
Response promoCodeResponse = network.getResponse(params,PAY_GETPROMOCODE);
String promoCode = promoCodeResponse.jsonPath().getString("data");
Assert.assertEquals(promoCode,null,"是否优惠判断:判断错误,当前有优惠");
Assert.assertEquals(promoCode,null, network.message(params,PAY_GETPROMOCODE,"是否优惠判断:判断错误,当前有优惠"));
//获取付费价格
Response actualPayMoneyResponse = network.getResponse("/kjy/mp/combo/list/v2?code=");
Response actualPayMoneyResponse = network.getResponse(PAY_COMBOLIST);
String actualPayMoney = actualPayMoneyResponse.jsonPath().getString("data[0].actualPayMoney");
Assert.assertEquals(actualPayMoney,"586","获取付费价格:价格不是586");
Assert.assertEquals(actualPayMoney,"586",network.message(PAY_COMBOLIST,"获取付费价格:价格不是586"));
}
@Test (description = "默认付费_待支付",priority = 2)
......@@ -62,9 +63,9 @@ public class Pay {
payParams.put("paySource","2");
payParams.put("sellerFrom","");
Response orderAppId = network.postResponse(payParams,"/kjy/order/create");
Response orderAppId = network.postResponse(payParams,PAY_ORDERCREATE);
String appId = orderAppId.jsonPath().getString("data.appId");
Assert.assertEquals(appId,"wxcb8c36279dd7dff2","拉起支付:拉起微信支付失败"); //判断返回的微信调起参数中appId是否正确
Assert.assertEquals(appId,"wxcb8c36279dd7dff2",network.message(payParams, PAY_ORDERCREATE,"拉起支付:拉起微信支付失败")); //判断返回的微信调起参数中appId是否正确
}
......@@ -77,16 +78,15 @@ public class Pay {
payParams.put("oaId","1");
payParams.put("paySource","2");
payParams.put("sellerFrom","");
Response orderAppId = network.postResponse(payParams,"/kjy/order/create");
Response orderAppId = network.postResponse(payParams,PAY_ORDERCREATE);
String tradeNo = orderAppId.jsonPath().getString("data.tradeNo");
//会员类型版本判断
Map<String, Object> cancelParams = new HashMap<String, Object>();
cancelParams.put("tradeNo",tradeNo);
Response resultResponse = network.getResponse(cancelParams,"/kjy/order/cancel");
Response resultResponse = network.getResponse(cancelParams,PAY_ORDERCANCEL);
String result = resultResponse.jsonPath().getString("desc");
Assert.assertEquals(result,"OK","取消支付:取消支付失败"); //判断返回的微信调起参数中appId是否正确
Assert.assertEquals(result,"OK",network.message(cancelParams, PAY_ORDERCANCEL,"取消支付:取消支付失败")); //判断返回的微信调起参数中appId是否正确
}
// @Test (description = "默认付费_成功支付",priority = 4)
......@@ -99,24 +99,23 @@ public class Pay {
//会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>();
params.put("t",System.currentTimeMillis());
Response userVersionResponse = network.getResponse(params,"/kjy/mp/version/info");
Response userVersionResponse = network.getResponse(params,VERSION_INFO);
int userVersion = userVersionResponse.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型
int changeVersion = userVersion == 1 ? 2 : 1; // 判断当前开启的版本,如果当前版本是1,则改为2,反之;
//切换版本
Map<String, Object> versionParams = new HashMap<String, Object>();
versionParams.put("targetVersion",changeVersion);
Response resultResponse = network.postResponse(versionParams,"/kjy/mp/version/exchange");
Response resultResponse = network.postResponse(versionParams,PAY_VERSIONEXCHANGE);
String result = resultResponse.jsonPath().getString("desc");
Assert.assertEquals(result,"OK","会员类型切换:切换失败"); //判断返回的微信调起参数中appId是否正确
Assert.assertEquals(result,"OK",network.message(versionParams,PAY_VERSIONEXCHANGE,"会员类型切换:切换失败")); //判断返回的微信调起参数中appId是否正确
//会员类型再次判断
params.put("t",System.currentTimeMillis());
userVersionResponse = network.getResponse(params,"/kjy/mp/version/info");
userVersionResponse = network.getResponse(params,VERSION_INFO);
userVersion = userVersionResponse.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型
Assert.assertEquals(userVersion,changeVersion,"会员类型版本判断:判断错误,此版本为尊享版");
Assert.assertEquals(userVersion,changeVersion,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为尊享版"));
}
@Test (description = "邀请码/分销码_付费页",priority = 6)
......@@ -127,21 +126,21 @@ public class Pay {
distributeParams.put("inviterSid","1861"); //销售ID:1861加密后 会员邀请好友付费时,传此参数
distributeParams.put("fromStr",1); //文章来源: 6文章访客转化 1会员邀请
distributeParams.put("accessSource",22); //支付来源:客集集
Response distributeResponse = network.getResponse(distributeParams,"/kjy/sp/visitorPayment/distribute");
Response distributeResponse = network.getResponse(distributeParams, PAY_DISTRIBUTE);
String result = distributeResponse.jsonPath().getString("desc");
Assert.assertEquals(result,"OK","绑定分销状态:绑定失败"); //判断返回的微信调起参数中appId是否正确
Assert.assertEquals(result,"OK",network.message(distributeParams, PAY_DISTRIBUTE,"绑定分销状态:绑定失败")); //判断返回的微信调起参数中appId是否正确
//会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>();
params.put("t",System.currentTimeMillis());
Response userVersionResponse = network.getResponse(params,"/kjy/mp/version/info");
Response userVersionResponse = network.getResponse(params,VERSION_INFO);
int userVersion = userVersionResponse.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型,version应该类型为2
Assert.assertEquals(userVersion,2,"会员类型版本判断:判断错误,此版本不是上级对应的版本");
Assert.assertEquals(userVersion,2,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本不是上级对应的版本"));
//获取当前用户可用优惠码
Response promoCodeResponse = network.getResponse(params,"/kjy/order/getPromoCode");
Response promoCodeResponse = network.getResponse(params,PAY_GETPROMOCODE);
String promoCode = promoCodeResponse.jsonPath().getString("data");
Assert.assertEquals(promoCode,null,"是否优惠判断:判断错误,当前有优惠");
Assert.assertEquals(promoCode,null,network.message(params, PAY_GETPROMOCODE,"是否优惠判断:判断错误,当前有优惠"));
//获取付费价格
// Response actualPayMoneyResponse = network.getResponse("/kjy/mp/combo/list/v2?code=");
......@@ -154,9 +153,9 @@ public class Pay {
//会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>();
params.put("t",System.currentTimeMillis());
Response userVersionResponse = network.getResponse(params,"/kjy/mp/version/info");
Response userVersionResponse = network.getResponse(params,VERSION_INFO);
int userVersion = userVersionResponse.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型 1保险 2通用
Assert.assertEquals(userVersion,2,"会员类型版本判断:判断错误,此版本不是上级对应的版本");
Assert.assertEquals(userVersion,2,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本不是上级对应的版本"));
//创建支付
Map<String, Object> payParams = new HashMap<String, Object>();
......@@ -166,9 +165,9 @@ public class Pay {
payParams.put("paySource","2");
payParams.put("sellerFrom","");
Response orderAppId = network.postResponse(payParams,"/kjy/order/create");
Response orderAppId = network.postResponse(payParams,PAY_ORDERCREATE);
String appId = orderAppId.jsonPath().getString("data.appId");
Assert.assertEquals(appId,"wxcb8c36279dd7dff2","拉起支付:拉起微信支付失败"); //判断返回的微信调起参数中appId是否正确
Assert.assertEquals(appId,"wxcb8c36279dd7dff2",network.message(payParams, PAY_ORDERCREATE,"拉起支付:拉起微信支付失败")); //判断返回的微信调起参数中appId是否正确
}
// @Test (description = "邀请码/分销码_成功支付",priority = 8)
......@@ -181,9 +180,9 @@ public class Pay {
//会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>();
params.put("t",System.currentTimeMillis());
Response userVersionResponse = network.getResponse(params,"/kjy/mp/version/info");
Response userVersionResponse = network.getResponse(params,VERSION_INFO);
int userVersion = userVersionResponse.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型
Assert.assertEquals(userVersion,2,"会员类型版本判断:判断错误,此版本不是上级对应的版本");
Assert.assertEquals(userVersion,2,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本不是上级对应的版本"));
//创建支付
Map<String, Object> payParams = new HashMap<String, Object>();
......@@ -192,16 +191,15 @@ public class Pay {
payParams.put("oaId","1");
payParams.put("paySource","2");
payParams.put("sellerFrom","");
Response orderAppId = network.postResponse(payParams,"/kjy/order/create");
Response orderAppId = network.postResponse(payParams,PAY_ORDERCREATE);
String tradeNo = orderAppId.jsonPath().getString("data.tradeNo");
//会员类型版本判断
Map<String, Object> cancelParams = new HashMap<String, Object>();
cancelParams.put("tradeNo",tradeNo);
Response resultResponse = network.getResponse(cancelParams,"/kjy/order/cancel");
Response resultResponse = network.getResponse(cancelParams,PAY_ORDERCANCEL);
String result = resultResponse.jsonPath().getString("desc");
Assert.assertEquals(result,"OK","取消支付:取消支付失败"); //判断返回的微信调起参数中appId是否正确
Assert.assertEquals(result,"OK",network.message(cancelParams, PAY_ORDERCANCEL,"取消支付:取消支付失败")); //判断返回的微信调起参数中appId是否正确
}
@Test (description = "邀请码/分销码_切换会员类型为尊享版",priority = 10)
......@@ -209,29 +207,28 @@ public class Pay {
//会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>();
params.put("t",System.currentTimeMillis());
Response userVersionResponse = network.getResponse(params,"/kjy/mp/version/info");
Response userVersionResponse = network.getResponse(params,VERSION_INFO);
int userVersion = userVersionResponse.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型
int changeVersion = userVersion == 1 ? 2 : 1; // 判断当前开启的版本,如果当前版本是1,则改为2,反之;
//切换版本
//切换版本
Map<String, Object> versionParams = new HashMap<String, Object>();
versionParams.put("targetVersion",changeVersion);
Response resultResponse = network.postResponse(versionParams,"/kjy/mp/version/exchange");
Response resultResponse = network.postResponse(versionParams,PAY_VERSIONEXCHANGE);
String result = resultResponse.jsonPath().getString("desc");
Assert.assertEquals(result,"OK","会员类型切换:切换失败"); //判断返回的微信调起参数中appId是否正确
Assert.assertEquals(result,"OK",network.message(versionParams, PAY_VERSIONEXCHANGE,"会员类型切换:切换失败")); //判断返回的微信调起参数中appId是否正确
// //会员类型再次判断
params.put("t",System.currentTimeMillis());
userVersionResponse = network.getResponse(params,"/kjy/mp/version/info");
userVersionResponse = network.getResponse(params,VERSION_INFO);
userVersion = userVersionResponse.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型
Assert.assertEquals(userVersion,changeVersion,"会员类型版本判断:判断错误,此版本为尊享版");
Assert.assertEquals(userVersion,changeVersion,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为尊享版"));
}
@AfterClass
public static void tearDown(){
//将该用户改为通用版会员
apiCount += 9;
}
......
......@@ -2,6 +2,7 @@ package com.kjj.qa.cases;
import com.kjj.qa.utils.NetworkUtil;
import static com.kjj.qa.config.BasicConfig.*;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.*;
......@@ -23,167 +24,174 @@ public class SellerCard {
}
@Test (description = "获取用户版本",priority = 1) //priorty 方法执行优先级
@Test(description = "获取用户版本", priority = 1) //priorty 方法执行优先级
public void 获取用户版本() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("t",System.currentTimeMillis());
Response response = network.getResponse(params,"/kjy/mp/version/info");
params.put("t", System.currentTimeMillis());
Response response = network.getResponse(params, VERSION_INFO);
int userVersion = response.jsonPath().getInt("data.find {it.openType == 1}.userVersion"); // 找出开启状态的版本类型
Assert.assertEquals(userVersion,1,"会员类型版本判断:判断错误,此版本为通用版");
Assert.assertEquals(userVersion, 2, network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为通用版"));
}
@Test (description = "是否关注红号",priority = 2) //priorty 方法执行优先级
@Test(description = "是否关注红号", priority = 2) //priorty 方法执行优先级
public void 是否关注红号() throws IOException {
Response response = network.getResponse("/kjy/mp/seller/isVipSubscribe");
Response response = network.getResponse(ISVIPSUBSCRIBE);
boolean vipSubscribe = response.jsonPath().getBoolean("data.vipSubscribe");
Assert.assertFalse(false,"vip号是否关注判断错误");
Assert.assertFalse(false, network.message(ISVIPSUBSCRIBE,"vip号是否关注判断错误"));
}
@Test (description = "头部展示",priority = 3)
public void 头部展示() throws IOException{
@Test(description = "头部展示", priority = 3)
public void 头部展示() throws IOException {
//获取信息
Response response = network.getResponse("/kjy/mp/sellerCardV5/topOfDetail");
Response response = network.getResponse(SELLERCARD_TOPOFDETAIL);
scid = response.jsonPath().getString("data.scid");
sellerId = response.jsonPath().getString("data.sellerId");
String sellerName = response.jsonPath().getString("data.sellerName");
Assert.assertEquals(sellerName,"Su Yi","获取用户失败");
Assert.assertEquals(sellerName, "Su Yi", network.message(SELLERCARD_TOPOFDETAIL,"获取用户失败"));
//修改用户信息
Map<String, Object> params = new HashMap<String, Object>();
params.put("sellerName","测试123");
params.put("phoneNumber","13012341234");
params.put("wechatNumber","wx123456");
params.put("address","杭州数娱大厦(文一西路98号)");
params.put("addressLocation","120.112204,30.287785");
params.put("avatarStyle",3);
Response editRsponse = network.postResponse(params,"/kjy/mp/sellerCard/editBaseInfo");
params.put("sellerName", "测试123");
params.put("phoneNumber", "13012341234");
params.put("wechatNumber", "wx123456");
params.put("address", "杭州数娱大厦(文一西路98号)");
params.put("addressLocation", "120.112204,30.287785");
params.put("avatarStyle", 3);
Response editRsponse = network.postResponse(params, SELLERCARD_EDITBASEINFO);
boolean isChanged = editRsponse.jsonPath().getBoolean("success");
Assert.assertTrue(isChanged, network.message(params, SELLERCARD_EDITBASEINFO,"修改用户信息无效"));
//重新获取用户信息
response = network.getResponse("/kjy/mp/sellerCardV5/topOfDetail");
response = network.getResponse(SELLERCARD_TOPOFDETAIL);
sellerName = response.jsonPath().getString("data.sellerName");
String phoneNumber = response.jsonPath().getString("data.phoneNumber");
String wechatNumber = response.jsonPath().getString("data.wechatNumber");
String address = response.jsonPath().getString("data.address");
int avatarStyle = response.jsonPath().getInt("data.avatarStyle");
Assert.assertEquals(sellerName,"测试123","修改昵称失败");
Assert.assertEquals(phoneNumber,"13012341234","修改手机号失败");
Assert.assertEquals(wechatNumber,"wx123456","修改微信号成功");
Assert.assertEquals(address,"杭州数娱大厦(文一西路98号)","修改地址失败");
Assert.assertEquals(avatarStyle,3,"修改地址成功");
Assert.assertEquals(sellerName, "测试123", network.message(SELLERCARD_TOPOFDETAIL,"修改后的姓名不正确"));
Assert.assertEquals(phoneNumber, "13012341234", network.message(SELLERCARD_TOPOFDETAIL,"修改后的手机号不正确"));
Assert.assertEquals(wechatNumber, "wx123456", network.message(SELLERCARD_TOPOFDETAIL,"修改后的微信号不正确"));
Assert.assertEquals(address, "杭州数娱大厦(文一西路98号)", network.message(SELLERCARD_TOPOFDETAIL,"修改后的地址不正确"));
}
@Test (description = "专业介绍",priority = 4)
@Test(description = "专业介绍", priority = 4)
public void 专业介绍() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
Response response = network.getResponse(params,"/kjy/mp/sellerCardV5/personalProfile");
params.put("scid", scid);
Response response = network.getResponse(params, SELLERCARD_PERSONALPROFILE);
String intro = response.jsonPath().getString("data.personalIntro"); //个人介绍
int exprLength = response.jsonPath().getInt("data.exprLength"); //工作年限
// Assert.assertEquals(intro,"我在行业内深耕多年,经验丰富,具备过硬的专业素质,深受客户喜爱和支持。","个人介绍-获取介绍不匹配");
Assert.assertEquals(exprLength,0,"个人介绍-获取工作年限不匹配");
Assert.assertEquals(exprLength, 0, network.message(params, SELLERCARD_PERSONALPROFILE,"个人介绍-获取工作年限不匹配"));
//修改工作年限和个人介绍
Map<String, Object> baseParams = new HashMap<String, Object>();
baseParams.put("exprLength",2);
baseParams.put("personalIntro","我在行业内整挺好!");
Response baseResponse = network.postResponse(baseParams,"/kjy/mp/sellerCard/editBaseInfo");
baseParams.put("exprLength", 2);
baseParams.put("personalIntro", "我在行业内整挺好!");
Response baseResponse = network.postResponse(baseParams, SELLERCARD_EDITBASEINFO);
boolean isChanged = baseResponse.jsonPath().getBoolean("success");
Assert.assertTrue(isChanged, network.message(baseParams, SELLERCARD_EDITBASEINFO,"修改工作年限和个人介绍无效"));
//修改擅长专业
Map<String, Object> personalParams = new HashMap<String, Object>();
personalParams.put("goodAtCustom","逼逼赖赖,叽叽歪歪");
personalParams.put("goodAtDefault","");
Response personalResponse = network.postResponse(personalParams,"/kjy/mp/sellerCard/editMajorGoodAuth");
personalParams.put("goodAtCustom", "逼逼赖赖,叽叽歪歪");
personalParams.put("goodAtDefault", "16");
Response personalResponse = network.postResponse(personalParams, SELLERCARD_EDITMAJORGOODAUTH);
isChanged = personalResponse.jsonPath().getBoolean("success");
Assert.assertTrue(isChanged, network.message(personalParams, SELLERCARD_EDITBASEINFO,"修改擅长专业无效"));
//查看修改后的专业介绍
response = network.getResponse(params,"/kjy/mp/sellerCardV5/personalProfile");
response = network.getResponse(params, SELLERCARD_PERSONALPROFILE);
intro = response.jsonPath().getString("data.personalIntro"); //个人介绍
exprLength = response.jsonPath().getInt("data.exprLength"); //工作年限
Assert.assertEquals(intro,"我在行业内整挺好!","修改个人介绍失败");
Assert.assertEquals(exprLength,2,"修改工作年限失败");
boolean isChooseGoodAtDefault = response.jsonPath().getBoolean("data.goodAtMajor.find {it.code == '16'}.choose");
Assert.assertEquals(intro, "我在行业内整挺好!", network.message(params, SELLERCARD_PERSONALPROFILE,"修改个人介绍失败"));
Assert.assertEquals(exprLength, 2, network.message(params, SELLERCARD_PERSONALPROFILE,"修改工作年限失败"));
Assert.assertTrue(isChooseGoodAtDefault, network.message(params, SELLERCARD_PERSONALPROFILE,"选择默认擅长专业失效"));
}
@Test (description = "客户评价",priority = 6) //priorty 方法执行优先级
@Test(description = "客户评价", priority = 5) //priorty 方法执行优先级
public void 客户评价() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
params.put("pageIndex",1);
params.put("pageSize",6);
params.put("appraiseState",1);
params.put("scid", scid);
params.put("pageIndex", 1);
params.put("pageSize", 3);
params.put("appraiseState", 1);
params.put("isPersonal", false);
Response response = network.getResponse(params,"/kjy/mp/sellerCardV5/appraiseList");
Response response = network.getResponse(params, SELLERCARD_APPRAISELISTNEW);
int totalCount = response.jsonPath().getInt("data.appraiseList.totalCount");
Assert.assertEquals(totalCount,0,"获取用户评价失败");
Assert.assertEquals(totalCount, 10, network.message(params, SELLERCARD_APPRAISELISTNEW,"获取用户评价失败"));
params.put("isPersonal", true);
response = network.getResponse(params, SELLERCARD_APPRAISELISTNEW);
totalCount = response.jsonPath().getInt("data.appraiseList.totalCount");
Assert.assertEquals(totalCount, 0, network.message(params, SELLERCARD_APPRAISELISTNEW,"获取专业评价失败"));
}
@Test (description = "投保实录",priority = 7) //priorty 方法执行优先级
public void 投保实录() throws IOException {
@Test(description = "互动问答", priority = 6) //priorty 方法执行优先级
public void 互动问答() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
params.put("pageIndex",1);
params.put("pageSize",6);
params.put("appraiseState",1);
params.put("scid", scid);
Response response = network.getResponse(params, SELLERCARD_GETQUESTIONS);
int qurstionsCount = response.jsonPath().getInt("data.questionList.size()");
Assert.assertEquals(qurstionsCount, 2, network.message(params, SELLERCARD_GETQUESTIONS,"获取用户评价失败"));
}
Response response = network.getResponse(params,"/kjy/mp/sellerCardV5/appraiseList");
int totalCount = response.jsonPath().getInt("data.appraiseList.totalCount");
Assert.assertEquals(totalCount,0,"获取用户评价失败");
@Test(description = "风险评测", priority = 7) //priorty 方法执行优先级
public void 风险评测() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid", scid);
Response response = network.getResponse(params, SELLERCARD_ISDISPLAYACTIVITY);
String contentId = response.jsonPath().getString("data.contentId");//写死风险评测id
Assert.assertEquals(contentId, "Kj21MzY5OTk", network.message(params, SELLERCARD_ISDISPLAYACTIVITY,"风险评测-获取失败"));
}
//
@Test(description = "选择公司", priority = 8) //priorty 方法执行优先级
public void 选择公司() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageIndex", 1);
params.put("pageSize", 200);
Response response = network.getResponse(params, SELLERCARD_COMPANYLIST);
String companyId = response.jsonPath().getString("data.list.find {it.companyName == '杭州兑吧网络科技有限公司'}.id");
Assert.assertNotNull(companyId, network.message(params, SELLERCARD_COMPANYLIST,"公司列表-获取失败"));
Map<String, Object> editParams = new HashMap<String, Object>();
editParams.put("companyId", companyId);
response = network.postResponse(editParams, SELLERCARD_EDITBASEINFO);
boolean isChanged = response.jsonPath().getBoolean("success");
Assert.assertTrue(isChanged, network.message(editParams, SELLERCARD_EDITBASEINFO,"选择公司失效"));
}
@Test(description = "服务案例", priority = 9) //priorty 方法执行优先级
public void 服务案例() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
params.put("pageSize",4);
Response response = network.getResponse(params, SELLERCARD_SELLERCARDCASENEW);
int count = response.jsonPath().getInt("data.cases.size()");
Assert.assertEquals(count,3, network.message(params, SELLERCARD_SELLERCARDCASENEW,"服务案例-获取失败"));
}
// @Test (description = "获奖记录",priority = 8) //priorty 方法执行优先级
// public void 获奖记录() throws IOException {
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("scid",scid);
// Response response = network.getResponse(params,"/kjy/mp/sellerCardV5/honorList");
// boolean IDAOpen = response.jsonPath().getBoolean("data.authenticationV5[0].open");
// boolean MDRTOpen = response.jsonPath().getBoolean("data.authenticationV5[1].open");
// boolean CMFOpen = response.jsonPath().getBoolean("data.authenticationV5[2].open");
//
// Assert.assertFalse(IDAOpen,"IDA认证匹配错误");
// Assert.assertFalse(MDRTOpen,"MDRT认证匹配错误");
// Assert.assertFalse(CMFOpen,"CMF认证匹配错误");
//
// //开启IDA认证
// Map<String, Object> configParams = new HashMap<String, Object>();
// configParams.put("configKey","CARD_HONOR_AUTH_3");
// configParams.put("configValue",true);
// Response configResponse = network.postResponse(configParams,"/kjy/mp/sellerConfig/editConfig");
//
// //重新查询获奖记录
// response = network.getResponse(params,"/kjy/mp/sellerCardV5/honorList");
// IDAOpen = response.jsonPath().getBoolean("data.authenticationV5[0].open");
// MDRTOpen = response.jsonPath().getBoolean("data.authenticationV5[1].open");
// CMFOpen = response.jsonPath().getBoolean("data.authenticationV5[2].open");
//
// Assert.assertTrue(IDAOpen,"修改后-IDA认证匹配错误");
// Assert.assertFalse(MDRTOpen,"修改后-MDRT认证匹配错误");
// Assert.assertFalse(CMFOpen,"修改后-CMF认证匹配错误");
// }
// @Test (description = "精彩分享",priority = 9) //priorty 方法执行优先级
// public void 精彩分享() throws IOException {
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("sellerId",sellerId);
// params.put("pageIndex",1);
// params.put("pageSize",30);
//
// Response response = network.getResponse(params,"/kjy/mp/chat/sellerContentHistory");
// int totalCount = response.jsonPath().getInt("data.totalCount");
// Assert.assertEquals(totalCount,5,"获取分享失败");
//
// // 转发一篇素材
// Map<String, Object> forwardParams = new HashMap<String, Object>();
// forwardParams.put("scId","Kj20MTI2MjIz");//文章ID
// forwardParams.put("forwardType",1);
// Response forwardResponse = network.getResponse(params,"/kjy/mp/forward");
//
// // 查询最新的分享内容
// response = network.getResponse(params,"/kjy/mp/chat/sellerContentHistory");
// String scId = response.jsonPath().getString("data.list[0].scId");
// Assert.assertEquals(scId,"Kj20MTI2MjIz","获取分享失败");
// }
@Test(description = "精选产品", priority = 10) //priorty 方法执行优先级
public void 精选产品() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid",scid);
params.put("pageSize",3);
params.put("isMore",false);
Response response = network.getResponse(params, SELLERCARD_PRODUCTLIST);
int count = response.jsonPath().getInt("data.productList.size()");
Assert.assertEquals(count,3,network.message(params, SELLERCARD_PRODUCTLIST,"精选产品-获取失败"));
}
@AfterClass
public static void tearDown(){
apiCount += 12;
}
}
package com.kjj.qa.cases;
import static com.kjj.qa.config.BasicConfig.*;
import com.kjj.qa.utils.NetworkUtil;
import io.restassured.response.Response;
import org.testng.Assert;
......@@ -21,9 +22,9 @@ public class Upload {
@Test(description="会员判断",priority = 1)
public void 会员判断() throws IOException{
Response response = network.getResponse("/kjy/mp/seller/isVipSubscribe");
Response response = network.getResponse(ISVIPSUBSCRIBE);
boolean isVip = response.jsonPath().getBoolean("data.vip");
Assert.assertTrue(true, "会员判断错误");
Assert.assertTrue(true, network.message(ISVIPSUBSCRIBE,"会员判断错误"));
}
@Test(description = "上传_文章链接",priority = 2)
......@@ -35,19 +36,19 @@ public class Upload {
Map<String, Object> params = new HashMap<String, Object>();
params.put("url",articleLink);
params.put("type",1);
Response response = network.postResponse(params,"/kjy/mp/seller/import/upload");
Response response = network.postResponse(params,UPLOAD);
String taskId = response.jsonPath().getString("data.taskId");
Assert.assertNotNull(taskId ,"上传文章链接-接口调用失败");
Assert.assertNotNull(taskId ,network.message(params,UPLOAD,"上传文章链接-接口调用失败"));
//查询上传状态 轮询30次,直至taskStatus变为2
Map<String, Object> taskParams = new HashMap<String, Object>();
taskParams.put("taskId",taskId);
response = network.getResponse(taskParams,"/kjy/mp/seller/import/taskStatus");
response = network.getResponse(taskParams,UPLOAD_TASKSTATUS);
int taskStatus = response.jsonPath().getInt("data.taskStatus");//上传状态: 1是执行中,2是上传成功
String contentId = response.jsonPath().getString("data.contentId");//内容ID
String contentImageUrl = response.jsonPath().getString("data.contentImageUrl");
String contentType = response.jsonPath().getString("data.contentType");
Assert.assertEquals(contentType,"article","上传文章链接-查询调用失败");
Assert.assertEquals(contentType,"article", network.message(taskParams, UPLOAD_TASKSTATUS,"上传文章链接-查询调用失败"));
}
@Test(description="上传_视频链接",priority = 3)
......@@ -59,19 +60,19 @@ public class Upload {
Map<String, Object> params = new HashMap<String, Object>();
params.put("url",videoLink);
params.put("type",3);
Response response = network.postResponse(params,"/kjy/mp/seller/import/upload");
Response response = network.postResponse(params,UPLOAD);
String taskId = response.jsonPath().getString("data.taskId");
Assert.assertNotNull(taskId ,"上传视频链接-接口调用失败");
Assert.assertNotNull(taskId ,network.message(params, UPLOAD,"上传视频链接-接口调用失败"));
//查询上传状态 轮询30次,直至taskStatus变为2
Map<String, Object> taskParams = new HashMap<String, Object>();
taskParams.put("taskId",taskId);
response = network.getResponse(taskParams,"/kjy/mp/seller/import/taskStatus");
response = network.getResponse(taskParams,UPLOAD_TASKSTATUS);
int taskStatus = response.jsonPath().getInt("data.taskStatus");//上传状态: 1是执行中,2是上传成功
String contentId = response.jsonPath().getString("data.contentId");//内容ID
String contentImageUrl = response.jsonPath().getString("data.contentImageUrl");
String responseTaskId = response.jsonPath().getString("data.taskId");
Assert.assertEquals(responseTaskId,taskId,"上传视频链接-查询调用失败");
Assert.assertEquals(responseTaskId,taskId,network.message(taskParams, UPLOAD_TASKSTATUS,"上传视频链接-查询调用失败"));
}
@Test(description = "上传_其他链接",priority = 4)
......@@ -83,69 +84,70 @@ public class Upload {
Map<String, Object> params = new HashMap<String, Object>();
params.put("type",2);
params.put("url",network_link);
Response response = network.postResponse(params,"/kjy/mp/seller/import/upload");
Response response = network.postResponse(params, UPLOAD);
String taskId = response.jsonPath().getString("data.taskId");//上传任务ID
Assert.assertNotNull(taskId,"上传其他链接-接口调用失败");
Assert.assertNotNull(taskId,network.message(params, UPLOAD,"上传其他链接-接口调用失败"));
//查询上传状态 轮询30次,直至taskStatus变为2
Map<String, Object> taskParams = new HashMap<String, Object>();
taskParams.put("taskId",taskId);
response = network.getResponse(taskParams,"/kjy/mp/seller/import/taskStatus");
response = network.getResponse(taskParams,UPLOAD_TASKSTATUS);
int taskStatus = response.jsonPath().getInt("data.taskStatus");//上传状态: 1是执行中,2是上传成功
String contentId = response.jsonPath().getString("data.contentId");//内容ID
String contentImageUrl = response.jsonPath().getString("data.contentImageUrl");
String contentType = response.jsonPath().getString("data.contentType");
Assert.assertEquals(contentType,"network_link","上传其他链接-查询调用失败");
Assert.assertEquals(contentType,"network_link",network.message(taskParams, UPLOAD_TASKSTATUS,"上传其他链接-查询调用失败"));
//获取 其他链接上传成功后的中间页详情
Map<String, Object> detailParams = new HashMap<String, Object>();
detailParams.put("contentId",contentId);
response = network.getResponse(detailParams,"/kjy/mp/content/detail");
response = network.getResponse(detailParams, UPLOAD_CONTENTDETAIL);
String sourceUrl = response.jsonPath().get("data.sourceUrl");
Assert.assertEquals(sourceUrl, network_link,"上传其他链接-中间页获取失败");
Assert.assertEquals(sourceUrl, network_link,network.message(detailParams, UPLOAD_CONTENTDETAIL,"上传其他链接-中间页获取失败"));
//上传和分享
Map<String, Object> updateParams = new HashMap<String, Object>();
updateParams.put("contentId",contentId);
updateParams.put("contentImageUrl",contentImageUrl);
response = network.postResponse(updateParams,"/kjy/mp/content/updateAndShare");
response = network.postResponse(updateParams, UPLOAD_UPDATEANDSHARE);
String shareLink = response.jsonPath().getString("data.shareLink");
Assert.assertEquals(shareLink, network_link,"传其他链接-上传和分享调用失败");
Assert.assertEquals(shareLink, network_link,network.message(updateParams, UPLOAD_UPDATEANDSHARE,"传其他链接-上传和分享调用失败"));
}
@Test(description = "上传_本地视频",priority = 5)
public void 上传_本地视频() throws IOException {
//1.上传视频到oss
Response response = network.postFileResponse("src/test/java/com/kjj/qa/resource/uploadCase.mp4","/kjy/mp/upload/video");
String videoFile = "src/test/java/com/kjj/qa/resource/uploadCase.mp4";
Response response = network.postFileResponse(videoFile, UPLOAD_UPLOADVEDIO);
String videoUrl = response.jsonPath().getString("data.videoUrl");
String firstFrameUrl = response.jsonPath().getString("data.firstFrameUrl");
Assert.assertNotNull(videoUrl,"上传本地视频-上传oss失败");
Assert.assertNotNull(videoUrl, network.message(UPLOAD_UPLOADVEDIO,"上传本地视频-上传oss失败"));
//2.开始上传视频
Map<String, Object> params = new HashMap<String, Object>();
params.put("videoUrl",videoUrl);
params.put("firstFrameUrl",firstFrameUrl);
params.put("contentTitle","=自动化测试=");
response = network.postResponse(params,"/kjy/mp/seller/upload/video");
response = network.postResponse(params, UPLOAD_SELLERUPLOADVEDIO);
String contentId = response.jsonPath().getString("data.contentId");
Assert.assertNotNull(videoUrl,"上传本地视频-上传第2步失败");
Assert.assertNotNull(videoUrl,network.message(params, UPLOAD_SELLERUPLOADVEDIO,"上传本地视频-上传第2步失败"));
}
@Test(description="大家都在转_榜单列表",priority = 6)
public void 大家都在转_榜单列表() throws IOException{
//获取文章的榜单
Response response = network.getResponse("/kjy/mp/seller/import/hot");
Response response = network.getResponse(UPLOAD_HOT);
String contentType = response.jsonPath().getString("data[0].contentType");//列表的素材类型
int length = response.jsonPath().getInt("data.size()");//列表的长度
Assert.assertEquals(contentType, "article", "获取大家都在转-文章列表内容有误");
Assert.assertEquals(length, 10, "获取大家都在转-文章列表数量有误");
Assert.assertEquals(contentType, "article", network.message(UPLOAD_HOT,"获取大家都在转-文章列表内容有误"));
Assert.assertEquals(length, 10, network.message(UPLOAD_HOT,"获取大家都在转-文章列表数量有误"));
//获取视频的榜单
response = network.getResponse("/kjy/mp/seller/import/video/hot");
response = network.getResponse(UPLOAD_VIDEOHOT);
contentType = response.jsonPath().getString("data[0].contentType");
length = response.jsonPath().getInt("data.size()");
Assert.assertEquals(contentType, "video", "获取大家都在转-视频列表内容有误");
Assert.assertEquals(length, 10, "获取大家都在转-视频列表数量有误");
Assert.assertEquals(contentType, "video", network.message(UPLOAD_VIDEOHOT,"获取大家都在转-视频列表内容有误"));
Assert.assertEquals(length, 10, network.message(UPLOAD_VIDEOHOT,"获取大家都在转-视频列表数量有误"));
}
//我的上传:
......@@ -158,41 +160,41 @@ public class Upload {
//获取文章的列表
params.put("type","article");
Response response = network.getResponse(params,"/kjy/mp/seller/import/list");
Response response = network.getResponse(params,UPLOAD_LIST);
int length = response.jsonPath().getInt("data.size()");
String contentType = response.jsonPath().getString("data[0].contentType");
Assert.assertEquals(length, 1, "获取我的上传-文章列表内容有误");
Assert.assertEquals(contentType, "article", "获取我的上传-文章列表数量有误");
Assert.assertEquals(length, 1, network.message(params, UPLOAD_LIST,"获取我的上传-文章列表内容有误"));
Assert.assertEquals(contentType, "article", network.message(params, UPLOAD_LIST,"获取我的上传-文章列表数量有误"));
//获取视频的列表
params.put("type","video");
response = network.getResponse(params,"/kjy/mp/seller/import/list");
response = network.getResponse(params, UPLOAD_LIST);
length = response.jsonPath().getInt("data.size()");
contentType = response.jsonPath().getString("data[0].contentType");
Assert.assertEquals(length, 2, "获取我的上传-视频列表内容有误");//因为有一篇抖音,一篇本地,所以数量是2
Assert.assertEquals(contentType, "video", "获取我的上传-视频列表数量有误");
Assert.assertEquals(length, 2, network.message(params, UPLOAD_LIST,"获取我的上传-视频列表内容有误"));//因为有一篇抖音,一篇本地,所以数量是2
Assert.assertEquals(contentType, "video", network.message(params, UPLOAD_LIST,"获取我的上传-视频列表数量有误"));
//获取其他的列表
params.put("type","network_link");
response = network.getResponse(params,"/kjy/mp/seller/import/list");
response = network.getResponse(params, UPLOAD_LIST);
String network_linkId = response.jsonPath().getString("data[0].id");//获取列表的第一篇素材
length = response.jsonPath().getInt("data.size()");
contentType = response.jsonPath().getString("data[0].contentType");
Assert.assertEquals(length, 1, "获取我的上传-其他列表失败");
Assert.assertEquals(contentType, "network_link", "获取我的上传-其他列表数量有误");
Assert.assertEquals(length, 1, network.message(params, UPLOAD_LIST,"获取我的上传-其他列表失败"));
Assert.assertEquals(contentType, "network_link", network.message(params, UPLOAD_LIST,"获取我的上传-其他列表数量有误"));
//删除其他列表的素材
Map<String, Object> unbindParams = new HashMap<String, Object>();
unbindParams.put("id",network_linkId);
response = network.getResponse(unbindParams,"/kjy/mp/seller/import/unbind");
response = network.getResponse(unbindParams,UPLOAD_UNBIND);
boolean data = response.jsonPath().getBoolean("data");
Assert.assertTrue(data,"删除我的上传-其他列表的素材失败");
Assert.assertTrue(data,network.message(unbindParams, UPLOAD_UNBIND,"删除我的上传-其他列表的素材失败"));
//再次获取其他的列表, 检查删除是否生效
response = network.getResponse(params,"/kjy/mp/seller/import/list");
response = network.getResponse(params, UPLOAD_LIST);
length = response.jsonPath().getInt("data.size()");
Assert.assertEquals(length, 0, "获取我的上传-其他列表数量有误");
Assert.assertEquals(length, 0, network.message(params, UPLOAD_LIST,"获取我的上传-其他列表数量有误"));
}
// @Test(description="上传视频失败重试")
......@@ -204,5 +206,9 @@ public class Upload {
// Assert.assertEquals(upload, true,"上传失败");
// }
@AfterClass
public static void tearDown(){
apiCount += 13;
}
}
\ No newline at end of file
package com.kjj.qa.config;
public class BasicConfig {
public static int apiCount; //接口数量统计
// *************** 客集集域名 ***************
public static final String HOST = "https://kjj.m.duibatest.com.cn"; // "https://kjj.m.duiba.com.cn";
// *************** TKU ***************
public static final String AGENT_TKU = "T3gM31f18jAWdsgwEXerFu4dYyoQcnhivxyRx2wA2KmB989G6CTqzhTceYm81EiUQqHQZ5r14ZefWuDZrK";
public static final String VISITOR_TKU = "T3gM31f18jAWudwfTW6o9zs27w5xMjdhLHsKVP3cHo9Aj7Q4Fg7WyEkqXiKWWdLHka1jjGseU7JpgC2UaU";
// *************** 钉钉机器人 ***************
// 线上-告警群
// public static final String DINGTALKPATH = "https://oapi.dingtalk.com/robot/send?access_token=f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2";
// 测试
public static final String DINGTALKPATH = "https://oapi.dingtalk.com/robot/send?access_token=e4b7d997fb9f90b17672dcdb9c9922d52c59f741b82081a368f4d3c305c1afcd";;
// *************** 素材ID ***************
public static final String ARTICLE_CONTENTID = "Kj21NjQ5NDM";
public static final String ANIMATION_CONTENTID = "Kj21MzgzMTk";
public static final String GAME_CONTENTID = "Kj21NjIxNTk";
public static final String UPLOAD_CONTENTID = "Kj21NjA1NTE";
// *************** 公共 ***************
public static final String VERSION_INFO = "/kjy/mp/version/info";
public static final String ISVIPSUBSCRIBE = "/kjy/mp/seller/isVipSubscribe";
public static final String USER_INFO = "/kjy/mp/user/info";
public static final String FORWARD = "/kjy/mp/forward";
public static final String GETSCID = "/kjy/mp/seller/getScId";
public static final String HASALREADYLIKE = "/kjy/mp/interaction/hasAlreadyLike";
// *************** 支付 ***************
public static final String PAY_GETMIDDLEDETAIL = "/kjy/mp/payMiddle/getMiddleDetail";
public static final String PAY_HASSITESALEVALID = "/kjy/mp/seller/dist/hasSiteSaleValid";
public static final String PAY_GETPROMOCODE = "/kjy/order/getPromoCode";
public static final String PAY_COMBOLIST = "/kjy/mp/combo/list/v2?code=";
public static final String PAY_ORDERCREATE = "/kjy/order/create";
public static final String PAY_ORDERCANCEL = "/kjy/order/cancel";
public static final String PAY_VERSIONEXCHANGE = "/kjy/mp/version/exchange";
public static final String PAY_DISTRIBUTE = "/kjy/sp/visitorPayment/distribute";
// *************** 名片 ***************
public static final String SELLERCARD_TOPOFDETAIL = "/kjy/mp/sellerCardV5/topOfDetail";
public static final String SELLERCARD_EDITBASEINFO = "/kjy/mp/sellerCard/editBaseInfo";
public static final String SELLERCARD_PERSONALPROFILE = "/kjy/mp/sellerCardV5/personalProfile";
public static final String SELLERCARD_EDITMAJORGOODAUTH = "/kjy/mp/sellerCard/editMajorGoodAuth";
public static final String SELLERCARD_APPRAISELISTNEW = "/kjy/mp/sellerCardV5/appraiseListNew";
public static final String SELLERCARD_GETQUESTIONS = "/kjy/mp/sellerCardV5/getQuestions";
public static final String SELLERCARD_ISDISPLAYACTIVITY = "/kjy/mp/clue/activity/isDisplayActivity";
public static final String SELLERCARD_COMPANYLIST = "/kjy/mp/company/list";
public static final String SELLERCARD_SELLERCARDCASENEW = "/kjy/mp/sellerCardV5/sellerCardCasesNew";
public static final String SELLERCARD_PRODUCTLIST = "/kjy/mp/sellerCardV5/productList";
public static final String SELLERCARD_GETSELLERCARDCONFIG = "/kjy/mp/sellerConfig/getSellerCardConfig";
public static final String SELLERCARD_GETSELLERCARDSTYLE = "/kjy/mp/sellerConfig/getSellerCardStyle";
public static final String SELLERCARD_TOPOFCONTENT = "/kjy/mp/sellerCardV5/topOfContent";
public static final String SELLERCARD_BOTTOMOFCONTENT = "/kjy/mp/sellerCardV5/bottomOfContent";
// *************** 上传 ***************
public static final String UPLOAD = "/kjy/mp/seller/import/upload";
public static final String UPLOAD_TASKSTATUS = "/kjy/mp/seller/import/taskStatus";
public static final String UPLOAD_CONTENTDETAIL = "/kjy/mp/content/detail";
public static final String UPLOAD_UPDATEANDSHARE = "/kjy/mp/content/updateAndShare";
public static final String UPLOAD_UPLOADVEDIO = "/kjy/mp/upload/video";
public static final String UPLOAD_SELLERUPLOADVEDIO = "/kjy/mp/seller/upload/video";
public static final String UPLOAD_HOT = "/kjy/mp/seller/import/hot";
public static final String UPLOAD_VIDEOHOT = "/kjy/mp/seller/import/video/hot";
public static final String UPLOAD_LIST = "/kjy/mp/seller/import/list";
public static final String UPLOAD_UNBIND = "/kjy/mp/seller/import/unbind";
// *************** 新手任务 ***************
public static final String NOVICE_LIST = "/kjy/mp/seller/novice/list";
public static final String NOVICE_MONGOLIANLAYERISPLAY = "/kjy/mp/seller/novice/mongolianLayerDisplay";
// *************** 谁看过我 ***************
public static final String WHOSAWME_CUSTCLUELISTV2 = "/kjy/mp/whoSawMe/custClueList/v2";
// *************** 文章 ***************
public static final String ARTICLE_H5INFO = "/kjy/mp/article/h5info";
public static final String ARTICLE_GETEXPINFO = "/kjy/mp/explosioncontent/getexpinfo";
public static final String ARTICLE_GETTAGTYPESBYCONTENTID = "/kjy/mp/explosionContent/resource/getTagTypesByContentId";
// ************** 设置中心 ***************
public static final String SELLERCONFIG_EDITCONFIG = "/kjy/mp/sellerConfig/editConfig";
}
package com.kjj.qa.utils;
import static com.kjj.qa.config.BasicConfig.*;
import java.util.HashMap;
import java.util.Map;
......@@ -10,9 +10,12 @@ public class DingTalkUtil {
//测试结果
context = "【测试结果】\n"
+ context
+ "接口数:"+ apiCount + "\n"
+ "报告地址: http://10.254.187.25/view/kjj_test/job/kejiji_interface/ws/test-output/report.html\n"
+ "@李浩弘 @张震 @别湘灵 @张艳玲 @张慧锋";
System.out.println(context);
Map<String, Object> contentParams = new HashMap<String, Object>();
contentParams.put("content",context);
......@@ -22,8 +25,8 @@ public class DingTalkUtil {
params.put("text",contentParams);
//发起dingding机器人通知
NetworkUtil network = NetworkUtil.getInstance();
network.dingTalkRobot(params);
// NetworkUtil network = NetworkUtil.getInstance();
// network.dingTalkRobot(params);
}
......
package com.kjj.qa.utils;
import static com.kjj.qa.config.BasicConfig.*;
import static io.restassured.RestAssured.*;
import static io.restassured.matcher.RestAssuredMatchers.*;
import static org.hamcrest.Matchers.*;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import com.mysql.cj.x.protobuf.MysqlxDatatypes;
import io.restassured.http.Cookies;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import javax.print.DocFlavor;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
......@@ -31,37 +25,17 @@ public class NetworkUtil {
public Map<String, Object> getFileHeaders() { return agentHeaders; }
public void setFileHeadersHeaders(Map<String, Object> fileHeaders) { this.fileHeaders = fileHeaders; }
//代理人的tku
public String agentTku = new String("T3gM31f18jAWdkgg3kyGYmYH8Vsrd5BdQJ7fpFfRikMJJQycJFXTTxtqATmEN3ECa4TnKjKvtbazYb3e3X");
public String getAgentTku() { return agentTku; }
public void setAgentTku(String agentTku) { this.agentTku = agentTku; }
//访客的tku
public String visitorTku = new String("QoEVdKqFrDvq89RmQPxDArCNwjwotBjn4sfHr62Dv8Z1A4gRH6cxqrSLJP42ywZHttE");
public String getVisitorTku() { return visitorTku; }
public void setVisitorTku(String visitorTku) { this.visitorTku = visitorTku; }
// 钉钉的 headers
public Map<String, Object> dingTalkHeaders = new HashMap<String, Object>();
public Map<String, Object> getDingTalkHeaders() { return dingTalkHeaders; }
public void setDingTalkHeaders(Map<String, Object> dingTalkHeaders) { this.dingTalkHeaders = dingTalkHeaders; }
//客集集域名
// private static String host = "https://kjj.m.duiba.com.cn"; //线上
private static String host = "https://kjj.m.duibatest.com.cn"; //测试环境
//技术告警群
private static String dingtalkPath = "https://oapi.dingtalk.com/robot/send?access_token=f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2";
//测试
// private static String dingtalkPath = "https://oapi.dingtalk.com/robot/send?access_token=e4b7d997fb9f90b17672dcdb9c9922d52c59f741b82081a368f4d3c305c1afcd";
private volatile static NetworkUtil network;
// 构造函数 初始化tku、content-type
private NetworkUtil (){
//cookies中的tku
agentCookies.put("tku",this.agentTku);
agentCookies.put("tku",AGENT_TKU);
//json类型的headers
agentHeaders.put("Content-Type","application/json");
//二进制文件的headers
......@@ -91,7 +65,7 @@ public class NetworkUtil {
return given()
.cookies(agentCookies)
.headers(agentHeaders)
.get(host+path);
.get(HOST + path);
}
// get 带参请求
......@@ -100,7 +74,7 @@ public class NetworkUtil {
.cookies(agentCookies)
.headers(agentHeaders)
.params(params)
.get(host + path);
.get(HOST + path);
}
// post 不帶参请求
......@@ -108,7 +82,7 @@ public class NetworkUtil {
return given()
.cookies(agentCookies)
.headers(agentHeaders)
.post(host + path);
.post(HOST + path);
}
// post 带参请求
......@@ -118,7 +92,7 @@ public class NetworkUtil {
.cookies(agentCookies)
.headers(agentHeaders)
.body(jsonStr)
.post(host + path);
.post(HOST + path);
}
// post 文件上传
......@@ -126,8 +100,8 @@ public class NetworkUtil {
return given()
.cookies(agentCookies)
.headers(fileHeaders)
.multiPart("file",new File(filePath))
.post(host + path);
.multiPart("file",new File(filePath))
.post(HOST + path);
}
......@@ -138,13 +112,25 @@ public class NetworkUtil {
return given()
.headers(dingTalkHeaders)
.body(jsonStr)
.post(dingtalkPath);
.post(DINGTALKPATH);
}
//带参的接口信息
public String message(Map<String, Object> params, String path, String errorMessage){
return "\n" + "path: " + path +
"\n" + "params: " + params +
"\n" + "message: " + errorMessage;
}
//不带参的接口信息
public String message(String path, String errorMessage){
return "\n" + "path: " + path +
"\n" + "message: " + errorMessage;
}
public static void main(String[] args) {
NetworkUtil network = NetworkUtil.getInstance();
System.out.println(network.agentTku);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="客集集-测试结果" verbose="1" thread-count="3">
<!-- <test preserve-order="true" name="首页" >-->
<!-- <classes>-->
<!-- <class name="com.kjj.qa.cases.Home"/>-->
<!-- </classes>-->
<!-- </test>-->
<test preserve-order="true" name="支付" >
<!-- <test preserve-order="true" name="首页" >-->
<!-- <classes>-->
<!-- <class name="com.kjj.qa.cases.Home"/>-->
<!-- </classes>-->
<!-- </test>-->
<test preserve-order="true" name="支付">
<classes>
<class name="com.kjj.qa.cases.Pay"/>
</classes>
</test>
<test preserve-order="true" name="名片" >
<test preserve-order="true" name="名片">
<classes>
<class name="com.kjj.qa.cases.SellerCard"/>
</classes>
</test>
<!-- <test preserve-order="true" name="上传" >-->
<!-- <classes>-->
<!-- <class name="com.kjj.qa.cases.Upload"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="新手任务" >-->
<!-- <classes>-->
<!-- <class name="com.kjj.qa.cases.NewTask"/>-->
<!-- </classes>-->
<!-- </test>-->
<test preserve-order="true" name="上传">
<classes>
<class name="com.kjj.qa.cases.Upload"/>
</classes>
</test>
<test preserve-order="true" name="新手任务">
<classes>
<class name="com.kjj.qa.cases.Novice"/>
</classes>
</test>
<!-- 监听器-->
<listeners>
<listener class-name="com.kjj.qa.config.ExtentTestNGIReporterListener"/>
......
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