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

修改报告地址、tku

parent 3a0c5457
...@@ -38,9 +38,9 @@ public class Boss { ...@@ -38,9 +38,9 @@ public class Boss {
public void 会员及版本判断() throws IOException{ public void 会员及版本判断() throws IOException{
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");//判断是否为会员
Assert.assertEquals(userVersion, 2,network.message(BOSS_VERSIONINFO,"获取版本有误 此版本为非保险版",response.body().asString())); Assert.assertEquals(userVersion, 2,network.message(BOSS_VERSIONINFO,"获取版本有误 此版本为非保险版",response.body().asString()));
Assert.assertTrue(isVip,network.message(BOSS_VERSIONINFO,"会员判断错误 为非会员",response.body().asString())); // boolean isVip = response.jsonPath().getBoolean("data.find {it.openType == 1}.vip");//判断是否为会员
// Assert.assertTrue(isVip,network.message(BOSS_VERSIONINFO,"会员判断错误 为非会员",response.body().asString()));
} }
//获取info接口的代理人id //获取info接口的代理人id
......
...@@ -116,7 +116,6 @@ public class GreetingCard { ...@@ -116,7 +116,6 @@ public class GreetingCard {
Assert.assertFalse(hasList,network.message(params,GREETING_CONFLIST,"获取我的贺卡初始列表数量有误",response.body().asString())); Assert.assertFalse(hasList,network.message(params,GREETING_CONFLIST,"获取我的贺卡初始列表数量有误",response.body().asString()));
} }
@AfterClass @AfterClass
public static void tearDown(){ public static void tearDown(){
apiCount += 8; apiCount += 8;
......
...@@ -94,35 +94,7 @@ public class Pay { ...@@ -94,35 +94,7 @@ public class Pay {
Assert.assertEquals(result,"OK",network.message(cancelParams, PAY_ORDERCANCEL,"取消支付:取消支付失败",response.body().asString())); //判断返回的微信调起参数中appId是否正确 Assert.assertEquals(result,"OK",network.message(cancelParams, PAY_ORDERCANCEL,"取消支付:取消支付失败",response.body().asString())); //判断返回的微信调起参数中appId是否正确
} }
@Test (description = "默认付费_微信支付后回调",priority = 4) @Test (description = "默认付费_切换会员类型为保险版",priority = 4)
public void 默认付费_微信支付后回调() throws IOException {
//创建支付
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("userVersion",1);
payParams.put("comboId","Kj21MTU");
payParams.put("oaId","1");
payParams.put("paySource","2");
payParams.put("sellerFrom","");
Response response = network.postResponse(payParams,PAY_ORDERCREATE);
String tradeNo = response.jsonPath().getString("data.tradeNo");
// mock微信回调成功
Map<String, Object> callbackParams = new HashMap<String, Object>();
callbackParams.put("tradeNo",tradeNo);
callbackParams.put("payTradeNo","test");
callbackParams.put("payResult",true);
response = network.getResponse(callbackParams,PAY_CALLOUT);
boolean result = response.jsonPath().getBoolean("data");
Assert.assertTrue(result,network.message(callbackParams,PAY_CALLOUT,"微信支付回调成功,但我们订单处理失败",response.body().asString()));
// mock微信回调失败
callbackParams.put("payResult",false);
response = network.getResponse(callbackParams,PAY_CALLOUT);
result = response.jsonPath().getBoolean("data");
Assert.assertTrue(result,network.message(callbackParams,PAY_CALLOUT,"微信支付回调失败,但我们订单处理也失败",response.body().asString()));
}
@Test (description = "默认付费_切换会员类型为保险版",priority = 5)
public void 默认付费_切换为保险版会员类型() throws IOException { public void 默认付费_切换为保险版会员类型() throws IOException {
//会员类型版本判断 //会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
...@@ -131,7 +103,6 @@ public class Pay { ...@@ -131,7 +103,6 @@ public class Pay {
int userVersion = response.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);
...@@ -146,18 +117,41 @@ public class Pay { ...@@ -146,18 +117,41 @@ public class Pay {
Assert.assertEquals(userVersion,changeVersion,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为尊享版",response.body().asString())); Assert.assertEquals(userVersion,changeVersion,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为尊享版",response.body().asString()));
} }
/*// 支付成功回调 @Test (description = "默认付费_微信支付后回调",priority = 5)
@Test (description = "默认付费_支付成功回调",priority = 6) public void 默认付费_微信支付后回调() throws IOException {
public void 默认付费_支付成功回调() throws IOException { //创建支付
Map<String, Object> payParams = new HashMap<String, Object>();
payParams.put("userVersion",1);
payParams.put("comboId","Kj21MTU");
payParams.put("oaId","1");
payParams.put("paySource","2");
payParams.put("sellerFrom","");
Response response = network.postResponse(payParams,PAY_ORDERCREATE);
String tradeNo = response.jsonPath().getString("data.tradeNo");
// mock微信回调失败
Map<String, Object> callbackParams = new HashMap<String, Object>();
callbackParams.put("tradeNo",tradeNo);
callbackParams.put("payTradeNo","test");
callbackParams.put("payResult",false);
response = network.getResponse(callbackParams,PAY_CALLOUT);
boolean result = response.jsonPath().getBoolean("data");
Assert.assertTrue(result,network.message(callbackParams,PAY_CALLOUT,"mock微信支付回调失败,但我们订单处理也失败",response.body().asString()));
// mock微信回调成功
callbackParams.put("payResult",true);
response = network.getResponse(callbackParams,PAY_CALLOUT);
result = response.jsonPath().getBoolean("data");
Assert.assertTrue(result,network.message(callbackParams,PAY_CALLOUT,"mock微信支付回调成功,但我们订单处理失败",response.body().asString()));
}
}*/
@AfterClass @AfterClass
public static void tearDown() throws IOException, InterruptedException { public static void tearDown() throws IOException, InterruptedException {
apiCount += 7; apiCount += 7;
// 切换为保险版vip // 切换为保险版vip
ManagerUtil.switchvip(); // ManagerUtil.switchvip();
//延迟2秒 //延迟2秒
Thread.sleep(2000); Thread.sleep(2000);
......
...@@ -10,8 +10,10 @@ public class BasicConfig { ...@@ -10,8 +10,10 @@ public class BasicConfig {
// 用户微信昵称 // 用户微信昵称
public static final String WECHAT_NAME = "小疙瘩人寿"; //true public static final String WECHAT_NAME = "小疙瘩人寿"; //true
// 用户tku // 用户tku
public static final String AGENT_TKU = "T3gM31f18jAWCfbjiyPds6LuAsfydVKRb9m3WoUoTqb1Qh8ktrwxtwja7msr2m4LkCm6nJ6CCoHTtzT7Lr"; public static final String AGENT_TKU = "T3gM31f18jAWCfZp1kutcdwvn2GBWnjyDp7LueJfX3YbNifexxBgXmBrd8AUCxJDDCLYZKF9waTJpTqDpK";
// 小疙瘩的openid
public static final String OPEN_ID = "osi5w5ucTy5jRR0zw7hLNJm1S3xY";
// *************** 钉钉机器人 *************** // *************** 钉钉机器人 ***************
// 线上-告警群 // 线上-告警群
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=f63c9cb36e89dd68e9af82d926933b3afc6544e57b23a3a55ed5b3b772d5e8d2";
...@@ -240,6 +242,7 @@ public class BasicConfig { ...@@ -240,6 +242,7 @@ public class BasicConfig {
public static final String GREETING_SAVEDEFAULT = ACTIVITY_HOST + "/kjy/mp/greeting/conf/saveDefault"; public static final String GREETING_SAVEDEFAULT = ACTIVITY_HOST + "/kjy/mp/greeting/conf/saveDefault";
// *************** 管理后台 *************** // *************** 管理后台 ***************
public static final String SSO_DOLOGIN = SSO_HOST + "/doLogin"; public static final String SSO_DOLOGIN = SSO_HOST + "/doLogin";
public static final String MANAGER_CHANGECOMPANY = MANAGER_HOST + "/kjy/manager/seller/changeCompany"; public static final String MANAGER_CHANGECOMPANY = MANAGER_HOST + "/kjy/manager/seller/changeCompany";
...@@ -250,4 +253,9 @@ public class BasicConfig { ...@@ -250,4 +253,9 @@ public class BasicConfig {
public static final String MANAGER_ADMININFO = MANAGER_HOST + "/kjy/manager/admin/info"; public static final String MANAGER_ADMININFO = MANAGER_HOST + "/kjy/manager/admin/info";
public static final String MANAGER_PROMOTIONCODELIST = MANAGER_HOST + "/kjy/manager/promotionCode/codeList";
public static final String MANAGER_PROMOTIONBATCHMODIFY = MANAGER_HOST + "/kjy/manager/promotionCode/batchModify";
public static final String MANAGER_PROMOTIONCODEBATCHDETAIL = MANAGER_HOST + "/kjy/manager/promotionCode/batchDetail";
} }
...@@ -11,7 +11,7 @@ public class DingTalkUtil { ...@@ -11,7 +11,7 @@ public class DingTalkUtil {
context = "【测试结果】\n" context = "【测试结果】\n"
+ context + context
+ "总接口数:"+ apiCount + "\n" + "总接口数:"+ apiCount + "\n"
+ "报告地址: http://10.254.135.250/view/kjj_test/job/kejiji_interface/HTML_20Report\n" + "报告地址: http://10.172.58.199/view/kkk/job/kejiji_interface/HTML_20Report\n"
+ "@李浩弘 @张震 @别湘灵 @张艳玲 @张慧锋"; + "@李浩弘 @张震 @别湘灵 @张艳玲 @张慧锋";
System.out.println(context); System.out.println(context);
......
...@@ -17,6 +17,7 @@ import static io.restassured.RestAssured.given; ...@@ -17,6 +17,7 @@ import static io.restassured.RestAssured.given;
public class ManagerUtil { public class ManagerUtil {
private static final NetworkUtil network = NetworkUtil.getInstance(); private static final NetworkUtil network = NetworkUtil.getInstance();
private static int PROMOTION_CODE = 398;
// 登录管理后台 // 登录管理后台
public static void ssoLogin(){ public static void ssoLogin(){
...@@ -24,7 +25,7 @@ public class ManagerUtil { ...@@ -24,7 +25,7 @@ public class ManagerUtil {
// 请求下后台的管理员信息接口 // 请求下后台的管理员信息接口
Response response = network.getResponse(MANAGER_ADMININFO); Response response = network.getResponse(MANAGER_ADMININFO);
String actualType = "application/json;charset=UTF-8"; String actualType = "application/json;charset=UTF-8";
String exceptType = response.headers().getValue("Content-Type"); String exceptType = response.headers().getValue("Content-Type"); //如果返回的是html的contentType,说明token已经失效
// 判断请求接口后 后台的Csrf-Token是否失效,若两个值相等则有效,反之 // 判断请求接口后 后台的Csrf-Token是否失效,若两个值相等则有效,反之
if (actualType.equals(exceptType)){ if (actualType.equals(exceptType)){
...@@ -109,10 +110,69 @@ public class ManagerUtil { ...@@ -109,10 +110,69 @@ public class ManagerUtil {
network.agentCookies.remove("csrf_token"); network.agentCookies.remove("csrf_token");
} }
// 拿优惠码
public static void getPromotionCode() {
// 登录下,检验是否失效
ssoLogin();
// 获取优惠码详情
Map<String, Object> params = new HashMap<String, Object>();
params.put("id",PROMOTION_CODE);
Response response = network.getResponse(params,MANAGER_PROMOTIONCODEBATCHDETAIL);
long deadline = response.jsonPath().getLong("data.deadline");
deadline = (deadline - System.currentTimeMillis()) / (1000*60*60*24); //到期时间
// 修改截止日期
if (deadline < 5)
{
modifyPromotionCode(0);
}
// 获取未使用的code列表
Map<String, Object> listParams = new HashMap<String, Object>();
listParams.put("batchId",PROMOTION_CODE);
listParams.put("promotionCodeStatus",0); //0 未使用
listParams.put("pageIndex",1);
listParams.put("pageSize",20);
response = network.getResponse(listParams,MANAGER_PROMOTIONCODELIST);
int unUseCount = response.jsonPath().getInt("data.list.size()");
// 未使用数量 < 5
if (unUseCount < 5)
{
modifyPromotionCode(100);
}
}
public static void modifyPromotionCode(int addNum){
Map<String, Object> params = new HashMap<String, Object>();
params.put("startTime",System.currentTimeMillis());
params.put("deadline",System.currentTimeMillis() + 1000*60*60*24*30L);
params.put("addNum",addNum);
params.put("city","杭州");
params.put("codeTotal",200);
params.put("comboId","1");
params.put("companyId",82);
params.put("id",398);
params.put("price","3860000.00");
params.put("province",null);
params.put("remark","接口自动化测试");
params.put("userVersion",2);
Response response = network.postResponse(params,MANAGER_PROMOTIONBATCHMODIFY);
response.body().prettyPrint();
}
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
// switchInsider(1); getPromotionCode();
// switchvip();
} }
} }
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