Commit 0607fdbd authored by 吕雯燕's avatar 吕雯燕

Merge branch 'master' of gitlab2.dui88.com:mabo/test-platform

parents 22d3525f a2fef856
...@@ -222,7 +222,7 @@ public class 扣库存测试_DuibaTest extends DuibaTestBase { ...@@ -222,7 +222,7 @@ public class 扣库存测试_DuibaTest extends DuibaTestBase {
@Test @Test
public void 自有活动工具扣库存测试() throws Exception { public void 自有活动工具扣库存测试() throws Exception {
//获取兑换项库存 //获取兑换项库存
Response response = developerService.appItems("2239","【自动化勿动】自有优惠券"); Response response = developerService.appItems("2239","【自动化勿动】zr自有优惠券");
//response.prettyPrint(); //response.prettyPrint();
String remind = response.jsonPath().getString("data.list[0].remaind"); String remind = response.jsonPath().getString("data.list[0].remaind");
logger.info("抽奖前兑换项库存为:"+remind); logger.info("抽奖前兑换项库存为:"+remind);
...@@ -240,18 +240,18 @@ public class 扣库存测试_DuibaTest extends DuibaTestBase { ...@@ -240,18 +240,18 @@ public class 扣库存测试_DuibaTest extends DuibaTestBase {
response = this.新活动工具接口传参("28247","abcde","iOS"); response = this.新活动工具接口传参("28247","abcde","iOS");
Assert.assertEquals(response.jsonPath().getString("lottery.type"),"coupon","校验type失败"); Assert.assertEquals(response.jsonPath().getString("lottery.type"),"coupon","校验type失败");
Assert.assertEquals(response.jsonPath().getString("lottery.title"),"【自动化勿动】自有优惠券","校验title失败"); Assert.assertEquals(response.jsonPath().getString("lottery.title"),"【自动化勿动】zr自有优惠券","校验title失败");
Assert.assertTrue(response.jsonPath().getString("lottery.link").contains("/crecord/recordDetailNew?orderId=")); Assert.assertTrue(response.jsonPath().getString("lottery.link").contains("/crecord/recordDetailNew?orderId="));
Assert.assertEquals(response.jsonPath().getString("lottery.id"), "16405", "校验id失败"); Assert.assertEquals(response.jsonPath().getString("lottery.id"), "16405", "校验id失败");
logger.info("校验实物商品:type,title,link,id成功"); logger.info("校验实物商品:type,title,link,id成功");
//校验兑换项库存 //校验兑换项库存
response = developerService.appItems("2239","【自动化勿动】自有优惠券"); response = developerService.appItems("2239","【自动化勿动】zr自有优惠券");
String Newremind = response.jsonPath().getString("data.list[0].remaind"); String Newremind = response.jsonPath().getString("data.list[0].remaind");
int i= 10; int i= 10;
while(i>0 && !Newremind.equals(remind)){ while(i>0 && !Newremind.equals(remind)){
Thread.sleep(500); Thread.sleep(500);
response = developerService.appItems("2239","【自动化勿动】自有优惠券"); response = developerService.appItems("2239","【自动化勿动】zr自有优惠券");
Newremind = response.jsonPath().getString("data.list[0].remaind"); Newremind = response.jsonPath().getString("data.list[0].remaind");
i--; i--;
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* FileName: 瓜分积分测试_AccessTest * FileName: 瓜分积分测试_AccessTest
* Author: zhaoran * Author: zhaoran
* Date: 2018/12/10 19:45 * Date: 2018/12/10 19:45
* AppId: 21827
* Description: * Description:
*/ */
package http.cases.PkMoudleTest; package http.cases.PkMoudleTest;
...@@ -198,6 +199,7 @@ public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase { ...@@ -198,6 +199,7 @@ public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"4","中奖弹窗类型校验失败"); Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"4","中奖弹窗类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败"); Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.unitName"),"金币","积分单位校验失败");
Response response2 = pkService.popup(uid3); Response response2 = pkService.popup(uid3);
response.prettyPrint(); response.prettyPrint();
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* FileName: 瓜分积分测试_AccessTest * FileName: 瓜分积分测试_AccessTest
* Author: zhaoran * Author: zhaoran
* Date: 2018/12/10 19:45 * Date: 2018/12/10 19:45
* Description: * Description: appId 21832
*/ */
package http.cases.PkMoudleTest; package http.cases.PkMoudleTest;
...@@ -204,6 +204,7 @@ public class 瓜分积分_实际瓜分_主胜方_AccessTest extends DuibaTestBas ...@@ -204,6 +204,7 @@ public class 瓜分积分_实际瓜分_主胜方_AccessTest extends DuibaTestBas
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"4","中奖弹窗类型校验失败"); Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"4","中奖弹窗类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败"); Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.unitName"),"金币","积分单位校验失败");
Response response2 = pkService.popup(uid1); Response response2 = pkService.popup(uid1);
response.prettyPrint(); response.prettyPrint();
......
package http.cases.WalletTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.GlobalRewardService;
import http.service.Activity.SeedRedPacketService;
import http.service.Activity.WalletAccountService;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import utils.HbaseService;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;
import static io.restassured.RestAssured.given;
/**
* Created by 赵然 on 2019/04/04
* AppId: 22565
*/
public class 总帐户提现页校验_AccessTest extends DuibaTestBase{
@Value("${activity.host}")
String activityHost;
@Autowired
SeedRedPacketService seedRedPacketService;
@Autowired
WalletAccountService walletAccountService;
@Autowired
GlobalRewardService globalRewardService;
@Autowired
Authorization authorization;
@Autowired
HbaseService hbaseService;
private DuibaLog logger = DuibaLog.getLogger();
//指定用户
private static int uid = 7112;
private static String consumerId = "100145034";
@Test
public void 提现页校验() throws Exception {
Response response = globalRewardService.toWithdraw(uid);
response.print();
String expireTime = response.jsonPath().getString("data.expireTime");
String perLimitAmount = response.jsonPath().getString("data.perLimitAmount");
String periodOpen = response.jsonPath().getString("data.periodOpen");
Assert.assertEquals(expireTime,"2021/01/31 00:00:00","提现页过期时间校验失败");
Assert.assertEquals(perLimitAmount,"2000","提现页满额提现金额校验失败");
Assert.assertEquals(periodOpen,"true","总帐户状态校验失败");
logger.info("总帐户提现页校验成功!");
}
@Test
public void 后台红包周期校验() throws Exception {
Response response = globalRewardService.periodList("18157163293","22565","2");
response.print();
String bonusLimit = response.jsonPath().getString("data[0].bonusLimit");
String forConfirm = response.jsonPath().getString("data[0].forConfirm");
String periodStatus = response.jsonPath().getString("data[0].periodStatus");
String withdrawThreshold = response.jsonPath().getString("data[0].withdrawThreshold");
String relType = response.jsonPath().getString("data[0].relList[0].relType");
String relTypeName = response.jsonPath().getString("data[0].relList[0].relTypeName");
Assert.assertEquals(bonusLimit,"40000","红包预算校验失败");
Assert.assertEquals(forConfirm,"false","确认按钮校验失败");
Assert.assertEquals(periodStatus,"OPEN","总帐户状态校验失败");
Assert.assertEquals(withdrawThreshold,"2000","用户提现限制校验失败");
Assert.assertEquals(relType,"PK","关联活动类型校验失败");
Assert.assertEquals(relTypeName,"组件pk","关联活动名称校验失败");
response = globalRewardService.periodCount("18157163293","22565","2");
Assert.assertEquals(response.jsonPath().getString("data"),"1","周期个数校验失败");
}
}
...@@ -24,8 +24,9 @@ import static io.restassured.RestAssured.given; ...@@ -24,8 +24,9 @@ import static io.restassured.RestAssured.given;
/** /**
* Created by 赵然 on 2019/03/29 * Created by 赵然 on 2019/03/29
* AppId: 22565
*/ */
public class 总帐户账户正常提现 extends DuibaTestBase{ public class 总帐户账户正常提现_AccessTest extends DuibaTestBase{
@Value("${activity.host}") @Value("${activity.host}")
String activityHost; String activityHost;
@Autowired @Autowired
......
...@@ -23,30 +23,10 @@ public class GlobalRewardService { ...@@ -23,30 +23,10 @@ public class GlobalRewardService {
Authorization authorization; Authorization authorization;
@Value("${activity.host}") @Value("${activity.host}")
String activityHost; String activityHost;
@Value("${hdserver.host}")
String hdHost;
private DuibaLog logger = DuibaLog.getLogger(); private DuibaLog logger = DuibaLog.getLogger();
/**
* 获取红包账户
* @param cookies
* @return
* @throws Exception
*/
public Response getWalletAccount(Map cookies) throws Exception {
logger.info("请求getWalletAccount");
Response response = given().cookies(cookies).get(activityHost+"/walletAccount/getWalletAccount");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/getWalletAccount接口失败");
}catch(Exception e){
throw new Exception("/walletAccount/getWalletAccount接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/walletAccount/getWalletAccount接口失败,返回信息:"+response.asString());
}
return response;
}
/** /**
* 红包账户提现 * 红包账户提现
* @param cookies * @param cookies
...@@ -77,92 +57,76 @@ public class GlobalRewardService { ...@@ -77,92 +57,76 @@ public class GlobalRewardService {
} }
/** /**
* 红包账户提现 * 红包账户提现页
* @param cookies * @param uid
* @param orderId
* @return * @return
* @throws Exception * @throws Exception
*/ */
public Response getOrderStatus(Map cookies,String orderId) throws Exception { public Response toWithdraw(int uid) throws Exception {
logger.info("请求getOrderStatus"); logger.info("请求toWithdraw");
Map<String,String> map = new HashMap<>();
map.put("orderId",orderId);
Response response = given().cookies(cookies).params(map).post(activityHost+"/walletAccount/getOrderStatus"); Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).get(activityHost+"/globalReward/toWithdraw");
try{ try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/getOrderStatus接口失败"); Assert.assertEquals(response.jsonPath().getString("success"),"true","/globalReward/toWithdraw接口失败");
}catch(Exception e){ }catch(Exception e){
throw new Exception("/walletAccount/getOrderStatus接口失败,返回信息:"+response.asString()); throw new Exception("/globalReward/toWithdraw接口失败,返回信息:"+response.asString());
}catch(Error er){ }catch(Error er){
throw new Exception("/walletAccount/getOrderStatus接口失败,返回信息:"+response.asString()); throw new Exception("/globalReward/toWithdraw接口失败,返回信息:"+response.asString());
} }
return response; return response;
} }
public Response getOrderStatus2(Map cookies,String orderId) throws Exception {
logger.info("请求getOrderStatus");
Map<String,String> map = new HashMap<>();
map.put("orderId",orderId);
Response response = given().cookies(cookies).params(map).post(activityHost+"/walletAccount/getOrderStatus");
return response;
}
/** /**
* 红包账户提现记录 * 开发者后台红包周期列表
* @param cookies * @param account
* @param appId
* @param periodStatus 2:进行中
* @return * @return
* @throws Exception * @throws Exception
*/ */
public Response walletDetail(Map cookies) throws Exception { public Response periodList(String account,String appId,String periodStatus) throws Exception {
logger.info("请求walletDetail"); logger.info("请求periodList");
Map<String,String> map = new HashMap<>(); Map<String,String> map = new HashMap<>();
map.put("pageNo","1"); map.put("periodStatus",periodStatus);
map.put("pageSize","12"); map.put("pageNum","1");
map.put("pageSize","10");
Response response = given().cookies(cookies).params(map).get(activityHost+"/walletAccount/walletDetail"); Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaasNew(account,appId)).params(map).post("http://"+hdHost+"/redpackets/manageTool/periodList");
try{ try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/walletDetail接口失败"); Assert.assertEquals(response.jsonPath().getString("success"),"true","/globalReward/toWithdraw接口失败");
}catch(Exception e){ }catch(Exception e){
throw new Exception("/walletAccount/walletDetail接口失败,返回信息:"+response.asString()); throw new Exception("/redpackets/manageTool/periodList接口失败,返回信息:"+response.asString());
}catch(Error er){ }catch(Error er){
throw new Exception("/walletAccount/walletDetail接口失败,返回信息:"+response.asString()); throw new Exception("/redpackets/manageTool/periodList接口失败,返回信息:"+response.asString());
} }
return response; return response;
} }
/** /**
* 红包账户修改钱包账户余额后门 * 开发者后台红包周期个数
* @param consumerId * @param account
* @param accountType * @param appId
* @param balanceAmount * @param periodStatus 2:进行中
* @return * @return
* @throws Exception * @throws Exception
*/ */
public void updateConsumerAccount(String consumerId,String accountType,String balanceAmount) throws Exception { public Response periodCount(String account,String appId,String periodStatus) throws Exception {
logger.info("请求修改钱包账户余额后门:updateConsumerAccount"); logger.info("请求periodCount");
Map<String,String> map = new HashMap<>(); Map<String,String> map = new HashMap<>();
map.put("consumerId",consumerId); map.put("periodStatus",periodStatus);
map.put("accountType",accountType);
map.put("balanceAmount",balanceAmount); Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaasNew(account,appId)).params(map).post("http://"+hdHost+"/redpackets/manageTool/periodCount");
try{
Response response = given().params(map).get(activityHost+"/aaw/automated/updateConsumerAccount"); Assert.assertEquals(response.jsonPath().getString("success"),"true","/globalReward/toWithdraw接口失败");
// try{ }catch(Exception e){
// Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/walletDetail接口失败"); throw new Exception("/redpackets/manageTool/periodCount接口失败,返回信息:"+response.asString());
// }catch(Error er){
// }catch(Exception e){ throw new Exception("/redpackets/manageTool/periodCount接口失败,返回信息:"+response.asString());
// throw new Exception("/aaw/automated/updateConsumerAccount接口失败,返回信息:"+response.asString()); }
// }catch(Error er){ return response;
// throw new Exception("/aaw/automated/updateConsumerAccount接口失败,返回信息:"+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