Commit 98d4dc16 authored by 吕雯燕's avatar 吕雯燕

Merge branch 'duiba_wenyan' into develop

parents a1271345 943253c7
...@@ -13,4 +13,5 @@ public class Database { ...@@ -13,4 +13,5 @@ public class Database {
public static String orders6 = "orders_0210"; public static String orders6 = "orders_0210";
public static String orders7 = "orders_0211"; public static String orders7 = "orders_0211";
public static String orders8 = "orders_0090"; public static String orders8 = "orders_0090";
public static String orders9 = "orders_0203";
} }
...@@ -80,6 +80,7 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem ...@@ -80,6 +80,7 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
new Object[]{3, "171481", "29540", "yrJRr7Cddp2YeQd", "优惠券日期兑换限制已结束"}, //case2 new Object[]{3, "171481", "29540", "yrJRr7Cddp2YeQd", "优惠券日期兑换限制已结束"}, //case2
}; };
} }
if (method.getName().equals("优惠券库存不足测试")) { if (method.getName().equals("优惠券库存不足测试")) {
result = new Object[][]{ result = new Object[][]{
new Object[]{"169775", "29180", "yrJRr7Cddp2YeQd", "优惠券商品库存不足测试"}, //case1 new Object[]{"169775", "29180", "yrJRr7Cddp2YeQd", "优惠券商品库存不足测试"}, //case1
...@@ -300,11 +301,12 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem ...@@ -300,11 +301,12 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
} }
@Test @Test(description = "兑吧优惠券审核通过测试")
public void 优惠券审核通过测试() throws Exception{ public void 优惠券审核通过测试() throws Exception{
String appItemId = "169698"; int uid = 6569;
String itemId = "29156"; String appItemId = "191878";
String itemId = "32383";
// //查询兑换前的开发者余额 // //查询兑换前的开发者余额
// Response accountResponse = developerAccountService.accountInfo(); // Response accountResponse = developerAccountService.accountInfo();
...@@ -317,15 +319,17 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem ...@@ -317,15 +319,17 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
logger.info("订单号:" + orderId); logger.info("订单号:" + orderId);
//订单审核,判断是否在待审核节点 //订单审核,判断是否在待审核节点
Map<String,Object> mapOrder = jdbc.findSimpleResult("SELECT * FROM "+Database.orders_consumer+"."+Database.orders4+" WHERE id = " + orderId); Map<String,Object> mapOrder = jdbc.findSimpleResult("SELECT * FROM "+Database.orders_consumer+"."+Database.orders9+" WHERE id = " + orderId);
String flowWork = String.valueOf(mapOrder.get("flowwork_stage")); String flowWork = String.valueOf(mapOrder.get("flowwork_stage"));
logger.info("数据库订单节点:" + flowWork); logger.info("数据库订单节点:" + flowWork);
Assert.assertEquals(flowWork,"Audit-started","校验数据库订单节点失败");
String orderIdmain = String.valueOf(mapOrder.get("order_num")); String orderIdmain = String.valueOf(mapOrder.get("order_num"));
logger.info("兑吧订单号为:" + orderIdmain); logger.info("兑吧订单号为:" + orderIdmain);
int i =10; int i =10;
while (i > 0 && !flowWork.equals("Audit-started")) { while (i > 0 && !flowWork.equals("Audit-started")) {
Thread.sleep(300); Thread.sleep(300);
mapOrder = jdbc.findSimpleResult("SELECT * FROM "+Database.orders_consumer+"."+Database.orders4+" WHERE id = " + orderId); mapOrder = jdbc.findSimpleResult("SELECT * FROM "+Database.orders_consumer+"."+Database.orders9+" WHERE id = " + orderId);
flowWork = String.valueOf(mapOrder.get("flowwork_stage")); flowWork = String.valueOf(mapOrder.get("flowwork_stage"));
logger.info("数据库订单节点:" + flowWork); logger.info("数据库订单节点:" + flowWork);
i--; i--;
...@@ -338,8 +342,8 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem ...@@ -338,8 +342,8 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
int j =10; int j =10;
while (j > 0 && !flowWork.equals("Success-complete")) { while (j > 0 && !flowWork.equals("Success-complete")) {
Thread.sleep(1000); Thread.sleep(1000);
auditResponse = dsOrderService.submitAudit(orderId,"pass"); auditResponse = dsOrderService.submitAudit("22542",orderId,"pass",authorization.hdLoginCommonNew("15833333333"));
mapOrder = jdbc.findSimpleResult("SELECT * FROM "+Database.orders_consumer+"."+Database.orders4+" WHERE id = " + orderId); mapOrder = jdbc.findSimpleResult("SELECT * FROM "+Database.orders_consumer+"."+Database.orders9+" WHERE id = " + orderId);
flowWork = String.valueOf(mapOrder.get("flowwork_stage")); flowWork = String.valueOf(mapOrder.get("flowwork_stage"));
logger.info("数据库订单节点:" + flowWork); logger.info("数据库订单节点:" + flowWork);
j--; j--;
...@@ -349,7 +353,7 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem ...@@ -349,7 +353,7 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
Assert.assertEquals(status,"success","订单状态校验失败"); Assert.assertEquals(status,"success","订单状态校验失败");
//校验开发者账户余额变动 //校验开发者账户余额变动
Response accountResponse = developerAccountService.cashDetail(orderIdmain); Response accountResponse = developerAccountService.cashDetail(authorization.hdLoginCommonNew("15833333333"),orderIdmain);
String remainMoney = String.valueOf(Integer.valueOf(accountResponse.jsonPath().getString("data.list[0].balance"))+Integer.valueOf(accountResponse.jsonPath().getString("data.list[0].moneyChange"))); String remainMoney = String.valueOf(Integer.valueOf(accountResponse.jsonPath().getString("data.list[0].balance"))+Integer.valueOf(accountResponse.jsonPath().getString("data.list[0].moneyChange")));
logger.info("兑换前的开发者账户余额:" + remainMoney); logger.info("兑换前的开发者账户余额:" + remainMoney);
remainMoney =String.valueOf(Integer.valueOf(remainMoney) - 1000) ; remainMoney =String.valueOf(Integer.valueOf(remainMoney) - 1000) ;
...@@ -744,16 +748,16 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem ...@@ -744,16 +748,16 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
} }
@Test @Test(description = "兑吧优惠券会员等级测试")
public void 会员等级测试()throws Exception{ public void 会员等级测试()throws Exception{
String appItemId = "191778"; String appItemId = "191876";
String itemId = "32374"; String itemId = "32382";
String message = ""; String message = "";
//会员等级无法兑换 //会员等级无法兑换
try{ try{
Response response = couponExchangeService.objectExchange(authorization.dafuwengLogin(uid), appItemId, itemId, "null", "yrJRr7Cddp2YeQd", "null"); Response response = couponExchangeService.couponExchange(authorization.dafuwengLogin(uid),appItemId,itemId);
response.prettyPrint(); response.prettyPrint();
}catch (Exception e){ }catch (Exception e){
...@@ -762,13 +766,14 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem ...@@ -762,13 +766,14 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
logger.info(message); logger.info(message);
//会员等级可兑换,vip=5 //会员等级可兑换,vip=5
Response response = couponExchangeService.objectExchange(authorization.generateSignAutoLogin("2wGQc3MZaQsqYFWcX4gguya5PnnS",3402),appItemId,itemId,"null","yrJRr7Cddp2YeQd","null"); Response response = couponExchangeService.couponExchange(authorization.generateSignAutoLogin("2wGQc3MZaQsqYFWcX4gguya5PnnS",3402),appItemId,itemId);
response.prettyPrint(); response.prettyPrint();
Assert.assertTrue(message.contains("会员等级不符,请挑选其他吧(15)"),"校验message失败"); Assert.assertTrue(message.contains("会员等级不符,请挑选其他吧(15)"),"校验message失败");
Assert.assertTrue(message.contains("\"success\":false"),"校验success失败"); Assert.assertTrue(message.contains("\"success\":false"),"校验success失败");
Assert.assertEquals(response.jsonPath().getString("success"),"true","校验兑换结果失败"); Assert.assertEquals(response.jsonPath().getString("success"),"true","校验兑换结果失败");
logger.info("校验实物会员等级成功"); logger.info("校验兑吧优惠券会员等级成功");
} }
......
...@@ -255,7 +255,8 @@ public class 开发者账户余额校验测试_ExchangeTest extends CheckTemplet ...@@ -255,7 +255,8 @@ public class 开发者账户余额校验测试_ExchangeTest extends CheckTemplet
* @param caseName 用例名称打印 * @param caseName 用例名称打印
* @throws Exception * @throws Exception
*/ */
@Test(dataProvider = "providerMethod") //已经在优惠券兑换流程中覆盖
// @Test(dataProvider = "providerMethod")
public void 优惠券兑换审核通过测试(int caseNum, String appItemId, String itemId, String caseName) throws Exception{ public void 优惠券兑换审核通过测试(int caseNum, String appItemId, String itemId, String caseName) throws Exception{
// int uid = 3768; // int uid = 3768;
logger.info(caseName); logger.info(caseName);
......
...@@ -4,6 +4,7 @@ package http.service.hd; ...@@ -4,6 +4,7 @@ package http.service.hd;
import base.DuibaLog; import base.DuibaLog;
import http.service.Authorization; import http.service.Authorization;
import io.restassured.http.Cookies;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -89,4 +90,27 @@ public class DeveloperAccountService { ...@@ -89,4 +90,27 @@ public class DeveloperAccountService {
return response; return response;
} }
//根据订单号查询开发者账户记录
public Response cashDetail(Map cookies, String orderId) throws Exception {
String url = hdHost + "/developerAccount/cashDetail";
logger.info("请求cashDetail开发者后台账户记录信息接口");
Map<String,String> map = new HashMap<>();
map.put("mode","two");
map.put("orderId",orderId);
map.put("rowId","1");
Response response=given().cookies(cookies).params(map).get("http://"+url);
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/developerAccount/cashDetail接口失败");
}catch(Exception e){
throw new Exception("/developerAccount/cashDetail接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/developerAccount/cashDetail接口失败,返回信息:"+response.asString());
}
return response;
}
} }
...@@ -73,4 +73,26 @@ public class DsOrderService { ...@@ -73,4 +73,26 @@ public class DsOrderService {
return response; return response;
} }
public Response submitAudit(String appId,String idArray,String audit,Map cookies) throws Exception{
String url = hdHost + "/dsOrder/submitAudit";
Map<String,String> map = new HashMap<>();
map.put("appId",appId);
map.put("idArray",idArray);
map.put("audit",audit);
map.put("reason","测试订单审核不通过");
logger.info("请求订单审核接口:" + url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(cookies).params(map).post("http://"+url);
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("请求订单审核接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("请求订单审核接口失败,返回信息:"+response.asString());
}
return response;
}
} }
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