Commit 0a0bf666 authored by chenjianfang's avatar chenjianfang

Merge branch 'develop' into hmx

parents 16d5128d efb8a4b4
...@@ -141,6 +141,9 @@ public class DingdingResult { ...@@ -141,6 +141,9 @@ public class DingdingResult {
return result; return result;
} }
public String getJob() throws UnsupportedEncodingException {
return getByRun(run,"job");
}
public String getByRun(String run,String type) throws UnsupportedEncodingException { public String getByRun(String run,String type) throws UnsupportedEncodingException {
run = run.substring(run.indexOf("_")+1, run.indexOf(".")); run = run.substring(run.indexOf("_")+1, run.indexOf("."));
run =this.env.getProperty(run+"."+type); run =this.env.getProperty(run+"."+type);
......
...@@ -22,7 +22,7 @@ public class DuibaBase extends AbstractTestNGSpringContextTestsDuiba { ...@@ -22,7 +22,7 @@ public class DuibaBase extends AbstractTestNGSpringContextTestsDuiba {
// @PostConstruct // @PostConstruct
@BeforeSuite @BeforeSuite
public final void setUp() { public final void setUp() {
logger.info("--------------------DuibaBase.setUp()"); logger.info("--------------------DuibaBase.setUp() Tests");
//只初始化一次 //只初始化一次
jdbc.initDataSource(); jdbc.initDataSource();
......
...@@ -15,8 +15,8 @@ public class DuibaBases extends AbstractTestNGSpringContextTestsDuiba { ...@@ -15,8 +15,8 @@ public class DuibaBases extends AbstractTestNGSpringContextTestsDuiba {
// @PostConstruct // @PostConstruct
@BeforeSuite @BeforeSuite
public void setUp() { public final void setUp() {
logger.info("--------------------DuibaBase.setUp()"); logger.info("--------------------DuibaBases.setUp() Test");
//只初始化一次 //只初始化一次
jdbc.initDataSource(); jdbc.initDataSource();
......
...@@ -8,9 +8,11 @@ import org.apache.http.client.params.ClientPNames; ...@@ -8,9 +8,11 @@ import org.apache.http.client.params.ClientPNames;
import org.apache.http.params.CoreConnectionPNames; import org.apache.http.params.CoreConnectionPNames;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.testng.annotations.Test;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
...@@ -19,8 +21,11 @@ import static io.restassured.RestAssured.given; ...@@ -19,8 +21,11 @@ import static io.restassured.RestAssured.given;
* Created by hanzhanli on 2017/11/9. * Created by hanzhanli on 2017/11/9.
*/ */
public class Postman { public class Postman {
static String dingdingUrl="https://shark.dui88.com/test/integration"; final static String dingdingUrl="https://shark.dui88.com/test/integration";
static String testPlatformUrl = "http://101.37.27.82:8080/insert"; final static String testPlatformUrl = "http://101.37.27.82:8080/insert";
final static String miriaUrl = "http://miria-aliyun.duibatest.com.cn/autoTest/finish";
final static String miriaUrlTesting = "http://miria-aliyun.duibatest.com.cn/autoTest/testing";
//dingdingUrl="http://www.json.cn/"; //dingdingUrl="http://www.json.cn/";
private static Logger logger = LogManager.getLogger(Postman.class); private static Logger logger = LogManager.getLogger(Postman.class);
public static void send2Dingding(Map result){ public static void send2Dingding(Map result){
...@@ -48,6 +53,20 @@ public class Postman { ...@@ -48,6 +53,20 @@ public class Postman {
Response response=given().contentType(ContentType.JSON).body(result).post(testPlatformUrl); Response response=given().contentType(ContentType.JSON).body(result).post(testPlatformUrl);
System.out.println("自动化数据收集平台响应数据:"+response.asString()); System.out.println("自动化数据收集平台响应数据:"+response.asString());
} }
public static void sendFinish(Map result){
Response response=given().params(result).get(miriaUrl);
System.out.println("jobName:"+result.get("jobName"));
System.out.println("miriaUrl:"+miriaUrl);
System.out.println("miria响应结果:"+response.asString());
}
public static void sendTesting(Map result){
Response response=given().params(result).get(miriaUrlTesting);
System.out.println("jobName:"+result.get("jobName"));
System.out.println("miriaUrl:"+miriaUrlTesting);
System.out.println("miria响应结果:"+response.asString());
}
public static Boolean getName(){ public static Boolean getName(){
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
Date date = new Date(); Date date = new Date();
...@@ -58,4 +77,10 @@ public class Postman { ...@@ -58,4 +77,10 @@ public class Postman {
if(week_num%2==0)return true; if(week_num%2==0)return true;
else return false; else return false;
} }
public static void main(String[] args) {
Map<String,String> map = new HashMap<>();
map.put("jobName","duibaSign_interface");
sendFinish(map);
}
} }
package base; package base;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.Environment;
import org.testng.*; import org.testng.*;
/** /**
...@@ -12,6 +18,12 @@ import org.testng.*; ...@@ -12,6 +18,12 @@ import org.testng.*;
public class TestListener implements ITestListener { public class TestListener implements ITestListener {
public DuibaLog logger = DuibaLog.getLogger(); public DuibaLog logger = DuibaLog.getLogger();
String run = System.getProperty("run");
ApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
Environment env=context.getBean(Environment.class);
public TestListener() throws UnsupportedEncodingException {
}
public void onFinish(ITestContext context) { public void onFinish(ITestContext context) {
Iterator<ITestResult> listOfFailedTests = context.getFailedTests().getAllResults().iterator(); Iterator<ITestResult> listOfFailedTests = context.getFailedTests().getAllResults().iterator();
while (listOfFailedTests.hasNext()) { while (listOfFailedTests.hasNext()) {
...@@ -65,16 +77,26 @@ public class TestListener implements ITestListener { ...@@ -65,16 +77,26 @@ public class TestListener implements ITestListener {
// TODO Auto-generated method stub // TODO Auto-generated method stub
logger.info("onStart~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); logger.info("onStart~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
//服务检查
boolean ServiceDoctor=Boolean.parseBoolean(System.getProperty("ServiceDoctor")); boolean ServiceDoctor=Boolean.parseBoolean(System.getProperty("ServiceDoctor"));
if(ServiceDoctor){ if(ServiceDoctor){
try{ try{
serviceDoctor(); serviceDoctor();
}catch (SkipException e){ }catch (SkipException e){
SFExpress.skip = context.getAllTestMethods().length; SFExpress.skip = context.getAllTestMethods().length;
// throw e;
} }
} }
//运行开始,触发互斥功能,用于定时任务
Map<String,String> mapJob = new HashMap<>();
try {
mapJob.put("jobName",getJob());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Postman.sendTesting(mapJob);
} }
public void serviceDoctor(){ public void serviceDoctor(){
logger.info("duiba-server开始检测"); logger.info("duiba-server开始检测");
...@@ -107,4 +129,13 @@ public class TestListener implements ITestListener { ...@@ -107,4 +129,13 @@ public class TestListener implements ITestListener {
res = simpleDateFormat.format(date); res = simpleDateFormat.format(date);
return res; return res;
} }
public String getJob() throws UnsupportedEncodingException {
return getByRun(run,"job");
}
public String getByRun(String run,String type) throws UnsupportedEncodingException {
run = run.substring(run.indexOf("_")+1, run.indexOf("."));
run =this.env.getProperty(run+"."+type);
return new String(run.getBytes("ISO-8859-1"), "UTF-8");//ISO-8859-1
}
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import org.testng.xml.XmlSuite; ...@@ -7,6 +7,7 @@ import org.testng.xml.XmlSuite;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -74,8 +75,16 @@ public class TestReport implements IReporter{ ...@@ -74,8 +75,16 @@ public class TestReport implements IReporter{
e.printStackTrace(); e.printStackTrace();
} }
map.put("failCase",failCase); map.put("failCase",failCase);
// logger.in fo("gson.toJson(ddResult)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
System.out.println("测试结果通知信息:"+gson.toJson(map)); System.out.println("测试结果通知信息:"+gson.toJson(map));
//触发回调结束服务构建互斥
Map<String,String> mapJob = new HashMap<>();
try {
mapJob.put("jobName",ddResult.getJob());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Postman.sendFinish(mapJob);
//发送运行结果到自动化数据收集平台 //发送运行结果到自动化数据收集平台
if(sendPlatform) if(sendPlatform)
Postman.sendTestPlatform(map); Postman.sendTestPlatform(map);
...@@ -84,9 +93,9 @@ public class TestReport implements IReporter{ ...@@ -84,9 +93,9 @@ public class TestReport implements IReporter{
if(!noticePerson){ if(!noticePerson){
map.put("names",new ArrayList<>()); map.put("names",new ArrayList<>());
} }
// logger.info("noticeDD:"+noticeDD);
Postman.send2Dingding(map); Postman.send2Dingding(map);
} }
} }
} }
...@@ -168,7 +168,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase { ...@@ -168,7 +168,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase {
String orderId = openResponse.jsonPath().getString("orderId"); String orderId = openResponse.jsonPath().getString("orderId");
Response statusResponse = newActivityService.getOrderStatus31(orderId,uid); Response statusResponse = newActivityService.getOrderStatus31(orderId,uid);
// logger.info("开奖结果如下1:"); // logger.info("开奖结果如下1:");
// statusResponse.prettyPrint(); statusResponse.prettyPrint();
String playResult = String.valueOf(statusResponse.jsonPath().getString("result")); String playResult = String.valueOf(statusResponse.jsonPath().getString("result"));
int i = 8; int i = 8;
while (i > 0 && (playResult.equals("0"))) { while (i > 0 && (playResult.equals("0"))) {
...@@ -177,7 +177,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase { ...@@ -177,7 +177,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase {
playResult = String.valueOf(statusResponse.jsonPath().getString("result")); playResult = String.valueOf(statusResponse.jsonPath().getString("result"));
i--; i--;
// logger.info("开奖结果如下2:"); // logger.info("开奖结果如下2:");
// statusResponse.prettyPrint(); statusResponse.prettyPrint();
} }
return statusResponse; return statusResponse;
......
...@@ -122,7 +122,7 @@ public class 集卡规则_中奖属性配置_DuibaTest extends DuibaTestBase { ...@@ -122,7 +122,7 @@ public class 集卡规则_中奖属性配置_DuibaTest extends DuibaTestBase {
//校验修改内容 //校验修改内容
Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config where id =?",newId); Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config where id =?",newId);
Assert.assertEquals(selectResult.get("deleted").toString(),"true","删除中奖条件失败"); Assert.assertEquals(selectResult.get("deleted").toString(),"1","删除中奖条件失败");
logger.info("校验删除属性配置成功"); logger.info("校验删除属性配置成功");
} }
......
...@@ -299,7 +299,7 @@ public class 集卡规则_中奖配置测试_DuibaTest extends DuibaTestBase { ...@@ -299,7 +299,7 @@ public class 集卡规则_中奖配置测试_DuibaTest extends DuibaTestBase {
//校验修改内容 //校验修改内容
Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config where id =?",newId); Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config where id =?",newId);
Assert.assertEquals(selectResult.get("deleted").toString(),"true","删除中奖条件失败"); Assert.assertEquals(selectResult.get("deleted").toString(),"1","删除中奖条件失败");
} }
......
...@@ -158,7 +158,7 @@ public class 集卡规则_助力规则配置测试_DuibaTest extends DuibaTestBa ...@@ -158,7 +158,7 @@ public class 集卡规则_助力规则配置测试_DuibaTest extends DuibaTestBa
//校验修改内容 //校验修改内容
Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config_goods_rules where id =?",newGoodsRuleId); Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config_goods_rules where id =?",newGoodsRuleId);
Assert.assertEquals(selectResult.get("deleted").toString(),"true","删除中奖条件失败"); Assert.assertEquals(selectResult.get("deleted").toString(),"1","删除中奖条件失败");
logger.info("删除集卡助力规则成功"); logger.info("删除集卡助力规则成功");
} }
......
...@@ -267,7 +267,6 @@ public class 创建自有活动_DuibaTest extends DuibaTestBase { ...@@ -267,7 +267,6 @@ public class 创建自有活动_DuibaTest extends DuibaTestBase {
} }
//删除自有活动 //删除自有活动
public void 删除自有活动(String title) throws Exception{ public void 删除自有活动(String title) throws Exception{
//开发者删除自有活动 //开发者删除自有活动
......
package http.cases.DeveloperTest;
import base.DuibaTestBase;
import org.testng.annotations.DataProvider;
import utils.PublicMethod;
import http.service.Activity.ManagerService;
import http.service.Activity.NewActivityService;
import http.service.Activity.SingleLotteryService;
import http.service.hd.DeveloperService;
import http.service.hd.SigninService;
import utils.MatcherString;
import base.DuibaLog;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
/**
* Created by lvwenyan on 2018/11/23.
*/
public class 新建活动测试_DuibaTest extends DuibaTestBase{
@Autowired
DeveloperService developerService;
private static DuibaLog logger = DuibaLog.getLogger();
@DataProvider
public Object[][] providerMethod(Method method){
Object[][] result = null;
if(method.getName().equals("新建自有积分商城活动工具")) {
result = new Object[][]{
new Object[]{1, "5","everyday","3","everyday","[{\"index\":1,\"type\":\"thanks\",\"img\":\"//yun.duiba.com.cn/upload/uP99F1462438316972.png\",\"title\":\"谢谢参与\",\"valid\":true,\"show\":true},{\"type\":\"coupon\",\"title\":\"优惠券\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":159857,\"name\":\"【自动化勿动】自有优惠券\",\"limit\":\"1\",\"low\":\"2\",\"remaind\":\"100\"},{\"type\":\"object\",\"title\":\"实物\",\"img\":\"//yun.duiba.com.cn/upload/1uF0l1462438316968.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":177222,\"name\":\"【自动化】自有实物\",\"limit\":\"2\",\"low\":\"3\",\"remaind\":\"90\"},{\"type\":\"virtual\",\"title\":\"虚拟商品\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/slotMachine/virtual.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":178060,\"value\":\"test\",\"limit\":\"3\",\"low\":\"4\",\"remaind\":\"80\"},{\"type\":\"alipay\",\"title\":\"支付宝\",\"img\":\"//yun.duiba.com.cn/upload/KkZMp1462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"value\":\"1\",\"limit\":\"4\",\"low\":\"5\",\"remaind\":\"70\"},{\"type\":\"qb\",\"title\":\"Q币\",\"img\":\"//yun.duiba.com.cn/upload/mF3wO1462438317114.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"value\":\"10\",\"limit\":\"5\",\"low\":\"6\",\"remaind\":\"60\"},{\"type\":\"lucky\",\"title\":\"福袋\",\"img\":\"//yun.duiba.com.cn/webapp/img/luckynewn.png\",\"valid\":true,\"probability\":\"10\",\"show\":false,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\"},{\"type\":\"again\",\"title\":\"再抽一次\",\"img\":\"//yun.duiba.com.cn/upload/aJwb11462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\"}]"
,"//yun.duiba.com.cn/upload/newHdTool/turntable_cricle/banner_750x220.png","新建自有积分商城活动工具--每日次数"}, //case1
new Object[]{2, "10", "forever", "3","forever","[{\"index\":1,\"type\":\"thanks\",\"img\":\"//yun.duiba.com.cn/upload/uP99F1462438316972.png\",\"title\":\"谢谢参与\",\"valid\":true,\"show\":true},{\"type\":\"coupon\",\"title\":\"优惠券\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":159857,\"name\":\"【自动化勿动】自有优惠券\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券2\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":169713,\"name\":\"【勿动】兑吧优惠券扣库存\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券3\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"10\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172293,\"name\":\"【勿动】兑吧优惠券下载链接兑换记录页\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券4\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":174797,\"name\":\"【勿动】兑吧优惠券预分配库存测试\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券5\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":174923,\"name\":\"【勿动】兑吧优惠券共享库存测试\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券6\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172292,\"name\":\"【勿动】兑吧优惠券下载链接商家落地页\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券7\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":true,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":175605,\"name\":\"【勿动】兑吧优惠券地区兑换白名单不可兑\",\"remaind\":\"199\"}]"
,"//yun.dui88.com/images/201811/2yyblucaps.jpg","新建自有积分商城活动工具--永久次数"}, //case2
};
}else
if (method.getName().equals("新建自有独立活动工具")){
result = new Object[][]{
new Object[]{1, "10","everyday","everyday","[{\"index\":1,\"type\":\"thanks\",\"img\":\"//yun.duiba.com.cn/upload/uP99F1462438316972.png\",\"title\":\"谢谢参与\",\"valid\":true,\"show\":true},{\"type\":\"coupon\",\"title\":\"优惠券\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":159857,\"name\":\"【自动化勿动】自有优惠券\",\"limit\":\"1\",\"low\":\"2\",\"remaind\":\"100\"},{\"type\":\"object\",\"title\":\"实物\",\"img\":\"//yun.duiba.com.cn/upload/1uF0l1462438316968.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":177222,\"name\":\"【自动化】自有实物\",\"limit\":\"2\",\"low\":\"3\",\"remaind\":\"90\"},{\"type\":\"virtual\",\"title\":\"虚拟商品\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/slotMachine/virtual.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":178060,\"value\":\"test\",\"limit\":\"3\",\"low\":\"4\",\"remaind\":\"80\"},{\"type\":\"alipay\",\"title\":\"支付宝\",\"img\":\"//yun.duiba.com.cn/upload/KkZMp1462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"value\":\"1\",\"limit\":\"4\",\"low\":\"5\",\"remaind\":\"70\"},{\"type\":\"qb\",\"title\":\"Q币\",\"img\":\"//yun.duiba.com.cn/upload/mF3wO1462438317114.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"value\":\"10\",\"limit\":\"5\",\"low\":\"6\",\"remaind\":\"60\"},{\"type\":\"lucky\",\"title\":\"福袋\",\"img\":\"//yun.duiba.com.cn/webapp/img/luckynewn.png\",\"valid\":true,\"probability\":\"10\",\"show\":false,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\"},{\"type\":\"again\",\"title\":\"再抽一次\",\"img\":\"//yun.duiba.com.cn/upload/aJwb11462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\"}]"
,"//yun.duiba.com.cn/upload/newHdTool/turntable_cricle/banner_750x220.png","新建自有独立活动工具--每日次数"}, //case1
new Object[]{2, "50", "forever", "everyday","[{\"index\":1,\"type\":\"thanks\",\"img\":\"//yun.duiba.com.cn/upload/uP99F1462438316972.png\",\"title\":\"谢谢参与\",\"valid\":true,\"show\":true},{\"type\":\"coupon\",\"title\":\"优惠券\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":159857,\"name\":\"【自动化勿动】自有优惠券\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券2\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":169713,\"name\":\"【勿动】兑吧优惠券扣库存\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券3\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"10\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172293,\"name\":\"【勿动】兑吧优惠券下载链接兑换记录页\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券4\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":174797,\"name\":\"【勿动】兑吧优惠券预分配库存测试\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券5\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":174923,\"name\":\"【勿动】兑吧优惠券共享库存测试\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券6\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172292,\"name\":\"【勿动】兑吧优惠券下载链接商家落地页\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券7\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":true,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":175605,\"name\":\"【勿动】兑吧优惠券地区兑换白名单不可兑\",\"remaind\":\"199\"}]"
,"//yun.dui88.com/images/201811/2yyblucaps.jpg","新建自有独立活动工具--永久次数"}, //case2
};
}else
if(method.getName().equals("新建自有单品抽奖活动")){
result = new Object[][]{
new Object[]{1,"177222","【自动化】自有实物","object","100","5","everyday","//yun.dui88.com/images/201811/hvhlu2ggta.png","0","","false","新建自有单品抽奖--每日次数"}, //case1
new Object[]{2,"159857","【自动化勿动】自有优惠券","coupon","2000","5","forever","//yun.dui88.com/images/201811/hvhlu2ggta.png","2","2","true","新建自有单品抽奖--永久次数和会员等级"}, //case1
};
}else
if(method.getName().equals("新建自有手动开奖活动")){
result = new Object[][]{
new Object[]{1,"10","everyday","5","everyday","//yun.duiba.com.cn/upload/mhty76ri9b.png","新建自有手动开奖--每日次数"},
};
}
return result;
}
/**
* @param caseNum 用例编号
* @param limitCount 限制次数
* @param limitScope 限制次数类型
* @param freeLimit 免费次数
* @param freeScope 免费次数类型
* @param awards 活动奖品
* @param bannerImgNew 新版banner图
* @param caseName 用例名称
* @throws Exception
*/
@Test(dataProvider = "providerMethod" )
public void 新建自有积分商城活动工具(int caseNum,String limitCount,String limitScope,String freeLimit,String freeScope,String awards,String bannerImgNew,String caseName) throws Exception {
logger.info("-----------------------------"+caseName+"-----------------------------");
String data = PublicMethod.data();
String title = "【自动化】自有活动工具"+data;
//新建自有活动工具
developerService.saveHdAll("","1",title,limitCount,limitScope,freeLimit,freeScope,awards,bannerImgNew);
//获取活动id
Response listResponse = developerService.list2(title);
String id = String.valueOf(listResponse.jsonPath().getString("data.list[0].id"));
//编辑活动,校验活动内容
Response editResponse = developerService.editData(id,"turntable_circle","2239");
switch (caseNum){
case 1:
Assert.assertEquals(editResponse.jsonPath().getString("data.credits"),"10","校验活动积分失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimit"),"3","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeScope"),"everyday","校验活动免费抽奖次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitCount"),"5","校验活动限制次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitScope"),"everyday","校验活动限制次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].name"),"【自动化勿动】自有优惠券","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].limit"),"1","校验活动奖品中奖限制失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].oldRemaind"),"100","校验活动奖品数量失败");
logger.info("校验新建自有活动工具-1内容成功");
break;
case 2:
Assert.assertEquals(editResponse.jsonPath().getString("data.limitCount"),"10","校验活动限制次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitScope"),"forever","校验活动限制次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimit"),"3","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeScope"),"forever","校验活动免费抽奖次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[2].name"),"【勿动】兑吧优惠券扣库存","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.bannerImgNew"),"//yun.dui88.com/images/201811/2yyblucaps.jpg","校验活动新版banner图失败");
logger.info("校验新建自有活动工具-2内容成功");
break;
}
//删除测试数据
this.删除自有活动(title);
}
@Test(dataProvider = "providerMethod" )
public void 新建自有独立活动工具(int caseNum,String limitCount,String limitScope,String freeScope,String awards,String bannerImgNew,String caseName) throws Exception {
logger.info("-----------------------------"+caseName+"-----------------------------");
String data = PublicMethod.data();
String title = "【自动化】自有独立活动工具"+data;
//新建自有活动工具
developerService.saveHdAll("","0",title,limitCount,limitScope,"",freeScope,awards,bannerImgNew);
//获取活动id
Response listResponse = developerService.list2(title);
String id = String.valueOf(listResponse.jsonPath().getString("data.list[0].id"));
//编辑活动,校验活动内容
Response editResponse = developerService.editData(id,"turntable_circle","2239");
switch (caseNum){
case 1:
Assert.assertEquals(editResponse.jsonPath().getString("data.credits"),"0","校验活动积分失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitCount"),"10","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitScope"),"everyday","校验活动免费抽奖次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].name"),"【自动化勿动】自有优惠券","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].limit"),"1","校验活动奖品中奖限制失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].oldRemaind"),"100","校验活动奖品数量失败");
logger.info("校验新建自有独立活动工具-1内容成功");
break;
case 2:
Assert.assertEquals(editResponse.jsonPath().getString("data.limitCount"),"50","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitScope"),"forever","校验活动免费抽奖次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[2].name"),"【勿动】兑吧优惠券扣库存","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.bannerImgNew"),"//yun.dui88.com/images/201811/2yyblucaps.jpg","校验活动新版banner图失败");
logger.info("校验新建自有独立活动工具-2内容成功");
break;
}
//删除测试数据
this.删除自有活动(title);
}
/**
* @param caseNum 用例编号
* @param mainAppItemId 活动奖品id
* @param appItemTitle 活动奖品名称
* @param appItemType 活动奖品类型
* @param mainAppItemRemaining 奖品数量
* @param freeDrawLimit 免费抽奖次数
* @param freeDrawLimitScope 免费抽奖类型
* @param bannerImgNew 新版banner图
* @param vipLimitType 会员等级配置
* @param vipLimits 会员的等级范围
* @param exchangeLimit 直充防刷
* @param caseName 用例名称
* @throws Exception
*/
@Test(dataProvider = "providerMethod")
public void 新建自有单品抽奖活动(int caseNum,String mainAppItemId,String appItemTitle,String appItemType,String mainAppItemRemaining,String freeDrawLimit,String freeDrawLimitScope,String bannerImgNew,String vipLimitType,String vipLimits,String exchangeLimit,String caseName) throws Exception{
logger.info("-----------------------------"+caseName+"-----------------------------");
String data = PublicMethod.data();
String title = "【自动化】自有单品抽奖"+data;
//新建自有活动工具
developerService.saveDpAll("",title,mainAppItemId,appItemTitle,appItemType,mainAppItemRemaining,freeDrawLimit,freeDrawLimitScope,bannerImgNew,vipLimitType,vipLimits,exchangeLimit);
//获取活动id
Response listResponse = developerService.list2(title);
String id = String.valueOf(listResponse.jsonPath().getString("data.list[0].activityId"));
//编辑活动,校验活动内容
Response editResponse = developerService.editDetail("2239",id);
switch (caseNum){
case 1:
Assert.assertEquals(editResponse.jsonPath().getString("data.appItemTitle"),"【自动化】自有实物","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.bannerImgNew"),"//yun.dui88.com/images/201811/hvhlu2ggta.png","校验活动新版banner图失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeDrawLimit"),"5","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeDrawLimitScope"),"everyday","校验活动免费抽奖类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.consumerDrawLimit"),"2","校验用户抽奖限制次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.consumerDrawLimitScope"),"everyday","校验用户抽奖限制类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.mainAppItemId"),"177222","校验活动奖品id失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.mainAppItemRemaining"),"100","校验活动奖品数量失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.mainAppItemRate"),"66.66","校验活动奖品数量失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitDateJson"),"{\"endDay\":\"2020-02-01\",\"endThours\":\"22\",\"endTminute\":\"0\",\"startDay\":\"2018-11-26\",\"startHours\":\"6\",\"startTminute\":\"0\"}","校验活动抽奖日期限制失败");
logger.info("校验新建自有单品抽奖-1内容成功");
break;
case 2:
Assert.assertEquals(editResponse.jsonPath().getString("data.appItemTitle"),"【自动化勿动】自有优惠券","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeDrawLimit"),"5","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeDrawLimitScope"),"forever","校验活动免费抽奖类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.mainAppItemId"),"159857","校验活动奖品id失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.appVipLimitOpen"),"true","校验活动会员等级开关失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.vipLimits"),"2","校验活动会员等级范围失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.exchangeLimit"),"true","校验活动直充防刷失败");
logger.info("校验新建自有单品抽奖-1内容成功");
break;
}
//删除测试数据
this.删除自有活动(title);
}
/**
* @param caseNum 用例编号
* @param consumerDrawLimit 用户抽奖限制次数
* @param consumerDrawLimitScope 用户抽奖限制类型
* @param freeLimit 免费抽奖次数
* @param freeLimitScope 免费抽奖次数类型
* @param bannerImgNew 新版banner图
* @param caseName 用例名称
* @throws Exception
*/
@Test(dataProvider = "providerMethod")
public void 新建自有手动开奖活动(int caseNum,String consumerDrawLimit,String consumerDrawLimitScope,String freeLimit,String freeLimitScope,String bannerImgNew,String caseName) throws Exception{
logger.info("-----------------------------"+caseName+"-----------------------------");
String data = PublicMethod.data();
String title = "【自动化】自有手动开奖"+data;
//新建自有手动开奖
developerService.saveManualLottery(title,consumerDrawLimit,consumerDrawLimitScope,freeLimit,freeLimitScope,bannerImgNew);
//获取活动id
Response listResponse = developerService.list2(title);
String id = String.valueOf(listResponse.jsonPath().getString("data.list[0].activityId"));
//编辑活动,校验活动内容
Response editResponse = developerService.editManualLottery(id);
switch (caseNum){
case 1:
Assert.assertEquals(editResponse.jsonPath().getString("data.credits"),"50","校验活动积分失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimit"),"5","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimitScope"),"everyday","校验活动免费抽奖次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.consumerDrawLimit"),"10","校验用户抽奖限制次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.consumerDrawLimitScope"),"everyday","校验用户抽奖限制类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.bannerImgNew"),"//yun.duiba.com.cn/upload/mhty76ri9b.png","校验活动新版banner图失败");
logger.info("校验新建自有手动开奖-1内容成功");
break;
case 2:
break;
}
//删除测试数据
this.删除自有活动(title);
}
//删除自有活动
public void 删除自有活动(String title) throws Exception{
//开发者删除自有活动
Response HdResponse = developerService.list2(title);
String actId = HdResponse.jsonPath().getString("data.list[0].id");
developerService.delActivity(actId);
}
}
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases; import base.DuibaBases;
import http.service.app.SupplierExchangeTemplateService; import http.service.app.SupplierExchangeTemplateService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -11,7 +12,7 @@ import java.util.Map; ...@@ -11,7 +12,7 @@ import java.util.Map;
* Created by zhaoran on 2018/11/15 * Created by zhaoran on 2018/11/15
* Remark: 校验Q币、虚拟商品兑换模板 * Remark: 校验Q币、虚拟商品兑换模板
*/ */
public class CheckTemplet extends DuibaBases { public class CheckTemplet extends DuibaBase {
@Autowired @Autowired
SupplierExchangeTemplateService supplierExchangeTemplateService ; SupplierExchangeTemplateService supplierExchangeTemplateService ;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
import http.service.app.CouponExchangeService; import http.service.app.CouponExchangeService;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
import http.service.app.*; import http.service.app.*;
...@@ -45,9 +47,9 @@ public class ObjectExchange_ExchangeTest extends CheckTemplet { ...@@ -45,9 +47,9 @@ public class ObjectExchange_ExchangeTest extends CheckTemplet {
@BeforeClass @BeforeClass
public void before() { public void before() {
managerService.update(uid,"5555555");
// jdbc = MysqlUtils.mysqlDuiba("orders_consumer"); // jdbc = MysqlUtils.mysqlDuiba("orders_consumer");
try { try {
managerService.update(uid,"5555555");
jdbc.update("delete from orders_consumer.orders_0614 where consumer_id = 100011622 and biz_params = 'DUIBA_SELF'", null); jdbc.update("delete from orders_consumer.orders_0614 where consumer_id = 100011622 and biz_params = 'DUIBA_SELF'", null);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
import http.service.app.*; import http.service.app.*;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import base.DuibaLog; import base.DuibaLog;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import utils.RedisUtil; import utils.RedisUtil;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
import http.service.app.AlipayExchangeService; import http.service.app.AlipayExchangeService;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
import http.service.app.CouponExchangeService; import http.service.app.CouponExchangeService;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Authorization; import http.service.Authorization;
import http.service.app.AppPlatformCouponService; import http.service.app.AppPlatformCouponService;
import http.service.app.CrecordService; import http.service.app.CrecordService;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import base.DuibaLog; import base.DuibaLog;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Authorization; import http.service.Authorization;
import http.service.Manager.ADeveloperService; import http.service.Manager.ADeveloperService;
import http.service.app.AlipayExchangeService; import http.service.app.AlipayExchangeService;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import base.DuibaLog; import base.DuibaLog;
import base.DuibaTestBase; import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
......
...@@ -139,8 +139,9 @@ public class 游戏_开大奖测试_AccessTest extends DuibaTestBase { ...@@ -139,8 +139,9 @@ public class 游戏_开大奖测试_AccessTest extends DuibaTestBase {
Response openWinnResponse = newGameService.openWinning(gameId); Response openWinnResponse = newGameService.openWinning(gameId);
openWinnResponse.prettyPrint(); openWinnResponse.prettyPrint();
Thread.sleep(3000); Thread.sleep(8000);
List<Map<String,Object>> orders = jdbc.findModeResult("select * from ngame.ngame_orders where duiba_ngame_id = ?\n",gameId); List<Map<String,Object>> orders = jdbc.findModeResult("select * from ngame.ngame_orders where duiba_ngame_id = ?\n",gameId);
logger.info("orders信息为"+JSONObject.toJSONString(orders));
for(int i=0;i<orders.size();i++){ for(int i=0;i<orders.size();i++){
if (orders.get(i).get("consumer_id").toString().equals(user1.getConsumerId())){ if (orders.get(i).get("consumer_id").toString().equals(user1.getConsumerId())){
Assert.assertEquals(orders.get(i).get("prize_id").toString(),optionId1,"第一名发奖奖项id校验失败"); Assert.assertEquals(orders.get(i).get("prize_id").toString(),optionId1,"第一名发奖奖项id校验失败");
......
...@@ -99,7 +99,7 @@ public class 游戏_新建无大奖游戏_AccessTest extends DuibaTestBase { ...@@ -99,7 +99,7 @@ public class 游戏_新建无大奖游戏_AccessTest extends DuibaTestBase {
"[{\"type\":\"phonebill\",\"title\":\"小奖1\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/shake/phone.png\",\"show\":true,\"description\":\"\",\"guarantee\":true,\"scoreArea\":\"0,100\",\"optionLimitCount\":\"\",\"limitDays\":\"\",\"limitTimeType\":\"\",\"rate\":5000,\"appItemId\":1,\"value\":\"1\",\"limit\":null,\"low\":null,\"remaind\":\"10000\",\"oldRemaind\":null,\"isMutliPrizeLimit\":false,\"autoOpen\":true}," + "[{\"type\":\"phonebill\",\"title\":\"小奖1\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/shake/phone.png\",\"show\":true,\"description\":\"\",\"guarantee\":true,\"scoreArea\":\"0,100\",\"optionLimitCount\":\"\",\"limitDays\":\"\",\"limitTimeType\":\"\",\"rate\":5000,\"appItemId\":1,\"value\":\"1\",\"limit\":null,\"low\":null,\"remaind\":\"10000\",\"oldRemaind\":null,\"isMutliPrizeLimit\":false,\"autoOpen\":true}," +
"{\"type\":\"phonebill\",\"title\":\"小奖2\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/shake/phone.png\",\"show\":true,\"description\":\"\",\"guarantee\":true,\"scoreArea\":\"101,200\",\"optionLimitCount\":\"\",\"limitDays\":\"\",\"limitTimeType\":\"\",\"rate\":8000,\"appItemId\":1,\"value\":\"2\",\"limit\":null,\"low\":null,\"remaind\":\"1000\",\"oldRemaind\":null,\"isMutliPrizeLimit\":false,\"autoOpen\":true}]"); "{\"type\":\"phonebill\",\"title\":\"小奖2\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/shake/phone.png\",\"show\":true,\"description\":\"\",\"guarantee\":true,\"scoreArea\":\"101,200\",\"optionLimitCount\":\"\",\"limitDays\":\"\",\"limitTimeType\":\"\",\"rate\":8000,\"appItemId\":1,\"value\":\"2\",\"limit\":null,\"low\":null,\"remaind\":\"1000\",\"oldRemaind\":null,\"isMutliPrizeLimit\":false,\"autoOpen\":true}]");
Response response = given().contentType("application/x-www-form-urlencoded; charset=UTF-8").cookies(authorization.ssoLogin()).params(params).post("https://"+ url); Response response = given().contentType("application/x-www-form-urlencoded; charset=UTF-8").cookies(authorization.ssoLogin()).params(params).post("http://"+ url);
response.prettyPrint(); response.prettyPrint();
Thread.sleep(3000); Thread.sleep(3000);
...@@ -133,7 +133,7 @@ public class 游戏_新建无大奖游戏_AccessTest extends DuibaTestBase { ...@@ -133,7 +133,7 @@ public class 游戏_新建无大奖游戏_AccessTest extends DuibaTestBase {
map1.put("id",gameIds.get(z)); map1.put("id",gameIds.get(z));
map1.put("status","1"); map1.put("status","1");
Response response1 = given().cookies(authorization.ssoLogin()).contentType("application/x-www-form-urlencoded; charset=UTF-8").params(map1).post("https://"+url); Response response1 = given().cookies(authorization.ssoLogin()).contentType("application/x-www-form-urlencoded; charset=UTF-8").params(map1).post("http://"+url);
Map<String,Object> result = jdbc.findSimpleResult("select * from ngame.duiba_ngame where id = ?\n",gameIds.get(z)); Map<String,Object> result = jdbc.findSimpleResult("select * from ngame.duiba_ngame where id = ?\n",gameIds.get(z));
Assert.assertEquals(result.get("game_status").toString(),"1","校验状态修改失败"); Assert.assertEquals(result.get("game_status").toString(),"1","校验状态修改失败");
}else if (z==1){ }else if (z==1){
......
package http.cases.SaasDeveloperTest; package http.cases.GoodsAndTradeTest;
import base.Config; import base.Config;
import base.DuibaTestBase; import base.DuibaTestBase;
...@@ -15,7 +15,7 @@ import org.testng.annotations.Test; ...@@ -15,7 +15,7 @@ import org.testng.annotations.Test;
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 修改兑吧商品 extends DuibaTestBase { public class 修改兑吧商品_ExchangeTest extends DuibaTestBase {
@Autowired @Autowired
DoUpdateAppItemService doUpdateAppItemService; DoUpdateAppItemService doUpdateAppItemService;
......
package http.cases.SaasDeveloperTest; package http.cases.GoodsAndTradeTest;
import base.Config; import base.Config;
import utils.PublicMethod; import utils.PublicMethod;
...@@ -19,7 +19,7 @@ import org.testng.annotations.Test; ...@@ -19,7 +19,7 @@ import org.testng.annotations.Test;
*/ */
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 商品管理操作_DuibaTest extends AbstractTestNGSpringContextTests { public class 商品管理操作_ExchangeTest extends AbstractTestNGSpringContextTests {
@Autowired @Autowired
SpglczService czService; SpglczService czService;
@Autowired @Autowired
......
package http.cases.SaasDeveloperTest; package http.cases.GoodsAndTradeTest;
import base.Config; import base.Config;
import base.DuibaTestBase; import base.DuibaTestBase;
...@@ -21,7 +21,7 @@ import java.util.Map; ...@@ -21,7 +21,7 @@ import java.util.Map;
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 异常订单测试 extends DuibaTestBase { public class 异常订单测试_ExchangeTest extends DuibaTestBase {
@Autowired @Autowired
private MobileService mobileService; private MobileService mobileService;
...@@ -66,9 +66,9 @@ public class 异常订单测试 extends DuibaTestBase { ...@@ -66,9 +66,9 @@ public class 异常订单测试 extends DuibaTestBase {
@Test(description = "实物兑换无库存") @Test(description = "实物兑换无库存")
public void 无库存() throws Exception { public void 无库存() throws Exception {
Response response = mobileService.detail(authorization.dafuwengLogin(3661), "31051");//uid3661 Response response = mobileService.detail(authorization.dafuwengLogin(4819), "31051");//uid3661
// response.prettyPrint(); // response.prettyPrint();
Map<String, String> map = authorization.dafuwengLogin(3661, true); Map<String, String> map = authorization.dafuwengLogin(4819);
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "活动详情页请求异常"); Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "活动详情页请求异常");
//实物兑换 //实物兑换
Response response2 = couponExchangeService.objectExchange2(map, "179139", "null", "null", "z9sydmcs", "null"); Response response2 = couponExchangeService.objectExchange2(map, "179139", "null", "null", "z9sydmcs", "null");
......
package http.cases.SaasDeveloperTest; package http.cases.GoodsAndTradeTest;
import base.Config; import base.Config;
...@@ -16,7 +16,7 @@ import org.testng.annotations.Test; ...@@ -16,7 +16,7 @@ import org.testng.annotations.Test;
* 自有优惠券添加、修改、删除、上架或下架、查询操作 * 自有优惠券添加、修改、删除、上架或下架、查询操作
*/ */
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 自有优惠券测试_DuibaTest extends AbstractTestNGSpringContextTests { public class 自有优惠券测试_ExchangeTest extends AbstractTestNGSpringContextTests {
@Autowired @Autowired
DeveloperObjectService developerObjectService; DeveloperObjectService developerObjectService;
@Autowired @Autowired
......
package http.cases.SaasDeveloperTest; package http.cases.GoodsAndTradeTest;
import base.Config; import base.Config;
import utils.PublicMethod; import utils.PublicMethod;
...@@ -17,7 +17,7 @@ import org.testng.annotations.Test; ...@@ -17,7 +17,7 @@ import org.testng.annotations.Test;
* @author wangxiaoshuang * @author wangxiaoshuang
*/ */
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 自有实物测试_DuibaTest extends AbstractTestNGSpringContextTests { public class 自有实物测试_ExchangeTest extends AbstractTestNGSpringContextTests {
@Autowired @Autowired
DeveloperObjectService objectService; DeveloperObjectService objectService;
......
package http.cases.SaasDeveloperTest; package http.cases.GoodsAndTradeTest;
import base.Config; import base.Config;
import utils.PublicMethod; import utils.PublicMethod;
...@@ -15,7 +15,7 @@ import org.testng.annotations.Test; ...@@ -15,7 +15,7 @@ import org.testng.annotations.Test;
* 自有虚拟商品添加、修改、删除、上架或下架、查询操作 * 自有虚拟商品添加、修改、删除、上架或下架、查询操作
*/ */
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 自有虚拟商品测试_DuibaTest extends AbstractTestNGSpringContextTests { public class 自有虚拟商品测试_ExchangeTest extends AbstractTestNGSpringContextTests {
@Autowired @Autowired
DeveloperVirtualService developerVirtualService; DeveloperVirtualService developerVirtualService;
@Autowired @Autowired
......
...@@ -152,7 +152,11 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase { ...@@ -152,7 +152,11 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
//获取未登录场景cookie //获取未登录场景cookie
Response responses = authorization.autoLogin(); Response responses = authorization.autoLogin();
//进行接口测试传参 //进行接口测试传参
Response response = newActivityService.doJoin(responses.getDetailedCookies(),data.get("token"),data.get("activityId")); Map<String,String> map = responses.getCookies();
logger.info("cookies:"+map.toString());
if(responses.getDetailedCookies()==null)logger.info("cookies = = null");
Response response = newActivityService.doJoinMap(map,data.get("token"),data.get("activityId"));
// Response response = newActivityService.doJoin(responses.getDetailedCookies(),data.get("token"),data.get("activityId"));
response.prettyPrint(); response.prettyPrint();
String success = String.valueOf(response.jsonPath().getString("success")); String success = String.valueOf(response.jsonPath().getString("success"));
//根据case选择校验项 //根据case选择校验项
...@@ -180,6 +184,10 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase { ...@@ -180,6 +184,10 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
Assert.assertTrue(response.jsonPath().getString("lottery.link").contains("/activity/takePrizeNew?recordId=")); Assert.assertTrue(response.jsonPath().getString("lottery.link").contains("/activity/takePrizeNew?recordId="));
Assert.assertEquals(response.jsonPath().getString("lottery.id"), "11628", "校验id失败"); Assert.assertEquals(response.jsonPath().getString("lottery.id"), "11628", "校验id失败");
logger.info("未登录状态下有免费次数抽奖校验:title,link,id成功"); logger.info("未登录状态下有免费次数抽奖校验:title,link,id成功");
response = newActivityService.login(map,"2239.3.3.0");
Assert.assertEquals(response.jsonPath().getString("success"),"true","登录跳转接口访问失败!");
} }
} }
......
...@@ -11,6 +11,7 @@ import base.DuibaLog; ...@@ -11,6 +11,7 @@ import base.DuibaLog;
import base.DuibaTestBase; import base.DuibaTestBase;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.model.CollectGoodsInfo; import http.model.CollectGoodsInfo;
import http.service.Activity.NewCollectActivityService; import http.service.Activity.NewCollectActivityService;
import http.service.Manager.EditManagerInfoService; import http.service.Manager.EditManagerInfoService;
...@@ -18,6 +19,7 @@ import io.restassured.response.Response; ...@@ -18,6 +19,7 @@ import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import utils.GetCookieUtil;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -32,6 +34,7 @@ import static io.restassured.RestAssured.given; ...@@ -32,6 +34,7 @@ import static io.restassured.RestAssured.given;
* @create 2018/10/27 * @create 2018/10/27
* @since 1.0.0 * @since 1.0.0
*/ */
//3个case
public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase { public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase {
...@@ -46,7 +49,7 @@ public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase { ...@@ -46,7 +49,7 @@ public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase {
@Test @Test
public void 助力_发集卡() throws Exception{ public void 助力_发集卡() throws Exception{
//助力规则 //助力规则git
int userId = 3934; int userId = 3934;
String consumerId = "100092114"; String consumerId = "100092114";
String collectRuleId = "4795"; String collectRuleId = "4795";
...@@ -241,15 +244,11 @@ public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase { ...@@ -241,15 +244,11 @@ public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase {
Response response = editManagerInfoService.createUser("新用户助力",appId); Response response = editManagerInfoService.createUser("新用户助力",appId);
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '新用户助力' and app_id = ?\n",appId); Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '新用户助力' and app_id = ?\n",appId);
String uid = user.get("id").toString(); String uid = user.get("id").toString();
String url = "http://47.97.214.108/user/loginDuiba?uid=" + uid; String url = GetCookieUtil.genUrl(uid,"2wGQc3MZaQsqYFWcX4gguya5PnnS");
Response login = given().get(url); JSONObject cookie = GetCookieUtil.getConsumerIdFromCookie(url);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = ?\n",uid,app_id);
String consumerId = consumer.get("id").toString();
Boolean res = jdbc.update("UPDATE new_consumer.consumer_0010 set addr_name = 'qwj' , addr_phone = '18143476563' ,addr_province = '浙江省' ,addr_city = '杭州市' " +
", addr_area = '西湖区' , addr_detail = '奖池花印' where partner_user_id = ? and app_id = ?\n",uid,app_id);
map.put("uid",uid); map.put("uid",uid);
map.put("consumerId",consumerId); map.put("consumerId",cookie.get("cid").toString());
logger.info("用户信息为,uid="+uid+"consumerId="+consumerId); logger.info("用户信息为,uid="+uid+"consumerId="+cookie.get("cid").toString());
return map; return map;
} }
......
...@@ -30,6 +30,7 @@ import java.util.Map; ...@@ -30,6 +30,7 @@ import java.util.Map;
* @create 2018/10/17 * @create 2018/10/17
* @since 1.0.0 * @since 1.0.0
*/ */
//5个case
public class 新集卡_开奖异常_DuibaTest extends DuibaTestBase { public class 新集卡_开奖异常_DuibaTest extends DuibaTestBase {
......
...@@ -35,6 +35,7 @@ import java.util.Map; ...@@ -35,6 +35,7 @@ import java.util.Map;
* @create 2018/10/15 * @create 2018/10/15
* @since 1.0.0 * @since 1.0.0
*/ */
//16个case
public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase { public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
@Autowired @Autowired
......
...@@ -11,6 +11,7 @@ package http.cases.PkTest; ...@@ -11,6 +11,7 @@ package http.cases.PkTest;
import base.DuibaLog; import base.DuibaLog;
import base.DuibaTestBase; import base.DuibaTestBase;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.model.BetMobileVo; import http.model.BetMobileVo;
import http.service.Activity.PkService; import http.service.Activity.PkService;
import io.restassured.response.Response; import io.restassured.response.Response;
...@@ -61,8 +62,11 @@ public class pk_列表测试_AccessTest extends DuibaTestBase { ...@@ -61,8 +62,11 @@ public class pk_列表测试_AccessTest extends DuibaTestBase {
logger.info("未参加过押注用户的列表数据校验成功,unbetList的信息为"+ JSON.toJSONString(unbetList)); logger.info("未参加过押注用户的列表数据校验成功,unbetList的信息为"+ JSON.toJSONString(unbetList));
Response response_uid_18816 = pkService.getBetList(uid_18816); Response response_uid_18816 = pkService.getBetList(uid_18816);
logger.info("response_uid_18816"+ JSONObject.toJSONString(response_uid_18816.prettyPrint()));
List<BetMobileVo> betedList_uid_18816 = response_uid_18816.jsonPath().getList("data.betedList",BetMobileVo.class); List<BetMobileVo> betedList_uid_18816 = response_uid_18816.jsonPath().getList("data.betedList",BetMobileVo.class);
logger.info("betedList_uid_18816的信息为"+ JSONObject.toJSONString(betedList_uid_18816));
List<BetMobileVo> unbetList_uid_18816 = response_uid_18816.jsonPath().getList("data.unbetList",BetMobileVo.class); List<BetMobileVo> unbetList_uid_18816 = response_uid_18816.jsonPath().getList("data.unbetList",BetMobileVo.class);
logger.info("unbetList_uid_188166的信息为"+ JSONObject.toJSONString(unbetList_uid_18816));
Assert.assertEquals(String.valueOf(unbetList_uid_18816.size()),"0","已投注的活动为0校验失败"); Assert.assertEquals(String.valueOf(unbetList_uid_18816.size()),"0","已投注的活动为0校验失败");
Assert.assertEquals(String.valueOf(betedList_uid_18816.size()),"0","未投注的活动为0校验失败"); Assert.assertEquals(String.valueOf(betedList_uid_18816.size()),"0","未投注的活动为0校验失败");
logger.info("没有添加pk楼层,用户的列表数据校验成功,均为空,betedList_uid_18816="+ JSON.toJSONString(betedList_uid_18816)+"\nunbetList_uid_18816="+ JSON.toJSONString(unbetList_uid_18816)); logger.info("没有添加pk楼层,用户的列表数据校验成功,均为空,betedList_uid_18816="+ JSON.toJSONString(betedList_uid_18816)+"\nunbetList_uid_18816="+ JSON.toJSONString(unbetList_uid_18816));
......
/**
* Copyright (C), 2015-2018
* FileName: pk_开奖_瓜分红包_押注人数不同测试_AccessTest
* Author: qianwenjun
* Date: 2018/8/9 20:13
* Description:
*/
package http.cases.PkTest;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject;
import http.model.BetMngVo;
import http.service.Activity.PkService;
import http.service.Manager.EditManagerInfoService;
import http.service.Manager.PkActivityService;
import io.restassured.response.Response;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import utils.GetCookieUtil;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static io.restassured.RestAssured.form;
import static io.restassured.RestAssured.given;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_开奖_批量用户开奖测试 extends DuibaTestBase {
@Autowired
PkService pkService;
@Autowired
PkActivityService pkActivityService;
@Autowired
EditManagerInfoService editManagerInfoService;
private static DuibaLog logger = DuibaLog.getLogger();
private String groupId = "7";
private String newBetId = "";
private List<String> optionsIds = new ArrayList<>();
private List<String> consumerIds = new ArrayList<>();
@BeforeMethod
//注意初始化的方法不能与父类的相同,会被覆盖住
public void setUpPkActivity() {
try {
createPk("2","2020-08-12 00:00:00",groupId);
}catch (Exception e){
e.printStackTrace();
}
}
@Test
public void 瓜分红包_批量用户开奖测试() throws Exception{
List<Map<String,Object>> pks = jdbc.findModeResult("select * from act_com_conf.tb_bet_option where bet_id = ?",newBetId);
logger.info("pk活动信息为"+JSONObject.toJSONString(pks));
for (int i=0;i<pks.size();i++){
optionsIds.add(pks.get(i).get("id").toString());
}
logger.info("pk活动id为:"+newBetId+",选项id为:"+ optionsIds.toString());
for (int i=0;i<101;i++){
Map<String,String> user = createUser();
consumerIds.add(user.get("consumerId"));
Response res = pkService.doJoin(Integer.valueOf(user.get("uid")),newBetId,optionsIds.get(0));
}
logger.info("用户的consumerId为="+consumerIds.toString());
//修改开奖时间
this.modifyOpenPrizeTime(newBetId);
//调用开奖接口
Response doDrowRresponse = pkActivityService.doDraw();
Assert.assertEquals(doDrowRresponse.jsonPath().getString("success"),"true","开奖结果校验失败");
Assert.assertEquals(doDrowRresponse.jsonPath().getString("data"),"开奖中。。。","开奖messag校验失败");
Thread.sleep(8000);
//校验点
//1、pk活动表配置的状态更新为4;2、订单表的addCredits字段为瓜分的红包值;3、先押注 的选项为胜方,胜负的额押注人数>负方的押注人数
this.checkPKConfig();
this.checkUserAccount(consumerIds);
this.checkRecord();
Map<String,Object> bet1Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ?\n",newBetId,optionsIds.get(0));
Assert.assertEquals(bet1Result.get("rank").toString(),"1","开始押注的选项获胜校验失败");
Map<String,Object> bet2Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ?\n",newBetId,optionsIds.get(1));
Assert.assertEquals(bet2Result.get("rank").toString(),"2","开始押注的选项获胜校验失败");
Long bet1Times = Long.valueOf(bet1Result.get("bet_times").toString());
Long bet2Times = Long.valueOf(bet2Result.get("bet_times").toString());
Assert.assertTrue(bet1Times>bet2Times,"活动获胜人数比失败人数多校验失败");
logger.info("选项1的押注人数为:"+bet1Result.get("bet_times").toString()+",选项2的押注人数为:"+bet2Result.get("bet_times").toString());
}
public void createPk(String bounsType,String endTime,String groupId) throws Exception {
Response betResponse = pkActivityService.betForSetUp(bounsType,endTime);
logger.info("新建pk活动的结果信息为"+JSONObject.toJSONString(betResponse.prettyPrint()));
betResponse.prettyPrint();
String betId = betResponse.jsonPath().getString("data");
// String betId = MatcherString.getString(betResponse.asString(),"\"data\": (\\w*)",1);
newBetId = betId;
logger.info("newBetId的信息为"+newBetId);
Response betRelation = pkActivityService.betGroupRelation(betId,endTime,groupId);
Response modifyStatusResponse = pkActivityService.modifySatus(betId);
}
public void modifyOpenPrizeTime(String betId) throws Exception{
DateTime time1 = new DateTime();
int x=20+(int)(Math.random()*100);
DateTime endTime = time1.minusMillis(x);
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
String endTimeStr = format.print(endTime.getMillis()).toString();
// String endTimeStr = "2018-11-26 20:24:39";
logger.info("\ntime1="+ format.print(time1.getMillis())+"\n设置的开奖时间endTime="+ endTimeStr);
Boolean result1 = jdbc.update("update act_com_conf.tb_bet_config set end_time = ? where id = ?\n",endTimeStr,betId);
Boolean result2 = jdbc.update("update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = ?\n",endTimeStr,betId);
}
public Map<String,String> createUser() throws Exception{
Map<String,String> map = new HashMap<>();
Response response = editManagerInfoService.createUser("pk活动批量开奖测试用户");
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = 'pk活动批量开奖测试用户' and app_id = '67'\n");
String uid = user.get("id").toString();
String url = GetCookieUtil.genUrl(uid,"3erv8LvBxKBSyuGK5i8FSGyYoFD1");
JSONObject cookie = GetCookieUtil.getConsumerIdFromCookie(url);
map.put("uid",uid);
map.put("consumerId",cookie.get("cid").toString());
logger.info("用户信息为,uid="+uid+"consumerId="+cookie.get("cid").toString());
return map;
}
public void checkPKConfig() throws Exception{
Map<String,Object> betConfig = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_config where id = ?",newBetId);
logger.info("betConfig的信息为:"+ JSONObject.toJSONString(betConfig));
Assert.assertEquals(betConfig.get("config_status").toString(),"4","配置表状态更新失败");
Map<String,Object> betGroupRelation = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_group_relation where bet_id = ?\n",newBetId);
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Response betList = pkActivityService.getMngBetList();
betList.prettyPrint();
List<BetMngVo> betMngVoList = betList.jsonPath().getList("data.page",BetMngVo.class);
for (BetMngVo bet:betMngVoList){
if (bet.getId().equals(newBetId)){
Assert.assertEquals(bet.getConfigStatus(),"4","开奖结果校验失败");
}
}
}
public void checkUserAccount(List<String> comsumerIds) throws Exception{
for (int i=0;i<comsumerIds.size();i++){
String dbName = "consumer_accounts.tb_consumer_account_"+ String.format("%04d", Long.parseLong(comsumerIds.get(i)) % 1024);
logger.info("用户的分表名dbName为"+dbName);
Map<String,Object> user_account = jdbc.findSimpleResult("select * from "+dbName+" where consumer_id = ? and account_type = '6'\n",consumerIds.get(i));
Long account = Long.valueOf(user_account.get("balance_amount").toString());
Assert.assertEquals(account.toString(),"10","用户入账校验失败");
}
}
public void checkRecord() throws Exception{
List<Map<String,Object>> useRecord = jdbc.findModeResult("select * from act_record.tb_bet_record where bet_id = ? \n",newBetId);
for (int i=0;i<useRecord.size();i++) {
Assert.assertEquals(useRecord.get(i).get("bonus").toString(), "10", "record表的红包值校验失败");
Assert.assertEquals(useRecord.get(i).get("exchange_status").toString(), "2", "record表的发奖状态校验失败");
}
}
public void clear(List<String> comsumerIds) throws Exception{
Boolean res = jdbc.update("delete from dafuweng.user where name = 'pk活动批量开奖测试用户' and app_id = '67'");
for(int i=0;i<comsumerIds.size();i++){
String dbName = "new_consumer.consumer_"+ String.format("%04d", Long.parseLong(comsumerIds.get(i))/10000000);
logger.info("用户的分表名dbName为"+dbName);
Boolean res1 = jdbc.update("delete from "+dbName+" where id = ?",comsumerIds.get(i));
}
}
@AfterClass
public void tearDown() {
try {
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%'");
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
clear(consumerIds);
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
}
}
\ No newline at end of file
/**
* Copyright (C), 2015-2018
* FileName: pk_开奖_瓜分红包_押注人数不同测试_AccessTest
* Author: qianwenjun
* Date: 2018/8/9 20:13
* Description:
*/
package http.cases.PkTest;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject;
import http.model.BetMngVo;
import http.model.BetMobileVo;
import http.service.Activity.PkService;
import http.service.Manager.PkActivityService;
import io.restassured.response.Response;
import org.joda.time.format.DateTimeFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import utils.MatcherString;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.DateTime;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_开奖_瓜分红包_押注人数不同测试_AccessTest extends DuibaTestBase {
@Autowired
PkService pkService;
@Autowired
PkActivityService pkActivityService;
private static DuibaLog logger = DuibaLog.getLogger();
private String groupId = "7";
private Integer user01 = 3445;
private String consumerId01 = "100066364";//activity_order_con.tb_trade_center_activity_order_0060
private Integer user02 = 3446;
private String consumerId02 = "100066365";//activity_order_con.tb_trade_center_activity_order_0061
private Integer user03 = 3447;
private String consumerId03 = "100066366";//activity_order_con.tb_trade_center_activity_order_0062
private Integer user04 = 3448;
private String consumerId04 = "100066367";//activity_order_con.tb_trade_center_activity_order_0063
private String newBetId = "";
private List<String> optionsIds = new ArrayList<>();
@BeforeMethod
//注意初始化的方法不能与父类的相同,会被覆盖住
public void setUpPkActivity() {
try {
createPk("2","2020-08-12 00:00:00",groupId);
}catch (Exception e){
e.printStackTrace();
}
}
@Test
public void 瓜分红包_两个选项_押注人数不同_开奖测试() throws Exception{
List<Map<String,Object>> pks = jdbc.findModeResult("select * from act_com_conf.tb_bet_option where bet_id = ?",newBetId);
logger.info("pk活动信息为"+JSONObject.toJSONString(pks));
for (int i=0;i<pks.size();i++){
optionsIds.add(pks.get(i).get("id").toString());
}
logger.info("pk活动id为:"+newBetId+",选项id为:"+ optionsIds.toString());
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0060 where consumer_id = '100066364' and account_type = '6'\n");
Long use1_Acc1 = Long.valueOf(user01_account1.get("balance_amount").toString());
Map<String,Object> user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0061 where consumer_id = '100066365' and account_type = '6'\n");
Long use2_Acc1 = Long.valueOf(user02_account1.get("balance_amount").toString());
Map<String,Object> user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0062 where consumer_id = '100066366' and account_type = '6'\n");
Long use3_Acc1 = Long.valueOf(user03_account1.get("balance_amount").toString());
Map<String,Object> user04_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0063 where consumer_id = '100066367' and account_type = '6'\n");
Long use4_Acc1 = Long.valueOf(user04_account1.get("balance_amount").toString());
//押注第一个选项:user01,user02
//押注第二个选项:user03,user04
Response res1 = pkService.doJoin(user01,newBetId,optionsIds.get(0));
Response res2 = pkService.doJoin(user02,newBetId,optionsIds.get(1));
Response res3 = pkService.doJoin(user03,newBetId,optionsIds.get(1));
Response res4 = pkService.doJoin(user04,newBetId,optionsIds.get(1));
//修改开奖时间
this.modifyOpenPrizeTime(newBetId,60);
//调用开奖接口
Response doDrowRresponse = pkActivityService.doDraw();
Assert.assertEquals(doDrowRresponse.jsonPath().getString("success"),"true","开奖结果校验失败");
Assert.assertEquals(doDrowRresponse.jsonPath().getString("data"),"开奖中。。。","开奖messag校验失败");
Thread.sleep(8000);
//校验点
//1、pk活动表配置的状态更新为4;2、订单表的addCredits字段为瓜分的红包值;3、先押注 的选项为胜方,胜负的额押注人数>负方的押注人数,4、校验account表的红包值加上去
Map<String,Object> betConfig = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_config where id = ?",newBetId);
logger.info("betConfig的信息为:"+ JSONObject.toJSONString(betConfig));
Assert.assertEquals(betConfig.get("config_status").toString(),"4","配置表状态更新失败");
Map<String,Object> betGroupRelation = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_group_relation where bet_id = ?\n",newBetId);
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Response betList = pkActivityService.getMngBetList();
betList.prettyPrint();
List<BetMngVo> betMngVoList = betList.jsonPath().getList("data.page",BetMngVo.class);
for (BetMngVo bet:betMngVoList){
if (bet.getId().equals(newBetId)){
Assert.assertEquals(bet.getConfigStatus(),"4","开奖结果校验失败");
}
}
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0060 where consumer_id = '100066364' and duiba_activity_id = ?\n",newBetId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0061 where consumer_id = '100066365' and duiba_activity_id = ?\n",newBetId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"10","开奖后发奖值校验失败");
Map<String,Object> user03_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0062 where consumer_id = '100066366' and duiba_activity_id = ?\n",newBetId);
Assert.assertEquals(user03_order.get("add_credits").toString(),"10","开奖后发奖值校验失败");
Map<String,Object> user04_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0063 where consumer_id = '100066367' and duiba_activity_id = ?\n",newBetId);
Assert.assertEquals(user04_order.get("add_credits").toString(),"10","开奖后发奖值校验失败");
logger.info("用户01获取的红包值为:"+user01_order.get("add_credits").toString()+",用户02获取的红包值为:"+user02_order.get("add_credits").toString());
logger.info("用户03获取的红包值为:"+user03_order.get("add_credits").toString()+",用户04获取的红包值为:"+user04_order.get("add_credits").toString());
Map<String,Object> bet1Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ?\n",newBetId,optionsIds.get(0));
Assert.assertEquals(bet1Result.get("rank").toString(),"2","开始押注的选项获胜校验失败");
Map<String,Object> bet2Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ?\n",newBetId,optionsIds.get(1));
Assert.assertEquals(bet2Result.get("rank").toString(),"1","开始押注的选项获胜校验失败");
Long bet1Times = Long.valueOf(bet1Result.get("bet_times").toString());
Long bet2Times = Long.valueOf(bet2Result.get("bet_times").toString());
Assert.assertTrue(bet1Times<bet2Times,"活动获胜人数比失败人数多校验失败");
logger.info("选项1的押注人数为:"+bet1Result.get("bet_times").toString()+",选项2的押注人数为:"+bet2Result.get("bet_times").toString());
Map<String,Object> user01_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0060 where consumer_id = '100066364' and account_type = '6'\n");
Long use1_Acc2 = Long.valueOf(user01_account2.get("balance_amount").toString());
Assert.assertEquals(use1_Acc2,use1_Acc1,"用户1入账校验失败");
Map<String,Object> user02_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0061 where consumer_id = '100066365' and account_type = '6'\n");
Long use2_Acc2 = Long.valueOf(user02_account2.get("balance_amount").toString());
Assert.assertEquals(use2_Acc2.toString(),String.valueOf(use2_Acc1+10),"用户2入账校验失败");
Map<String,Object> user03_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0062 where consumer_id = '100066366' and account_type = '6'\n");
Long use3_Acc2 = Long.valueOf(user03_account2.get("balance_amount").toString());
Assert.assertEquals(use3_Acc2.toString(),String.valueOf(use3_Acc1+10),"用户3入账校验失败");
Map<String,Object> user04_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0063 where consumer_id = '100066367' and account_type = '6'\n");
Long use4_Acc2 = Long.valueOf(user04_account2.get("balance_amount").toString());
Assert.assertEquals(use4_Acc2.toString(),String.valueOf(use4_Acc1+10),"用户4入账校验失败");
}
public void createPk(String bounsType,String endTime,String groupId) throws Exception {
Response betResponse = pkActivityService.betForSetUp(bounsType,endTime);
logger.info("新建pk活动的结果信息为"+JSONObject.toJSONString(betResponse.prettyPrint()));
betResponse.prettyPrint();
String betId = betResponse.jsonPath().getString("data");newBetId = betId;
logger.info("newBetId的信息为"+newBetId);
Response betRelation = pkActivityService.betGroupRelation(betId,endTime,groupId);
Response modifyStatusResponse = pkActivityService.modifySatus(betId);
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
DateTime time1 = new DateTime();
// int x=20+(int)(Math.random()*100);
DateTime endTime = time1.minusMillis(x);
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
// String endTimeStr = format.print(endTime.getMillis()).toString();
String endTimeStr = "2018-11-26 20:24:39";
logger.info("\ntime1="+ format.print(time1.getMillis())+"\n设置的开奖时间endTime="+ endTimeStr);
Boolean result1 = jdbc.update("update act_com_conf.tb_bet_config set end_time = ? where id = ?\n",endTimeStr,betId);
Boolean result2 = jdbc.update("update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = ?\n",endTimeStr,betId);
}
// @Test
public void 调试(){
try {
Map<String,Object> betConfig = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_config where id = ?","1179");
logger.info("betConfig的信息为:"+ JSONObject.toJSONString(betConfig));
logger.info("betConfig的信息为:"+ betConfig.toString());
Response betList = pkActivityService.getMngBetList();
betList.prettyPrint();
List<BetMngVo> betMngVoList = betList.jsonPath().getList("data.page",BetMngVo.class);
for (BetMngVo bet:betMngVoList){
if (bet.getId().equals("1185")){
Assert.assertEquals(bet.getConfigStatus(),"4","开奖结果校验失败");
}
}
}catch (Exception e){
e.printStackTrace();
}
}
@AfterClass
public void tearDown() {
try {
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%'");
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
}
}
\ No newline at end of file
/**
* Copyright (C), 2015-2018
* FileName: pk_开奖_瓜分红包_押注人数不同测试_AccessTest
* Author: qianwenjun
* Date: 2018/8/9 20:13
* Description:
*/
package http.cases.PkTest;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject;
import http.model.BetMngVo;
import http.service.Activity.PkService;
import http.service.Manager.PkActivityService;
import io.restassured.response.Response;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import utils.MatcherString;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends DuibaTestBase {
@Autowired
PkService pkService;
@Autowired
PkActivityService pkActivityService;
private static DuibaLog logger = DuibaLog.getLogger();
private String groupId = "7";
private Integer user01 = 4784;
private String consumerId01 = "100108068";//activity_order_con.tb_trade_center_activity_order_0804
private Integer user02 = 4785;
private String consumerId02 = "100108069";//activity_order_con.tb_trade_center_activity_order_0805
private String newBetId = "";
private List<String> optionsIds = new ArrayList<>();
@BeforeMethod
//注意初始化的方法不能与父类的相同,会被覆盖住
public void setUpPkActivity() {
try {
createPk("2","2020-08-12 00:00:00",groupId);
}catch (Exception e){
e.printStackTrace();
}
}
@Test
public void 瓜分红包_两个选项_押注人数相同_开奖测试() throws Exception{
List<Map<String,Object>> pks = jdbc.findModeResult("select * from act_com_conf.tb_bet_option where bet_id = ?",newBetId);
logger.info("pk活动信息为"+JSONObject.toJSONString(pks));
for (int i=0;i<pks.size();i++){
optionsIds.add(pks.get(i).get("id").toString());
}
logger.info("pk活动id为:"+newBetId+",选项id为:"+ optionsIds.toString());
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0804 where consumer_id = '100108068' and account_type = '6'\n");
Long use1_Acc1 = Long.valueOf(user01_account1.get("balance_amount").toString());
Map<String,Object> user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0805 where consumer_id = '100108069' and account_type = '6'\n");
Long use2_Acc1 = Long.valueOf(user02_account1.get("balance_amount").toString());
//押注第一个选项:user01,user02
//押注第二个选项:user03,user04
Response res1 = pkService.doJoin(user01,newBetId,optionsIds.get(0));
Response res2 = pkService.doJoin(user02,newBetId,optionsIds.get(1));
//修改开奖时间
this.modifyOpenPrizeTime(newBetId,120);
//调用开奖接口
Response doDrowRresponse = pkActivityService.doDraw();
Assert.assertEquals(doDrowRresponse.jsonPath().getString("success"),"true","开奖结果校验失败");
Assert.assertEquals(doDrowRresponse.jsonPath().getString("data"),"开奖中。。。","开奖messag校验失败");
Thread.sleep(8000);
//校验点
//1、pk活动表配置的状态更新为4;2、订单表的addCredits字段为瓜分的红包值;3、先押注 的选项为胜方,胜负的额押注人数>负方的押注人数
Map<String,Object> betConfig = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_config where id = ?",newBetId);
logger.info("betConfig的信息为:"+ JSONObject.toJSONString(betConfig));
Assert.assertEquals(betConfig.get("config_status").toString(),"4","配置表状态更新失败");
Map<String,Object> betGroupRelation = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_group_relation where bet_id = ?\n",newBetId);
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Response betList = pkActivityService.getMngBetList();
betList.prettyPrint();
List<BetMngVo> betMngVoList = betList.jsonPath().getList("data.page",BetMngVo.class);
for (BetMngVo bet:betMngVoList){
if (bet.getId().equals(newBetId)){
Assert.assertEquals(bet.getConfigStatus(),"4","开奖结果校验失败");
}
}
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0804 where consumer_id = '100108068' and duiba_activity_id = ?\n",newBetId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"10","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0805 where consumer_id = '100108069' and duiba_activity_id = ?\n",newBetId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
logger.info("用户01获取的红包值为:"+user01_order.get("add_credits").toString()+",用户02获取的红包值为:"+user02_order.get("add_credits").toString());
Map<String,Object> bet1Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ?\n",newBetId,optionsIds.get(0));
Assert.assertEquals(bet1Result.get("rank").toString(),"1","开始押注的选项获胜校验失败");
Map<String,Object> bet2Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ?\n",newBetId,optionsIds.get(1));
Assert.assertEquals(bet2Result.get("rank").toString(),"2","开始押注的选项获胜校验失败");
Long bet1Times = Long.valueOf(bet1Result.get("bet_times").toString());
Long bet2Times = Long.valueOf(bet2Result.get("bet_times").toString());
Assert.assertTrue(bet1Times>bet2Times,"活动获胜人数比失败人数多校验失败");
logger.info("选项1的押注人数为:"+bet1Result.get("bet_times").toString()+",选项2的押注人数为:"+bet2Result.get("bet_times").toString());
Map<String,Object> user01_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0804 where consumer_id = '100108068' and account_type = '6'\n");
Long use1_Acc2 = Long.valueOf(user01_account2.get("balance_amount").toString());
Assert.assertEquals(use1_Acc2.toString(),String.valueOf(use1_Acc1+10),"用户2入账校验失败");
Map<String,Object> user02_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0805 where consumer_id = '100108069' and account_type = '6'\n");
Long use2_Acc2 = Long.valueOf(user02_account2.get("balance_amount").toString());
Assert.assertEquals(use2_Acc2,use2_Acc1,"用户2入账校验失败");
}
public void createPk(String bounsType,String endTime,String groupId) throws Exception {
Response betResponse = pkActivityService.betForSetUp(bounsType,endTime);
logger.info("新建pk活动的结果信息为"+JSONObject.toJSONString(betResponse.prettyPrint()));
betResponse.prettyPrint();
String betId = betResponse.jsonPath().getString("data");
// String betId = MatcherString.getString(betResponse.asString(),"\"data\": (\\w*)",1);
newBetId = betId;
logger.info("newBetId的信息为"+newBetId);
Response betRelation = pkActivityService.betGroupRelation(betId,endTime,groupId);
Response modifyStatusResponse = pkActivityService.modifySatus(betId);
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
DateTime time1 = new DateTime();
// int x=20+(int)(Math.random()*100);
DateTime endTime = time1.minusMillis(x);
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
// String endTimeStr = format.print(endTime.getMillis()).toString();
String endTimeStr = "2018-11-26 20:24:39";
logger.info("\ntime1="+ format.print(time1.getMillis())+"\n设置的开奖时间endTime="+ endTimeStr);
Boolean result1 = jdbc.update("update act_com_conf.tb_bet_config set end_time = ? where id = ?\n",endTimeStr,betId);
Boolean result2 = jdbc.update("update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = ?\n",endTimeStr,betId);
}
@AfterClass
public void tearDown() {
try {
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%'");
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
}
}
\ No newline at end of file
/**
* Copyright (C), 2015-2018
* FileName: pk_开奖_瓜分红包测试
* Author: qianwenjun
* Date: 2018/8/9 20:13
* Description:
*/
package http.cases.PkTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.model.BetMobileVo;
import http.service.Activity.PkService;
import http.service.Manager.PkActivityService;
import io.restassured.response.Response;
import org.joda.time.format.DateTimeFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import utils.MatcherString;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.DateTime;
import java.util.ArrayList;
import java.util.List;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_开奖_瓜分红包测试 extends DuibaTestBase {
@Autowired
PkService pkService;
@Autowired
PkActivityService pkActivityService;
private static DuibaLog logger = DuibaLog.getLogger();
private String groupId = "7";
private Integer user01 = 3445;
private Integer user02 = 3446;
private Integer user03 = 3447;
private Integer user04 = 3448;
private String newBetId = "";
private List<String> optionsIds = new ArrayList<>();
@BeforeMethod
public void beforeMethod() {
try {
createPk("2","2020-08-12 00:00:00",groupId);
}catch (Exception e){
e.printStackTrace();
}
}
@Test
public void 瓜分红包_两个选项_押注人数相同_开奖测试() throws Exception{
Response betList = pkService.getBetList(3445);
List<BetMobileVo> betMobileVoList = betList.jsonPath().getList("data.unbetList",BetMobileVo.class);
for (BetMobileVo bet:betMobileVoList){
if (bet.getBetConfig().getId().equals(newBetId)){
for (int i=0;i<bet.getOptions().size();i++){
optionsIds.add(bet.getOptions().get(i).getOptionId());
}
}
}
//押注第一个选项:user01,user02
//押注第二个选项:user03,user04
Response res1 = pkService.doJoin(user01,newBetId,optionsIds.get(0));
Response res2 = pkService.doJoin(user02,newBetId,optionsIds.get(0));
Response res3 = pkService.doJoin(user03,newBetId,optionsIds.get(1));
Response res4 = pkService.doJoin(user04,newBetId,optionsIds.get(1));
//修改开奖时间
this.modifyOpenPrizeTime();
int i=8;
}
public void createPk(String bounsType,String endTime,String groupId) throws Exception {
Response betResponse = pkActivityService.bet(bounsType,endTime);
String betId = MatcherString.getString(betResponse.asString(),"\"data\": (\\w*)",1);
newBetId = betId;
logger.info("newBetId的信息为"+newBetId);
Response betRelation = pkActivityService.betGroupRelation(betId,endTime,groupId);
Response modifyStatusResponse = pkActivityService.modifySatus(betId);
}
public String modifyOpenPrizeTime() throws Exception{
DateTime time1 = new DateTime();
DateTime endTime = time1.minusMillis(10);
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
String endTimeStr = format.print(endTime.getMillis()).toString();
logger.info("\ntime1="+ format.print(time1.getMillis())+"\n设置的开奖时间endTime="+ endTimeStr);
Boolean result1 = jdbc.update("update act_com_conf.tb_bet_config set end_time = ? where id = \"229\"\n",endTimeStr);
Boolean result2 = jdbc.update("update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = \"229\"\n",endTimeStr);
return endTimeStr;
}
public static void main(String[] args) {
DateTime time1 = DateTime.now();
DateTime time2 = time1.plusMinutes(1);
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
logger.info("\ntime1="+ format.print(time1.getMillis())+"\ntime2="+ format.print(time2.getMillis()));
logger.info("\nendTimeStr="+format.print(time1.getMillis()).toString());
}
}
\ No newline at end of file
...@@ -124,6 +124,44 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase { ...@@ -124,6 +124,44 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
} }
@Test
public void 创建pk活动_瓜分优惠券测试() {
try {
Response oldBetList = pkActivityService.getMngBetList();
String oldTotal = oldBetList.jsonPath().getString("data.params.total");
logger.info("创建之前的列表中条数为:"+oldTotal);
createPk("3");
Response newBetList = pkActivityService.getMngBetList();
String newTotal = newBetList.jsonPath().getString("data.params.total");
logger.info("创建之前的列表中条数为:"+oldTotal+"创建之后的列表中条数为:"+newTotal);
Assert.assertEquals(String.valueOf(Long.valueOf(newTotal)-1L),oldTotal,"新建之后列表获取数据校验失败");
List<BetMngVo> betList = newBetList.jsonPath().getList("data.page",BetMngVo.class);
logger.info("betIds"+JSON.toJSONString(betIds));
for (BetMngVo bet:betList){
if (bet.getId().equals(betIds.get("3"))){
logger.info("bet的信息为="+JSON.toJSONString(bet));
Assert.assertEquals(bet.getBetType(),"1","校验pk活动单选单次类型失败");
Assert.assertEquals(bet.getBonusType(),"3","校验pk活动瓜分类型失败");
Assert.assertEquals(bet.getBonusAmount(),"0.00","校验pk活动瓜分类型失败");
Assert.assertEquals(bet.getTitle(),"【自动化】新建pk活动-瓜分优惠券","校验pk活动名称失败");
Assert.assertEquals(bet.getConfigStatus(),"3","校验pk活动状态失败");
Assert.assertEquals(bet.getEndTime(),"2021-12-31 23:55","校验pk活动结束时间失败");
Assert.assertEquals(bet.getPluginId(),"12","校验插件id失败");
Assert.assertEquals(bet.getPrizeLimit(),"1000","校验奖品发放上限失败");
}else{
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Test @Test
public void 创建pk活动组_无投放渠道(){ public void 创建pk活动组_无投放渠道(){
...@@ -211,8 +249,8 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase { ...@@ -211,8 +249,8 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
public void tearDown() { public void tearDown() {
try { try {
Boolean result = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\")\n"); Boolean result = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\" OR title = \"【自动化】新建pk活动-瓜分红包\")\n");
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\"\n"); Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\" OR title = \"【自动化】新建pk活动-瓜分优惠券\"\n");
Boolean result2 = jdbc.update("delete from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组')"); Boolean result2 = jdbc.update("delete from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组')");
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组'"); Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组'");
...@@ -220,6 +258,10 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase { ...@@ -220,6 +258,10 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
Boolean result4 = jdbc.update("delete from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放')"); Boolean result4 = jdbc.update("delete from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放')");
Boolean result5 = jdbc.update("delete from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放'"); Boolean result5 = jdbc.update("delete from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放'");
Boolean result6 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title = '【自动化】新建pk活动-瓜分红包')");
Boolean result7 = jdbc.update("delete from act_com_conf.tb_bet_config where title = '【自动化】新建pk活动-瓜分红包'");
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -11,6 +11,7 @@ import base.DuibaLog; ...@@ -11,6 +11,7 @@ import base.DuibaLog;
import base.DuibaTestBase; import base.DuibaTestBase;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.service.Authorization; import http.service.Authorization;
import http.service.Manager.EditManagerInfoService; import http.service.Manager.EditManagerInfoService;
import http.service.app.SeckillService; import http.service.app.SeckillService;
...@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import utils.GetCookieUtil;
import utils.MatcherString; import utils.MatcherString;
import java.util.HashMap; import java.util.HashMap;
...@@ -178,12 +180,13 @@ public class 天天秒杀_秒杀活动兑换测试_SeckillTest extends DuibaTest ...@@ -178,12 +180,13 @@ public class 天天秒杀_秒杀活动兑换测试_SeckillTest extends DuibaTest
Map<String,String> map = new HashMap<>(); Map<String,String> map = new HashMap<>();
Response response = editManagerInfoService.createUser("qwj测试秒杀用户"); Response response = editManagerInfoService.createUser("qwj测试秒杀用户");
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = 'qwj测试秒杀用户' and app_id = '67'\n"); Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = 'qwj测试秒杀用户' and app_id = '67'\n");
String uid = user.get("id").toString(); String uid = user.get("id").toString();
String url = "http://47.97.214.108/user/loginDuiba?uid=" + uid; String url = GetCookieUtil.genUrl(uid,"3erv8LvBxKBSyuGK5i8FSGyYoFD1");
Response login = given().get(url); JSONObject cookie = GetCookieUtil.getConsumerIdFromCookie(url);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = '18816'\n",uid); String consumerId = cookie.get("cid").toString();
String consumerId = consumer.get("id").toString();
Boolean res = jdbc.update("UPDATE new_consumer.consumer_0010 set addr_name = 'qwj' , addr_phone = '18143476563' ,addr_province = '浙江省' ,addr_city = '杭州市' " + Boolean res = jdbc.update("UPDATE new_consumer.consumer_0010 set addr_name = 'qwj' , addr_phone = '18143476563' ,addr_province = '浙江省' ,addr_city = '杭州市' " +
", addr_area = '西湖区' , addr_detail = '奖池花印' where partner_user_id = ? and app_id = '18816'\n",uid); ", addr_area = '西湖区' , addr_detail = '奖池花印' where partner_user_id = ? and app_id = '18816'\n",uid);
map.put("uid",uid); map.put("uid",uid);
......
package http.cases.SignTest;
import base.DuibaLog;
import base.DuibaTestBase;
import base.MysqlConnPool;
import base.MysqlUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.service.Activity.ManagerService;
import http.service.Activity.ContractSignService;
import http.service.Authorization;
import http.service.hd.SigninService;
import io.restassured.response.Response;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.testng.Assert;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import static io.restassured.RestAssured.given;
@Service
public class ContractSignCommon extends DuibaTestBase{
@Autowired
SigninService signinService;
@Autowired
Authorization authorization;
@Autowired
ContractSignService ContractSignService;
@Autowired
ManagerService managerService;
@Value("${activity.host}")
String activityHost;
private DuibaLog logger = DuibaLog.getLogger();
public Map<String, String> doJoinResult(String activityId, String betAmount, int uid) throws Exception {
Response doJoinRes = ContractSignService.doJoin(activityId, betAmount, uid);
String contractId = doJoinRes.jsonPath().getString("data.contractId");
Map<String, String> map = new HashMap<>();
map.put("totalCount", doJoinRes.jsonPath().getString("data.betCount"));
map.put("buyers", doJoinRes.jsonPath().getString("data.buyers"));
map.put("cycle", doJoinRes.jsonPath().getString("data.contractCycle"));
map.put("contractId", doJoinRes.jsonPath().getString("data.contractId"));
map.put("issueId", doJoinRes.jsonPath().getString("data.issueId"));
map.put("startTime", doJoinRes.jsonPath().getString("data.startTime"));
map.put("endTime", doJoinRes.jsonPath().getString("data.endTime"));
int count = 15;
Response betStatusRes = ContractSignService.betStatus(contractId, uid);
map.put("betCount", betStatusRes.jsonPath().getString("data.betCount"));
String status = "INIT";
String statusDesc = "";
while (count > 0 && status.equals("INIT")){
Thread.sleep(500);
betStatusRes = ContractSignService.betStatus(contractId, uid);
status = betStatusRes.jsonPath().getString("data.doneStatus");
statusDesc = betStatusRes.jsonPath().getString("data.doneStatusDesc");
count --;
}
map.put("doneStatus", status);
logger.info("报名status:" + status);
map.put("doneStatusDesc", statusDesc);
return map;
}
public void clearIssue(String consumerId, String actId, MysqlConnPool jdbc){
try {
Map<String, Object> result = jdbc.findSimpleResult("select id, issue_id from credits_sign.tb_sign_contract_bet where consumer_id="+ consumerId+" and act_id="+ actId);
if(!result.isEmpty()) {
String issueId = result.get("issue_id").toString();
//String contractId = result.get("id").toString();
jdbc.update("delete from credits_sign.tb_sign_contract_issue where id=" + issueId);
jdbc.update("delete from credits_sign.tb_sign_contract_bet where issue_id=" + issueId);
jdbc.update("delete from credits_sign.tb_sign_contract_log where issue_id=" + issueId);
}
}catch (SQLException e){
logger.info("数据库更新异常");
}
}
public void modifyJoinTime(String actId, String date, String startTime, String endTime) throws Exception{
Map<String, Object> map = new HashMap<>();
map.put("title", "自动化_报名截止时间");
map.put("betCount", "1000");
map.put("bonusType","0");
map.put("betType","2");
map.put("bankerBonus", "10000");
map.put("ruleDesc:", "<p>bao ming&nbsp;截止时间</p>");
map.put("contractCycle","7");
map.put("joinTimeLimit", false);
map.put("fakeLimit", false);
map.put("rankPeriod","1");
map.put("joinTimeStart", startTime);
map.put("joinTimeEnd", endTime);
map.put("joinDeadLine", date);
map.put("actId", actId);
map.put("openStatus", true);
map.put("gradientAmountList","");
map.put("freeJoinLimit", "0");
map.put("enableAmpifyCard",false);
map.put("openType", "0");
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(map));
Response response = given().contentType("application/json;charset=UTF-8").cookies(authorization.ssoLogin()).body(jsonObject).post("https://mng.duibatest.com.cn/newmanager/signContract/save");
response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("success"), "true", "/signContract/save接口失败");
} catch (Exception e) {
throw new Exception("/signContract/save接口失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("/signContract/save接口失败,返回信息:" + response.asString());
}
}
public void modifyIssuePeriod(String issueId, int num) throws Exception{
String sql = "select start_time,end_time from credits_sign.tb_sign_contract_issue where id=" + issueId;
Map<String, Object> result = jdbc.findSimpleResult(sql);
String issueStartTime = result.get("start_time").toString();
String issueEndTime = result.get("end_time").toString();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//SimpleDateFormat sdf2 = new SimpleDateFormat("MM-dd");
try {
Date startDate=sdf.parse(issueStartTime);
Date endDate=sdf.parse(issueEndTime);
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);
calendar.add(Calendar.DAY_OF_YEAR, num);
String startTime = sdf.format(calendar.getTime());
calendar.setTime(endDate);
calendar.add(Calendar.DAY_OF_YEAR, num);
String endTime = sdf.format(calendar.getTime());
String sql2 = "update credits_sign.tb_sign_contract_issue set start_time='" +startTime +"', end_time='"+endTime+"' where id="+ issueId;
try{
jdbc.update(sql2);
}catch (SQLException e) {
logger.info("数据库更新异常");
}
} catch(ParseException px) {
px.printStackTrace();
}
}
/**
* 补签今日之前的日期
* @param actId
* @param uid
* @param num 当前所在周期内第几天
* @param isBlock 不补签昨天
* @throws Exception
*/
public void contractResign(String actId, int uid, int num, boolean isBlock) throws Exception{
//查询issueId,contractId
Response res = ContractSignService.getContracts(actId, uid);
// 接口返回的第一条信息为最近参与的记录
String issueId = res.jsonPath().getString("data.list[0].issueId");
String contractId = res.jsonPath().getString("data.list[0].contractId");
if (StringUtils.isNotBlank(issueId) && StringUtils.isNotBlank(contractId)) {
// 查询签到历史记录
String queryLog = "select sign_date from credits_sign.tb_sign_contract_log where contract_id=" + contractId;
List<Map<String, Object>> result = jdbc.findModeResult(queryLog);
String signedDate;
List<String> dateList = new ArrayList<>();
for (int i = 0; i < result.size(); i++) {
signedDate = result.get(i).get("sign_date").toString();
dateList.add(signedDate);
}
String queryBet = "select consumer_id from credits_sign.tb_sign_contract_bet where id=" + contractId;
Map<String, Object> betResult = jdbc.findSimpleResult(queryBet);
String consumerId = betResult.get("consumer_id").toString();
// 查询期次开始时间
String queryPeriod = "select start_time, end_time, contract_cycle, winners from credits_sign.tb_sign_contract_issue where id=" + issueId;
Map<String, Object> issueResult = jdbc.findSimpleResult(queryPeriod);
String startDate = issueResult.get("start_time").toString();
String endDate = issueResult.get("end_time").toString();
int cycle = Integer.valueOf(issueResult.get("contract_cycle").toString());
String winners = issueResult.get("winners").toString();
//需要打卡的日期
int period = num;
int flag = 0;
if (num > cycle) {
period = cycle + 1;
}
if (isBlock && result.size() == 0) {
flag = 1;
}
List<String> signDateList = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date startTime = sdf.parse(startDate);
Calendar calendar = Calendar.getInstance();
calendar.setTime(startTime);
String signDate;
for (int i = 1; i < period - flag; i++) {
signDate = sdf.format(calendar.getTime());
if (!dateList.contains(signDate)) {
signDateList.add(signDate);
}
calendar.add(Calendar.DAY_OF_YEAR, 1);
}
String updateBet;
String updateLog;
if (num <= cycle) {
updateBet = "update credits_sign.tb_sign_contract_bet set done_days=" + String.valueOf(num - 1 - flag) + " where id=" + contractId;
try {
jdbc.update(updateBet);
if (signDateList.size() > 0) {
for (int i = 0; i < signDateList.size(); i++) {
updateLog = String.format("INSERT INTO credits_sign.tb_sign_contract_log(consumer_id, contract_id, act_id, issue_id, sign_date) VALUES (%s, %s, %s, %s, \'%s\')", consumerId, contractId, actId, issueId, signDateList.get(i));
jdbc.update(updateLog);
logger.info("补签成功");
}
}
} catch (SQLException e) {
logger.info("数据库更新异常");
}
}
}else{
logger.info("未执行补签");
}
}
}
package http.cases.SignTest;
import base.DuibaTestBase;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.hd.SigninService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert;
import org.testng.annotations.Test;
import io.restassured.response.Response;
import java.net.SocketImpl;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import utils.RedisUtil;
import static io.restassured.RestAssured.given;
public class ContractSign_Multi_signTest extends DuibaTestBase {
@Autowired
ContractSignCommon ContractSignCommon;
@Autowired
SigninService signinService;
@Autowired
Authorization authorization;
@Autowired
http.service.Activity.ContractSignService ContractSignService;
@Autowired
ManagerService managerService;
@Value("${activity.host}")
String activityHost;
private static int uid1,uid2,uid3,uid4,uid5,uid6;
static {
uid1 = 4628;//100104096;
uid2 = 4629;//100104097
uid3 = 4630;//100104098
uid4 = 4631;//100104099
uid5 = 4632;//100104101
uid6 = 4633;//100104100
}
private static String actId,betAmount1,betAmount2,betAmount3;
static {
actId = "5";
betAmount1 = "1000";
betAmount2 = "500";
betAmount3 = "100";
}
private String issueId;
private String period;
private String contractId1,contractId2,contractId3,contractId4,contractId5,contractId6;
//@Test(description = "契约签到多梯度报名,活动id=5",priority = 1)
public void 多梯度报名() throws Exception{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat format2 = new SimpleDateFormat("MMdd");
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_YEAR, 1);
date = calendar.getTime();
// 期次开始的时间 yyyy-MM-dd格式
String startTime = format.format(date);
// 期次号 MMDD格式
period = format2.format(date);
calendar.add(Calendar.DAY_OF_YEAR, 6);
date = calendar.getTime();
// 期次结束时间
String endTime = format.format(date);
// uid1 uid2 报名梯度1
Map<String, String> map1 = ContractSignCommon.doJoinResult(actId,betAmount1,uid1);
issueId = map1.get("issueId");
String doneStatus = map1.get("doneStatus");
Assert.assertEquals(doneStatus,"DOING","uid1报名失败:" + doneStatus);
Map<String, String> map2 = ContractSignCommon.doJoinResult(actId,betAmount1,uid2);
doneStatus = map2.get("doneStatus");
Assert.assertEquals(doneStatus,"DOING","uid2报名失败:" + doneStatus);
// uid3 uid4 报名梯度2
Map<String, String> map3 = ContractSignCommon.doJoinResult(actId,betAmount2,uid3);
doneStatus = map3.get("doneStatus");
Assert.assertEquals(doneStatus,"DOING","uid3报名失败:" + doneStatus);
Map<String, String> map4 = ContractSignCommon.doJoinResult(actId,betAmount2,uid4);
doneStatus = map4.get("doneStatusDesc");
Assert.assertEquals(doneStatus,"DOING","uid4报名失败:" + doneStatus);
//uid5 uid6 报名梯度3
Map<String, String> map5 = ContractSignCommon.doJoinResult(actId,betAmount3,uid5);
doneStatus = map5.get("doneStatusDesc");
Assert.assertEquals(doneStatus,"DOING","uid5报名失败:" + doneStatus);
Map<String, String> map6 = ContractSignCommon.doJoinResult(actId,betAmount3,uid6);
doneStatus = map6.get("doneStatusDesc");
Assert.assertEquals(doneStatus,"DOING","uid6报名失败:" + doneStatus);
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
homeInfoRes.prettyPrint();
String betCount = homeInfoRes.jsonPath().getString("data.betCount");
Assert.assertEquals(betCount, betAmount1, "uid1报名额度显示不正确");
int buyers = homeInfoRes.jsonPath().getInt("data.buyers");
Assert.assertEquals(buyers, 6, "报名后的总人数不正确");
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period, "参与期次号不正确");
String currentPeriod = homeInfoRes.jsonPath().getString("data.currentPeriod");
Assert.assertEquals(currentPeriod, "0", "当前期次进度不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "2", "当前参与状态不正确");
String bankerBonus = homeInfoRes.jsonPath().getString("data.bankerBonus");
Assert.assertEquals(bankerBonus, "10000", "保底奖池数量不正确");
int totalCount = homeInfoRes.jsonPath().getInt("data.betTotalCount");
Assert.assertEquals(totalCount, 13200, "报名后总奖池数量不正确");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid3);
betCount = homeInfoRes.jsonPath().getString("data.betCount");
Assert.assertEquals(betCount,betAmount2,"uid3报名额度显示不正确");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid5);
betCount = homeInfoRes.jsonPath().getString("data.betCount");
Assert.assertEquals(betCount, betAmount3, "uid5报名额度显示不正确");
}
//@Test(description = "多梯度签到,uid1,uid3,uid5, 活动ID=5", priority = 2)
public void 多梯度签到() throws Exception{
//修改期次,今日为打卡第一天
ContractSignCommon.modifyIssuePeriod(issueId, -1);
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MMdd");
SimpleDateFormat sdf2 = new SimpleDateFormat("yy-MM-dd");
period = sdf.format(now);
String today = sdf2.format(now);
// uid1打卡前请求homeInfo接口
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
String currentPeriod = homeInfoRes.jsonPath().getString("data.currentPeriod");
Assert.assertEquals(currentPeriod,"1","当前非打卡第一天");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "3", "未打卡前打卡状态不正确");
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period, "期次号不正确");
int rewardRatio = homeInfoRes.jsonPath().getInt("data.currentIssueRewardRatio");
Assert.assertEquals(rewardRatio, 1320, "未打卡前瓜分比例不正确");
//uid1打卡
Response signRes = ContractSignService.doSign("2", uid1);
String success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "打卡失败");
//查询redis打卡金额
String K030= String.format("SIGNCENTER_K030_%s_%s", issueId, today);
int value = Integer.valueOf(RedisUtil.getKey(K030));
Assert.assertEquals(value, 1000, "当前打卡奖池总额不正确");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
rewardRatio = homeInfoRes.jsonPath().getInt("data.currentIssueRewardRatio");
Assert.assertEquals(rewardRatio, 1320, "未打卡前瓜分比例不正确");
String daySuccCount = homeInfoRes.jsonPath().getString("data.daySuccCount");
Assert.assertEquals(daySuccCount, "1", "打卡后,打卡成功人数不正确");
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "4", "打卡完成后状态不正确");
// uid3打卡前请求homeInfo接口
homeInfoRes = ContractSignService.getHomeInfo(actId, uid3);
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "3", "未打卡前打卡状态不正确");
rewardRatio = homeInfoRes.jsonPath().getInt("data.currentIssueRewardRatio");
Assert.assertEquals(rewardRatio, 880, "打卡后瓜分比例不正确");
//uid3打卡
signRes = ContractSignService.doSign("2", uid3);
success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "打卡失败");
value = Integer.valueOf(RedisUtil.getKey(K030));
Assert.assertEquals(value, 1500, "当前打卡奖池总额不正确");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid3);
rewardRatio = homeInfoRes.jsonPath().getInt("data.currentIssueRewardRatio");
Assert.assertEquals(rewardRatio, 880, "打卡后前瓜分比例不正确");
daySuccCount = homeInfoRes.jsonPath().getString("data.daySuccCount");
Assert.assertEquals(daySuccCount, "2", "打卡后,打卡成功人数不正确");
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "4", "打卡完成后状态不正确");
// uid5打卡前请求homeInfo接口
homeInfoRes = ContractSignService.getHomeInfo(actId, uid5);
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "3", "未打卡前打卡状态不正确");
rewardRatio = homeInfoRes.jsonPath().getInt("data.currentIssueRewardRatio");
Assert.assertEquals(rewardRatio, 825, "打卡后瓜分比例不正确");
//uid5打卡
signRes = ContractSignService.doSign("2", uid5);
success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "打卡失败");
value = Integer.valueOf(RedisUtil.getKey(K030));
Assert.assertEquals(value, 1600, "当前打卡奖池总额不正确");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid5);
rewardRatio = homeInfoRes.jsonPath().getInt("data.currentIssueRewardRatio");
Assert.assertEquals(rewardRatio, 825, "打卡后前瓜分比例不正确");
daySuccCount = homeInfoRes.jsonPath().getString("data.daySuccCount");
Assert.assertEquals(daySuccCount, "3", "打卡后,打卡成功人数不正确");
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "4", "打卡完成后状态不正确");
}
//@Test(description = "多梯度完成打卡",priority = 3)
public void 多梯度完成打卡() throws Exception{
//修改期次,周期再往前移6天
ContractSignCommon.modifyIssuePeriod(actId, -6);
//补签前6天
ContractSignCommon.contractResign(actId, uid2, 7, false);
ContractSignCommon.contractResign(actId, uid4, 7, false);
ContractSignCommon.contractResign(actId, uid6, 7, false);
//今日打卡
Response signRes = ContractSignService.doSign(actId, uid2);
String success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid2第7日打卡失败");
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid2);
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "完成7日打卡状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
String hasRewardTomorrow = homeInfoRes.jsonPath().getString("data.hasRewardTomorrow");
Assert.assertEquals(hasReward, "false", "uid2是否有奖励状态不正确");
Assert.assertEquals(hasRewardTomorrow, "true", "uid2明日是否有奖励状态不正确");
Response recordRes = ContractSignService.getContracts(actId, uid2);
String doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "DONE", "uid2参与记录中完成状态不正确");
signRes = ContractSignService.doSign(actId, uid4);
success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid4第7日打卡失败");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid4);
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "完成7日打卡状态不正确");
hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
hasRewardTomorrow = homeInfoRes.jsonPath().getString("data.hasRewardTomorrow");
Assert.assertEquals(hasReward, "false", "uid4是否有奖励状态不正确");
Assert.assertEquals(hasRewardTomorrow, "true", "uid4明日是否有奖励状态不正确");
recordRes = ContractSignService.getContracts(actId, uid2);
doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "DONE", "uid4参与记录中完成状态不正确");
signRes = ContractSignService.doSign(actId, uid6);
success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid6第7日打卡失败");
homeInfoRes = ContractSignService.getHomeInfo(actId, uid6);
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "完成7日打卡状态不正确");
hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
hasRewardTomorrow = homeInfoRes.jsonPath().getString("data.hasRewardTomorrow");
Assert.assertEquals(hasReward, "false", "uid6是否有奖励状态不正确");
Assert.assertEquals(hasRewardTomorrow, "true", "uid6明日是否有奖励状态不正确");
recordRes = ContractSignService.getContracts(actId, uid2);
doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "DONE", "uid6参与记录中完成状态不正确");
int daySuccCount = homeInfoRes.jsonPath().getInt("data.daySuccCount");
Assert.assertEquals(daySuccCount, 3, "第7日打卡完成人数不正确");
int currentPeriod = homeInfoRes.jsonPath().getInt("data.currentPeriod");
Assert.assertEquals(currentPeriod, 7, "当前期次进度天数不正确");
}
//@Test(description = "开奖", priority = 4)
public void 多梯度开奖() throws Exception{
ContractSignCommon.modifyIssuePeriod(issueId, -1);
//修改redis的打卡日期键值
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd");
String today = sdf.format(now);
Calendar calendar = Calendar.getInstance();
calendar.setTime(now);
calendar.add(Calendar.DAY_OF_YEAR, -1);
String yestertoday = sdf.format(calendar.getTime());
String oldKey = String.format("SIGNCENTER_K030_%s_%s", issueId, today);
String newKey = String.format("SIGNCENTER_k030_%s_%s", issueId, yestertoday);
Map<String, String> map = new HashMap<>();
map.put("key", oldKey);
map.put("newKey", newKey);
Response response = given().params(map).get(activityHost + "/signtest/redis/renameKey");
String result = response.jsonPath().getString("success");
Assert.assertEquals(result, "true", "重命名redis键值失败");
// 查询首页信息
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid2);
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period, "参与期次号不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "当前参与状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
Assert.assertEquals(hasReward, "true", "今日是否有奖励状态不正确");
//查询uid2参与记录
Response recordRes = ContractSignService.getContracts(actId, uid2);
contractId2 = recordRes.jsonPath().getString("data.list[0].contractId");
String doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "WAIT_REWARD", "uid2当前期次完成状态不正确");
String winCount = recordRes.jsonPath().getString("data.list[0].winCount");
Assert.assertEquals(winCount, "8250", "uid2瓜分奖励金额不正确");
//查询uid4参与记录
recordRes = ContractSignService.getContracts(actId, uid4);
contractId4 = recordRes.jsonPath().getString("data.list[0].contractId");
doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "WAIT_REWARD", "uid4当前期次完成状态不正确");
winCount = recordRes.jsonPath().getString("data.list[0].winCount");
Assert.assertEquals(winCount, "4125", "uid4瓜分奖励金额不正确");
//查询uid6参与记录
recordRes = ContractSignService.getContracts(actId, uid6);
contractId6 = recordRes.jsonPath().getString("data.list[0].contractId");
doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "WAIT_REWARD", "uid6当前期次完成状态不正确");
winCount = recordRes.jsonPath().getString("data.list[0].winCount");
Assert.assertEquals(winCount, "825", "uid6瓜分奖励金额不正确");
}
//@Test(description = "多梯度断签",priority = 5)
public void 多梯度断签() throws Exception{
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period, "参与期次号不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "4", "当前参与状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
Assert.assertEquals(hasReward, "false", "今日是否有奖励状态不正确");
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(now);
calendar.add(Calendar.DAY_OF_YEAR, -7);
String startTime = sdf.format(calendar.getTime());
String failDate = homeInfoRes.jsonPath().getString("data.failDate");
// todo del
logger.info(failDate);
Assert.assertEquals(failDate,startTime,"uid1断签日期不正确");
}
//@Test(description = "多梯度领奖",priority = 6)
public void 多梯度领奖() throws Exception{
//uid2领奖
Response rewardRes = ContractSignService.getReward(contractId2,uid2);
int rewardCount = rewardRes.jsonPath().getInt("data");
Assert.assertEquals(rewardCount, 8250, "uid2领取奖励数不正确");
// uid4领奖
rewardRes = ContractSignService.getReward(contractId4,uid4);
rewardCount = rewardRes.jsonPath().getInt("data");
Assert.assertEquals(rewardCount, 4125, "uid4领取奖励数不正确");
// uid6领奖
rewardRes = ContractSignService.getReward(contractId6,uid6);
rewardCount = rewardRes.jsonPath().getInt("data");
Assert.assertEquals(rewardCount, 825, "uid6领取奖励数不正确");
//断签用户uid1领奖
Map<String, String> map = new HashMap<>();
map.put("contractId", contractId1);
rewardRes = given().cookies(authorization.dafuwengLogin(uid1)).params(map).post(activityHost+"/sign/contract/getReward");
String success = rewardRes.jsonPath().getString("success");
String desc = rewardRes.jsonPath().getString("desc");
Assert.assertEquals(success, "false", "uid1领取结果不正确");
Assert.assertEquals(desc,"领奖处理失败","uid1领取描述不正确");
}
//@Test(description = "多梯度中奖轮播",priority = 7)
public void 多梯度中奖轮播() throws Exception{
//删除redis key
String carouselKey = String.format("SIGNCENTER_K034_%s_%s", actId, issueId);
Map<String, String> keyMap = new HashMap<>();
keyMap.put("key", carouselKey);
Response redisResponse = given().params(keyMap).get(activityHost + "/signtest/redis/delKey");
String redisResult = redisResponse.jsonPath().getString("success");
Assert.assertEquals(redisResult, "true", "删除redis键值失败");
Response CarouselRes = ContractSignService.getRewardTodayLimit200(actId,uid2);
String cid2 = CarouselRes.jsonPath().getString("data[0].consumerId");
String partnerUserId2 = CarouselRes.jsonPath().getString("data[0].uid");
String nickname2 = CarouselRes.jsonPath().getString("data[0].nickName");
String winCount2 = CarouselRes.jsonPath().getString("data[0].winCount");
Assert.assertEquals(cid2,"100104097");
Assert.assertEquals(partnerUserId2, String.valueOf(uid2));
Assert.assertEquals(nickname2, "Auto4629");
Assert.assertEquals(winCount2, "8250");
CarouselRes = ContractSignService.getRewardTodayLimit200(actId,uid4);
String cid4 = CarouselRes.jsonPath().getString("data[1].consumerId");
String partnerUserId4 = CarouselRes.jsonPath().getString("data[1].uid");
String nickname4 = CarouselRes.jsonPath().getString("data[1].nickName");
String winCount4 = CarouselRes.jsonPath().getString("data[1].winCount");
Assert.assertEquals(cid4,"100104099");
Assert.assertEquals(partnerUserId4, String.valueOf(uid4));
Assert.assertEquals(nickname4, "Auto4631");
Assert.assertEquals(winCount4, "4125");
CarouselRes = ContractSignService.getRewardTodayLimit200(actId,uid6);
String cid6 = CarouselRes.jsonPath().getString("data[2].consumerId");
String partnerUserId6 = CarouselRes.jsonPath().getString("data[2].uid");
String nickname6 = CarouselRes.jsonPath().getString("data[2].nickName");
String winCount6 = CarouselRes.jsonPath().getString("data[2].winCount");
Assert.assertEquals(cid6,"100104100");
Assert.assertEquals(partnerUserId6, String.valueOf(uid6));
Assert.assertEquals(nickname6, "Auto4633");
Assert.assertEquals(winCount6, "825");
}
}
...@@ -74,7 +74,6 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -74,7 +74,6 @@ public class ContractSign_signTest extends DuibaTestBase {
String success = doJoinRes.jsonPath().getString("success"); String success = doJoinRes.jsonPath().getString("success");
Assert.assertEquals(success, "false", "报名成功状态不正确"); Assert.assertEquals(success, "false", "报名成功状态不正确");
Assert.assertEquals(code, "200001","报名失败的错误码不正确"); Assert.assertEquals(code, "200001","报名失败的错误码不正确");
Response homeInfoRes = ContractSignService.getHomeInfo("3", uid1); Response homeInfoRes = ContractSignService.getHomeInfo("3", uid1);
String suspend = homeInfoRes.jsonPath().getString("data.suspend"); String suspend = homeInfoRes.jsonPath().getString("data.suspend");
Assert.assertEquals(suspend,"true", "活动报名截止状态不正确"); Assert.assertEquals(suspend,"true", "活动报名截止状态不正确");
...@@ -92,12 +91,39 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -92,12 +91,39 @@ public class ContractSign_signTest extends DuibaTestBase {
Assert.assertEquals(deadLine,"2018-01-01 14:00:00.0","设置报名截止时间失败"); Assert.assertEquals(deadLine,"2018-01-01 14:00:00.0","设置报名截止时间失败");
} }
@Test(description = "契约签到报名测试, 活动ID=2" ,priority = 1) @Test(description = "签到信息查询,活动ID=2",priority = 1)
public void 契约签到报名() throws Exception { public void 签到活动信息() throws Exception{
String actId = "2";
String betAmount = "1000";
SimpleDateFormat format = new SimpleDateFormat("MMdd");
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_YEAR, 1);
date = calendar.getTime();
// 期次号 MMDD格式
period = format.format(date);
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
int contractCycle = homeInfoRes.jsonPath().getInt("data.contractCycle");
Assert.assertEquals(contractCycle, 7, "周期天数不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "0", "当前参与状态不正确");
String bankerBonus = homeInfoRes.jsonPath().getString("data.bankerBonus");
Assert.assertEquals(bankerBonus, "10000", "保底奖池数量不正确");
String betCount = homeInfoRes.jsonPath().getString("data.betCount");
Assert.assertEquals(betCount,betAmount, "报名的额度不正确");
int buyers = homeInfoRes.jsonPath().getInt("data.buyers");
Assert.assertEquals(buyers, 0,"报名人数不正确");
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period, "活动期次号不正确");
}
@Test(description = "契约签到报名测试, 活动ID=2" ,priority = 2)
public void 固定额度报名() throws Exception {
String actId = "2"; String actId = "2";
String betAmount = "1000"; String betAmount = "1000";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat format2 = new SimpleDateFormat("MMdd");
Date date = new Date(); Date date = new Date();
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(date); calendar.setTime(date);
...@@ -105,8 +131,6 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -105,8 +131,6 @@ public class ContractSign_signTest extends DuibaTestBase {
date = calendar.getTime(); date = calendar.getTime();
// 期次开始的时间 yyyy-MM-dd格式 // 期次开始的时间 yyyy-MM-dd格式
String startTime = format.format(date); String startTime = format.format(date);
// 期次号 MMDD格式
period = format2.format(date);
calendar.add(Calendar.DAY_OF_YEAR, 6); calendar.add(Calendar.DAY_OF_YEAR, 6);
date = calendar.getTime(); date = calendar.getTime();
// 期次结束时间 // 期次结束时间
...@@ -130,7 +154,7 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -130,7 +154,7 @@ public class ContractSign_signTest extends DuibaTestBase {
map = this.doJoinResult(actId, betAmount, uid4); map = this.doJoinResult(actId, betAmount, uid4);
Assert.assertEquals(map.get("doneStatus"), "DOING", String.format("%d join failed, %s", uid4, doneStatusDesc)); Assert.assertEquals(map.get("doneStatus"), "DOING", String.format("%d join failed, %s", uid4, doneStatusDesc));
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1); Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
homeInfoRes.prettyPrint(); //homeInfoRes.prettyPrint();
// String joinTimeLimit = homeInfoRes.jsonPath().getString("data.joinTimeLimit"); // String joinTimeLimit = homeInfoRes.jsonPath().getString("data.joinTimeLimit");
// Assert.assertEquals(joinTimeLimit,"true", "参与时间限制校验失败"); // Assert.assertEquals(joinTimeLimit,"true", "参与时间限制校验失败");
String betCount = homeInfoRes.jsonPath().getString("data.betCount"); String betCount = homeInfoRes.jsonPath().getString("data.betCount");
...@@ -144,14 +168,13 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -144,14 +168,13 @@ public class ContractSign_signTest extends DuibaTestBase {
//0-未报名 1-报名中 2-已报名,打卡未开始 3-未打卡:打卡开始,当天未打卡 4-已打卡:当天已打卡(非最后一天) 5-失败:出现断卡(未报名新一期) 6-成功: 已成功(未报名新一期) //0-未报名 1-报名中 2-已报名,打卡未开始 3-未打卡:打卡开始,当天未打卡 4-已打卡:当天已打卡(非最后一天) 5-失败:出现断卡(未报名新一期) 6-成功: 已成功(未报名新一期)
String status = homeInfoRes.jsonPath().getString("data.status"); String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "2", "当前参与状态不正确"); Assert.assertEquals(status, "2", "当前参与状态不正确");
String bankerBonus = homeInfoRes.jsonPath().getString("data.bankerBonus");
Assert.assertEquals(bankerBonus, "10000", "保底奖池数量不正确");
int totalCount_new = Integer.valueOf(homeInfoRes.jsonPath().getString("data.betTotalCount")); int totalCount_new = Integer.valueOf(homeInfoRes.jsonPath().getString("data.betTotalCount"));
Assert.assertEquals(totalCount_new, 10000+Integer.valueOf(betAmount)*4, "报名后奖池数量不正确"); Assert.assertEquals(totalCount_new, 10000+Integer.valueOf(betAmount)*4, "报名后奖池数量不正确");
} }
@Test(description = "活动ID=2, uid1打卡", priority = 2) @Test(description = "活动ID=2, uid1打卡", priority = 3)
public void 签到打卡() throws Exception{ public void 固定额度签到打卡() throws Exception{
String actId = "2"; String actId = "2";
//修改期次,今日为打卡日 //修改期次,今日为打卡日
modifyIssuePeriod(issueId,-1); modifyIssuePeriod(issueId,-1);
...@@ -178,8 +201,8 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -178,8 +201,8 @@ public class ContractSign_signTest extends DuibaTestBase {
Assert.assertEquals(status, "4", "打卡完成后状态不正确"); Assert.assertEquals(status, "4", "打卡完成后状态不正确");
} }
@Test(description = "活动ID=2,uid2第六天断签", priority = 3) @Test(description = "活动ID=2,uid2第六天断签", priority = 4)
public void 契约签到断签() throws Exception{ public void 固定额度断签() throws Exception{
String actId = "2"; String actId = "2";
//当天为周期第一天,周期往前再挪6天 //当天为周期第一天,周期往前再挪6天
modifyIssuePeriod(issueId,-6); modifyIssuePeriod(issueId,-6);
...@@ -200,8 +223,8 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -200,8 +223,8 @@ public class ContractSign_signTest extends DuibaTestBase {
} }
@Test(description = "uid3 uid4打卡完成,活动ID=2",priority = 4) @Test(description = "uid3 uid4打卡完成,活动ID=2",priority = 5)
public void 契约签到整期打卡完成() throws Exception{ public void 固定额度_整期打卡完成() throws Exception{
String actId = "2"; String actId = "2";
//补签前6天 //补签前6天
this.contractResign(actId, uid3, 7,false); this.contractResign(actId, uid3, 7,false);
...@@ -217,34 +240,40 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -217,34 +240,40 @@ public class ContractSign_signTest extends DuibaTestBase {
logger.info("uid3七日打卡成功"); logger.info("uid3七日打卡成功");
signRes = ContractSignService.doSign("2", uid4); signRes = ContractSignService.doSign("2", uid4);
homeInfoRes = ContractSignService.getHomeInfo(actId,uid3);
success = signRes.jsonPath().getString("success"); success = signRes.jsonPath().getString("success");
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(success, "true", "uid4打卡失败"); Assert.assertEquals(success, "true", "uid4打卡失败");
Assert.assertEquals(status,"6","完成7日打卡状态不正确");
logger.info("uid4七日打卡成功"); logger.info("uid4七日打卡成功");
homeInfoRes = ContractSignService.getHomeInfo(actId,uid4);
homeInfoRes.prettyPrint();
status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status,"6","完成7日打卡状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
String hasRewardTomorrow = homeInfoRes.jsonPath().getString("data.hasRewardTomorrow");
Assert.assertEquals(hasReward, "false", "是否有带领取奖励不正确");
Assert.assertEquals(hasRewardTomorrow, "true", "明日是否有奖励状态不正确");
} }
@Test(description = "开奖,活动ID=2",priority = 5) @Test(description = "开奖,活动ID=2",priority = 6)
public void 契约开奖() throws Exception{ public void 契约开奖_固定额度() throws Exception{
modifyIssuePeriod(issueId, -1); modifyIssuePeriod(issueId, -1);
//修改redis的打卡日期键值 //修改redis的打卡日期键值
String actId = "2"; String actId = "2";
Date now = new Date(); // Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd"); // SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd");
String today = sdf.format(now); // String today = sdf.format(now);
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.setTime(now); // calendar.setTime(now);
calendar.add(Calendar.DAY_OF_YEAR, -1); // calendar.add(Calendar.DAY_OF_YEAR, -1);
String yestertoday = sdf.format(calendar.getTime()); // String yestertoday = sdf.format(calendar.getTime());
String oldKey = String.format("SIGNCENTER_K030_%s_%s", issueId, today); // String oldKey = String.format("SIGNCENTER_K030_%s_%s", issueId, today);
String newKey = String.format("SIGNCENTER_k030_%s_%s", issueId, yestertoday); // String newKey = String.format("SIGNCENTER_k030_%s_%s", issueId, yestertoday);
Map<String, String> map = new HashMap<>(); // Map<String, String> map = new HashMap<>();
map.put("key", oldKey); // map.put("key", oldKey);
map.put("newKey", newKey); // map.put("newKey", newKey);
Response response = given().params(map).get(activityHost + "/signtest/redis/renameKey"); // Response response = given().params(map).get(activityHost + "/signtest/redis/renameKey");
String result = response.jsonPath().getString("success"); // String result = response.jsonPath().getString("success");
Assert.assertEquals(result, "true", "重命名redis键值失败"); // Assert.assertEquals(result, "true", "重命名redis键值失败");
// 查询下期是否开始 // 查询下期是否开始
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid3); Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid3);
...@@ -253,6 +282,8 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -253,6 +282,8 @@ public class ContractSign_signTest extends DuibaTestBase {
Assert.assertEquals(periodShow, period, "参与期次号不正确"); Assert.assertEquals(periodShow, period, "参与期次号不正确");
String status = homeInfoRes.jsonPath().getString("data.status"); String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "当前参与状态不正确"); Assert.assertEquals(status, "6", "当前参与状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
Assert.assertEquals(hasReward, "true", "今日是否有奖励状态不正确");
// 查询参与记录 // 查询参与记录
Response recordRes = ContractSignService.getContracts(actId, uid3); Response recordRes = ContractSignService.getContracts(actId, uid3);
String contractId = recordRes.jsonPath().getString("data.list[0].contractId"); String contractId = recordRes.jsonPath().getString("data.list[0].contractId");
...@@ -279,7 +310,7 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -279,7 +310,7 @@ public class ContractSign_signTest extends DuibaTestBase {
ContractSignService.getReward(contractId,uid4); ContractSignService.getReward(contractId,uid4);
} }
@Test(description = "打卡/收益排行榜,活动ID=2",priority = 6) @Test(description = "打卡/收益排行榜,活动ID=2",priority = 7)
public void 参与记录() throws Exception{ public void 参与记录() throws Exception{
// 查询断签用户参与记录 // 查询断签用户参与记录
Response recordRes = ContractSignService.getContracts("2", uid2); Response recordRes = ContractSignService.getContracts("2", uid2);
...@@ -313,7 +344,7 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -313,7 +344,7 @@ public class ContractSign_signTest extends DuibaTestBase {
Assert.assertEquals(totalProfit, 7000,"累计收益不正确"); Assert.assertEquals(totalProfit, 7000,"累计收益不正确");
} }
@Test(description = "打卡/收益排行榜,活动ID=2",priority = 7) @Test(description = "打卡/收益排行榜,活动ID=2",priority = 8)
public void 排行榜() throws Exception{ public void 排行榜() throws Exception{
String actId = "2"; String actId = "2";
//查询签到次数排行榜 //查询签到次数排行榜
...@@ -348,8 +379,8 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -348,8 +379,8 @@ public class ContractSign_signTest extends DuibaTestBase {
Assert.assertEquals(nickName2,"Auto3720","用户名不正确"); Assert.assertEquals(nickName2,"Auto3720","用户名不正确");
} }
@Test(description = "中奖轮播",priority = 8) @Test(description = "中奖轮播",priority = 9)
public void 中奖轮播() throws Exception{ public void 中奖轮播_固定额度() throws Exception{
//删除redis key //删除redis key
// Map<String, String> carouselMap = new HashMap<>(); // Map<String, String> carouselMap = new HashMap<>();
// carouselMap.put("key", ); // carouselMap.put("key", );
...@@ -415,7 +446,7 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -415,7 +446,7 @@ public class ContractSign_signTest extends DuibaTestBase {
} }
} }
private void modifyJoinTime(String actId, String date, String startTime, String endTime) throws Exception{ public void modifyJoinTime(String actId, String date, String startTime, String endTime) throws Exception{
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("title", "自动化_报名截止时间"); map.put("title", "自动化_报名截止时间");
map.put("betCount", "1000"); map.put("betCount", "1000");
...@@ -438,7 +469,7 @@ public class ContractSign_signTest extends DuibaTestBase { ...@@ -438,7 +469,7 @@ public class ContractSign_signTest extends DuibaTestBase {
map.put("openType", "0"); map.put("openType", "0");
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(map)); JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(map));
Response response = given().contentType("application/json;charset=UTF-8").cookies(authorization.ssoLogin()).body(jsonObject).post("https://mng.duibatest.com.cn/newmanager/signContract/save"); Response response = given().contentType("application/json;charset=UTF-8").cookies(authorization.ssoLogin()).body(jsonObject).post("https://mng.duibatest.com.cn/newmanager/signContract/save");
response.prettyPrint(); //response.prettyPrint();
try { try {
Assert.assertEquals(response.jsonPath().getString("success"), "true", "/signContract/save接口失败"); Assert.assertEquals(response.jsonPath().getString("success"), "true", "/signContract/save接口失败");
} catch (Exception e) { } catch (Exception e) {
......
...@@ -61,13 +61,15 @@ public class 周期签到测试_signTest extends DuibaTestBase { ...@@ -61,13 +61,15 @@ public class 周期签到测试_signTest extends DuibaTestBase {
// } // }
@Test(description = "活动id:79,规则:周期2天,签到第3天循环第一天奖励,加一次抽奖机会,加10积分") //@Test(description = "活动id:79,规则:周期2天,签到第3天循环第一天奖励,加一次抽奖机会,加10积分")
public void 周期签到测试() throws Exception { public void 周期签到测试() throws Exception {
logger.info("Current Thread Id: " + Thread.currentThread().getId()); logger.info("Current Thread Id: " + Thread.currentThread().getId());
//补签前天,凑足连续签到2天 //补签前天,凑足连续签到2天
Response response_1 = this.resign("79",-2); Response response_1 = this.resign("79",-2);
Thread.sleep(1000);
Response response_2 = this.resign("79",-1); Response response_2 = this.resign("79",-1);
// response_2.prettyPrint(); response_1.prettyPrint();
response_2.prettyPrint();
//当日签到之前插件信息查询 //当日签到之前插件信息查询
Response response_plug = activityPlugDrawInfoService.getPrizeInfo(map,"1179"); Response response_plug = activityPlugDrawInfoService.getPrizeInfo(map,"1179");
...@@ -97,6 +99,7 @@ public class 周期签到测试_signTest extends DuibaTestBase { ...@@ -97,6 +99,7 @@ public class 周期签到测试_signTest extends DuibaTestBase {
String lastDays = response.jsonPath().getString("signInfoVO.lastDays");//连续签到天数 String lastDays = response.jsonPath().getString("signInfoVO.lastDays");//连续签到天数
String todaySigned = response.jsonPath().getString("signInfoVO.todaySigned"); //今日是否签到 String todaySigned = response.jsonPath().getString("signInfoVO.todaySigned"); //今日是否签到
response.prettyPrint();
Assert.assertEquals(acmDay,"2","历史累积签到次数不正确"); Assert.assertEquals(acmDay,"2","历史累积签到次数不正确");
Assert.assertEquals(acmDays,"2","周期内累计签到天数不正确"); Assert.assertEquals(acmDays,"2","周期内累计签到天数不正确");
Assert.assertEquals(activityCount,"1","今日奖励抽奖次数不正确"); Assert.assertEquals(activityCount,"1","今日奖励抽奖次数不正确");
......
package http.cases.SaasDeveloperTest; package http.cases.SignTest;
import base.Config; import base.Config;
import http.service.Saas.SignService; import http.service.Saas.SignService;
...@@ -16,7 +16,7 @@ import org.testng.annotations.Test; ...@@ -16,7 +16,7 @@ import org.testng.annotations.Test;
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 签到管理_DuibaTest extends AbstractTestNGSpringContextTests { public class 开发者签到管理_signTest extends AbstractTestNGSpringContextTests {
@Autowired @Autowired
SignService signService; SignService signService;
......
...@@ -265,6 +265,7 @@ public class 补签测试_signTest extends DuibaTestBase { ...@@ -265,6 +265,7 @@ public class 补签测试_signTest extends DuibaTestBase {
map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}"); map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}");
map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("fullSignReward", "{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("fullSignReward", "{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("operatingPositions","[]"); map.put("operatingPositions","[]");
logger.info("请求configEdit接口"); logger.info("请求configEdit接口");
...@@ -318,6 +319,7 @@ public class 补签测试_signTest extends DuibaTestBase { ...@@ -318,6 +319,7 @@ public class 补签测试_signTest extends DuibaTestBase {
map.put("cirReward", "{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}"); map.put("cirReward", "{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}");
map.put("acmReward", "{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("acmReward", "{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("firstSignReward", "{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("firstSignReward", "{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("operatingPositions","[]"); map.put("operatingPositions","[]");
logger.info("请求configEdit接口"); logger.info("请求configEdit接口");
...@@ -366,6 +368,7 @@ public class 补签测试_signTest extends DuibaTestBase { ...@@ -366,6 +368,7 @@ public class 补签测试_signTest extends DuibaTestBase {
map.put("cirReward", "{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}"); map.put("cirReward", "{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}");
map.put("acmReward", "{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("acmReward", "{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("firstSignReward", "{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("firstSignReward", "{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("operatingPositions","[]"); map.put("operatingPositions","[]");
logger.info("请求configEdit接口"); logger.info("请求configEdit接口");
......
...@@ -142,7 +142,7 @@ public class 种红包新用户_AccessTest extends DuibaTestBase{ ...@@ -142,7 +142,7 @@ public class 种红包新用户_AccessTest extends DuibaTestBase{
Response response = editManagerInfoService.createUser("种红包新用户","68"); Response response = editManagerInfoService.createUser("种红包新用户","68");
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '种红包新用户' and app_id = '68'"); Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '种红包新用户' and app_id = '68'");
uid = Integer.valueOf(user.get("id").toString()); uid = Integer.valueOf(user.get("id").toString());
String url = "http://47.97.214.108/user/loginDuiba?uid=" + uid; String url = "http://dafuweng.duibatest.com.cn/user/loginDuiba?uid=" + uid;
Response login = given().get(url); Response login = given().get(url);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = '19380'",uid); Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = '19380'",uid);
consumerId = consumer.get("id").toString(); consumerId = consumer.get("id").toString();
......
...@@ -30,7 +30,7 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{ ...@@ -30,7 +30,7 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
//指定用户 //指定用户
private static int uid = 4689; private static int uid = 4689;
private static int uid2 = 4552; private static int uid2 = 4552;
private static int uid3 = 3590; private static int uid3 = 4793;
private static int uid4 = 4386; private static int uid4 = 4386;
@Test @Test
public void 出券衰减开关校验_() throws Exception { public void 出券衰减开关校验_() throws Exception {
...@@ -103,18 +103,16 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{ ...@@ -103,18 +103,16 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
logger.info("种红包的红包配置接口校验正确"); logger.info("种红包的红包配置接口校验正确");
} }
@Test //@Test
public void 衰减红包校验() throws Exception { public void 衰减红包校验() throws Exception {
//dafuweng登陆获取cookies //dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid4); Map cookies = authorization.dafuwengLogin(uid4);
//调用种植seed //调用种植seed
Response response = seedRedPacketService.seed(cookies,"1","424","1"); Response response = seedRedPacketService.seed(cookies,"6","424","1");
//种子号 //种子号
String orderId = response.jsonPath().getString("data.orderNum"); String orderId = response.jsonPath().getString("data.orderNum");
Assert.assertNotNull(orderId,"订单号为空"); Assert.assertNotNull(orderId,"订单号为空");
logger.info("红包订单为:"+orderId); logger.info("红包订单为:"+orderId);
//红包衰减
Thread.sleep(65000);
//获取种植结果状态getOrderStatus,异步接口,while循环,status为2处理完成,1处理中 //获取种植结果状态getOrderStatus,异步接口,while循环,status为2处理完成,1处理中
response = seedRedPacketService.getOrderStatus(cookies,orderId); response = seedRedPacketService.getOrderStatus(cookies,orderId);
String status = response.jsonPath().getString("data"); String status = response.jsonPath().getString("data");
...@@ -125,7 +123,9 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{ ...@@ -125,7 +123,9 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
i--; i--;
} }
//获取种植获得金额 //获取种植获得金额
response = seedRedPacketService.reap(cookies,"1",orderId); //红包衰减
Thread.sleep(70000);
response = seedRedPacketService.reap(cookies,"6",orderId);
response.prettyPrint(); response.prettyPrint();
String isDecr = response.jsonPath().getString("data.isDecr"); String isDecr = response.jsonPath().getString("data.isDecr");
Assert.assertEquals(isDecr,"true","红包衰减标识校验失败"); Assert.assertEquals(isDecr,"true","红包衰减标识校验失败");
......
...@@ -108,11 +108,12 @@ public class 账户余额清零_AccessTest extends DuibaTestBase { ...@@ -108,11 +108,12 @@ public class 账户余额清零_AccessTest extends DuibaTestBase {
//获取最新的提现记录 //获取最新的提现记录
Thread.sleep(3000);
Map cookies = authorization.dafuwengLogin(uid); Map cookies = authorization.dafuwengLogin(uid);
Response response = walletAccountService.walletDetail(cookies); Response response = walletAccountService.walletDetail(cookies);
String money = response.jsonPath().getString("data[1].money"); String money = response.jsonPath().getString("data[0].money");
String subType = response.jsonPath().getString("data[1].subType"); String subType = response.jsonPath().getString("data[0].subType");
String description = response.jsonPath().getString("data[1].description"); String description = response.jsonPath().getString("data[0].description");
Assert.assertTrue(new BigDecimal(money).compareTo(new BigDecimal("100"))==0,"扣款金额校验失败"); Assert.assertTrue(new BigDecimal(money).compareTo(new BigDecimal("100"))==0,"扣款金额校验失败");
Assert.assertEquals(subType, "0", "日志类型校验失败"); Assert.assertEquals(subType, "0", "日志类型校验失败");
......
...@@ -42,10 +42,10 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -42,10 +42,10 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
//指定用户 //指定用户
private static int uid = 4459; private static int uid = 4459;
private static String consumerId = "100098000"; private static String consumerId = "100098000";
private static int uid2 = 4460; private static int uid2 = 4822;
private static String consumerId2 = "100098001"; private static String consumerId2 = "100108125";
private static int uid3 = 4461; private static int uid3 = 4793;
private static String consumerId3 = "100098002"; private static String consumerId3 = "100108076";
private static int uid4 = 4474; private static int uid4 = 4474;
private static String consumerId4 = "100098031"; private static String consumerId4 = "100098031";
@AfterClass @AfterClass
...@@ -103,9 +103,11 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -103,9 +103,11 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
@Test @Test
public void 提现账号已使用() throws Exception { public void 提现账号已使用() throws Exception {
//修改账户过期时间,确保账户余额不会过期清零
jdbc.update("update consumer_account_log.tb_expire_consumer_account set gmt_modified ='"+getTime(1)+"' where account_id = '"+consumerId2+"_6_0'");
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0977 where account_id = '"+consumerId2+"_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0861 where account_id = '"+consumerId2+"_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
...@@ -119,7 +121,7 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -119,7 +121,7 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
Assert.assertEquals(response.jsonPath().getString("message"),"一个支付宝账户仅允许一个账户提现","/walletAccount/doTakePrize接口失败"); Assert.assertEquals(response.jsonPath().getString("message"),"一个支付宝账户仅允许一个账户提现","/walletAccount/doTakePrize接口失败");
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0977 where account_id = '"+consumerId2+"_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0861 where account_id = '"+consumerId2+"_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
...@@ -128,11 +130,11 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -128,11 +130,11 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
} }
@Test //@Test
public void 开发者账户余额不足() throws Exception { public void 开发者账户余额不足() throws Exception {
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0978 where account_id = '"+consumerId3+"_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0812 where account_id = '"+consumerId3+"_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
...@@ -147,14 +149,14 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -147,14 +149,14 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
Assert.assertEquals(response.jsonPath().getString("message"),"扣app余额失败","/walletAccount/doTakePrize接口失败"); Assert.assertEquals(response.jsonPath().getString("message"),"扣app余额失败","/walletAccount/doTakePrize接口失败");
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0978 where account_id = '"+consumerId3+"_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0812 where account_id = '"+consumerId3+"_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败"); Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败");
logger.info("用户账户余额校验成功"); logger.info("用户账户余额校验成功");
this.checkRecord(uid3,"0.01"); this.checkRecord(uid3,"100");
} }
@Test @Test
...@@ -239,12 +241,21 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -239,12 +241,21 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
String description1 = response.jsonPath().getString("data[1].description"); String description1 = response.jsonPath().getString("data[1].description");
String subType1 = response.jsonPath().getString("data[1].subType"); String subType1 = response.jsonPath().getString("data[1].subType");
Assert.assertEquals(money,Exmoney,"扣款金额校验失败"); if(subType.equals("0")){
Assert.assertEquals(description,"提现","明细描述失败"); Assert.assertEquals(money,Exmoney,"扣款金额校验失败");
Assert.assertEquals(subType,"0","日志类型校验失败"); Assert.assertEquals(description,"提现","明细描述失败");
Assert.assertEquals(money1,Exmoney,"扣款金额校验失败"); }else{
Assert.assertEquals(description1,"提现 - 返还","明细描述失败"); Assert.assertEquals(money,Exmoney,"扣款金额校验失败");
Assert.assertEquals(subType1,"1","日志类型校验失败"); Assert.assertEquals(description,"提现 - 返还","明细描述失败");
}
if(subType1.equals("0")){
Assert.assertEquals(money1,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description1,"提现","明细描述失败");
}else{
Assert.assertEquals(money1,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description1,"提现 - 返还","明细描述失败");
}
logger.info("账户余额明细校验成功"); logger.info("账户余额明细校验成功");
} }
......
...@@ -38,8 +38,8 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -38,8 +38,8 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
HbaseService hbaseService; HbaseService hbaseService;
private DuibaLog logger = DuibaLog.getLogger(); private DuibaLog logger = DuibaLog.getLogger();
//指定用户 //指定用户
private static int uid = 4244; private static int uid = 4823;
private static String consumerId = "100092758"; private static String consumerId = "100108126";
private static String orderId; private static String orderId;
@AfterClass @AfterClass
public void afterclass() { public void afterclass() {
...@@ -77,7 +77,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -77,7 +77,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
public void a_提现失败_账户错误(int caseNum,String alipay,String realname) throws Exception { public void a_提现失败_账户错误(int caseNum,String alipay,String realname) throws Exception {
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
...@@ -101,7 +101,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -101,7 +101,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
} }
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
...@@ -113,7 +113,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -113,7 +113,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
public void b_正常提现() throws Exception { public void b_正常提现() throws Exception {
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
balance = balance - 1; balance = balance - 1;
...@@ -123,7 +123,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -123,7 +123,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
this.账户提现(cookies,"peeulk6392@sandbox.com","沙箱环境"); this.账户提现(cookies,"peeulk6392@sandbox.com","沙箱环境");
Thread.sleep(2000); Thread.sleep(2000);
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败"); Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败");
...@@ -169,7 +169,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -169,7 +169,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
public void d_提现失败_登录次数不足() throws Exception { public void d_提现失败_登录次数不足() throws Exception {
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
...@@ -183,7 +183,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -183,7 +183,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
Assert.assertEquals(response.jsonPath().getString("message"),"连续登录天数不足","/walletAccount/doTakePrize接口失败"); Assert.assertEquals(response.jsonPath().getString("message"),"连续登录天数不足","/walletAccount/doTakePrize接口失败");
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
......
...@@ -68,6 +68,7 @@ public class NewActivityService { ...@@ -68,6 +68,7 @@ public class NewActivityService {
map.put("oaId",activityId); map.put("oaId",activityId);
logger.info("请求/hdtool/doJoin接口,activityId="+activityId); logger.info("请求/hdtool/doJoin接口,activityId="+activityId);
logger.info("url:"+url+"/hdtool/doJoin");
Response response = given().cookies(cookies).params(map).post(url+"/hdtool/doJoin"); Response response = given().cookies(cookies).params(map).post(url+"/hdtool/doJoin");
try{ try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200"); Assert.assertEquals(String.valueOf(response.getStatusCode()),"200");
...@@ -79,6 +80,43 @@ public class NewActivityService { ...@@ -79,6 +80,43 @@ public class NewActivityService {
} }
return response; return response;
} }
public Response doJoinMap(Map cookies, String token,String activityId) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("token",token);
map.put("activityId",activityId);
map.put("oaId",activityId);
logger.info("请求/hdtool/doJoin接口,activityId="+activityId);
logger.info("url:"+url+"/hdtool/doJoin");
Response response = given().cookies(cookies).params(map).post(url+"/hdtool/doJoin");
try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200");
logger.info("/hdtool/doJoin接口成功,返回信息:"+response.asString());
}catch(Exception e){
throw new Exception("/hdtool/doJoin接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/hdtool/doJoin接口失败,返回信息:"+response.asString());
}
return response;
}
public Response login(Map cookies, String dpm) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("dpm",dpm);
logger.info("请求/hdtool/login接口");
logger.info("url:"+url+"/hdtool/login");
Response response = given().cookies(cookies).params(map).post(url+"/hdtool/login");
try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200");
logger.info("/hdtool/login接口成功,返回信息:"+response.asString());
}catch(Exception e){
throw new Exception("/hdtool/login接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/hdtool/login接口失败,返回信息:"+response.asString());
}
return response;
}
public Response doJoin2( String activityId,String token) throws Exception{ public Response doJoin2( String activityId,String token) throws Exception{
Map<String,String> map = new HashMap<>(); Map<String,String> map = new HashMap<>();
......
...@@ -164,6 +164,7 @@ public class SignactivityService { ...@@ -164,6 +164,7 @@ public class SignactivityService {
map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":1154,\"items\":[{\"days\":2,\"credits\":10,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}"); map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":1154,\"items\":[{\"days\":2,\"credits\":10,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}");
map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}"); map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("operatingPositions","[]"); map.put("operatingPositions","[]");
logger.info("请求configEdit接口"); logger.info("请求configEdit接口");
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+hdHost+"/signin/configEdit"); Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+hdHost+"/signin/configEdit");
......
...@@ -164,9 +164,12 @@ public class Authorization { ...@@ -164,9 +164,12 @@ public class Authorization {
Map params=new HashMap(); Map params=new HashMap();
params.put("uid","not_login"); params.put("uid","not_login");
params.put("credits","0"); params.put("credits","0");
String url=tool.buildUrlWithSign("http://home.m.duibatest.com.cn/autoLogin/autologin?",params); String url=tool.buildUrlWithSign("http://activity.m.duibatest.com.cn/autoLogin/autologin?",params);
logger.info("dafuweng免登陆url为:"+url); logger.info("dafuweng免登陆url为:"+url);
Response response=given().redirects().follow(false).get(url); Response response=given().redirects().follow(false).get(url);
logger.info("dafuweng免登陆,响应数据:"+response.asString());
logger.info("dafuweng免登陆,响应状态码:"+response.getStatusCode());
return response; return response;
} }
public Map generateSignAutoLogin(String appKey, int uid){ public Map generateSignAutoLogin(String appKey, int uid){
......
...@@ -448,8 +448,7 @@ public class EditManagerInfoService { ...@@ -448,8 +448,7 @@ public class EditManagerInfoService {
public Response createUser(String name){ public Response createUser(String name){
String url = "http://dafuweng.duibatest.com.cn" + "/user/create";
String url = "http://47.97.214.108" + "/user/create";
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("appId","67"); map.put("appId","67");
map.put("name",name); map.put("name",name);
...@@ -464,7 +463,7 @@ public class EditManagerInfoService { ...@@ -464,7 +463,7 @@ public class EditManagerInfoService {
public Response createUser(String name,String appId){ public Response createUser(String name,String appId){
String url = "http://47.97.214.108" + "/user/create"; String url = "http://dafuweng.duibatest.com.cn" + "/user/create";
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("appId",appId); map.put("appId",appId);
map.put("name",name); map.put("name",name);
......
...@@ -13,6 +13,9 @@ import com.alibaba.fastjson.JSONObject; ...@@ -13,6 +13,9 @@ import com.alibaba.fastjson.JSONObject;
import http.model.BetOptionVo; import http.model.BetOptionVo;
import http.service.Authorization; import http.service.Authorization;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
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;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -46,6 +49,7 @@ public class PkActivityService { ...@@ -46,6 +49,7 @@ public class PkActivityService {
public Response bet(String bonusType,String endTime) throws Exception{ public Response bet(String bonusType,String endTime) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/bet"; String url = "http://" + ManagerHost + "/newmanager/bet";
List<BetOptionVo> betOptionVoList = new ArrayList<>(); List<BetOptionVo> betOptionVoList = new ArrayList<>();
BetOptionVo betOptionVo1 = new BetOptionVo(); BetOptionVo betOptionVo1 = new BetOptionVo();
BetOptionVo betOptionVo2 = new BetOptionVo(); BetOptionVo betOptionVo2 = new BetOptionVo();
...@@ -58,12 +62,18 @@ public class PkActivityService { ...@@ -58,12 +62,18 @@ public class PkActivityService {
Map<String,Object> para = new HashMap<>(); Map<String,Object> para = new HashMap<>();
para.put("betOptionDtoList",betOptionVoList); para.put("betOptionDtoList",betOptionVoList);
para.put("betType","1");//1-单选单次; para.put("betType","1");//1-单选单次;
para.put("bonusType",bonusType);//1-经验;2-红包 para.put("bonusType",bonusType);//1-经验;2-红包;3-优惠券
if (bonusType.equals("2")){ if (bonusType.equals("2")){
para.put("bonusAmount","0.1");//实际瓜分红包金额 para.put("bonusAmount","0.1");//实际瓜分红包金额
para.put("title","【自动化】新建pk活动-瓜分红包"); para.put("title","【自动化】新建pk活动-瓜分红包");
}else { }else if (bonusType.equals("1")){
para.put("title","【自动化】新建pk活动-瓜分经验"); para.put("title","【自动化】新建pk活动-瓜分经验");
}else {
para.put("title","【自动化】新建pk活动-瓜分优惠券");
para.put("bonusAmount","");
para.put("pluginId","12");//插件id
para.put("prizeLimit","1000");//发放上限
} }
para.put("configStatus","1"); para.put("configStatus","1");
para.put("creditsValue","1"); para.put("creditsValue","1");
...@@ -87,6 +97,52 @@ public class PkActivityService { ...@@ -87,6 +97,52 @@ public class PkActivityService {
} }
public Response betForSetUp(String bonusType,String endTime) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/bet";
DateTime date = new DateTime();
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
String time = formatter.print(date.getMillis()).toString();
List<BetOptionVo> betOptionVoList = new ArrayList<>();
BetOptionVo betOptionVo1 = new BetOptionVo();
BetOptionVo betOptionVo2 = new BetOptionVo();
betOptionVo1.setOptionImg("//yun.dui88.com/images/201807/6pyca34t5e.jpeg");
betOptionVo1.setOptionName("【自动化】选项A1");
betOptionVo2.setOptionImg("//yun.dui88.com/images/201807/kcrl1q7hkt.jpeg");
betOptionVo2.setOptionName("【自动化】选项A2");
betOptionVoList.add(betOptionVo1);
betOptionVoList.add(betOptionVo2);
Map<String,Object> para = new HashMap<>();
para.put("betOptionDtoList",betOptionVoList);
para.put("betType","1");//1-单选单次;
para.put("bonusType",bonusType);//1-经验;2-红包
if (bonusType.equals("2")){
para.put("bonusAmount","0.1");//实际瓜分红包金额
para.put("title","【自动化】瓜分红包"+time);
}else {
para.put("title","【自动化】瓜分经验"+time);
}
para.put("configStatus","1");
para.put("creditsValue","1");
para.put("endTime",endTime);
para.put("shareExp","13");
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(para));
Response betResponse = given().contentType("application/json;charset=UTF-8").cookies(authorization.ssoLogin()).body(jsonParam).post(url);
betResponse.prettyPrint();
try{
Assert.assertEquals(betResponse.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("创建pk活动接口失败,返回信息:"+betResponse.asString());
}catch(Error er){
throw new Exception("创建pk活动接口失败,返回信息:"+betResponse.asString());
}
return betResponse;
}
public Response betGroupRelation(String betId,String endTime,String groupId) throws Exception{ public Response betGroupRelation(String betId,String endTime,String groupId) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/betGroupRelation"; String url = "http://" + ManagerHost + "/newmanager/betGroupRelation";
...@@ -225,9 +281,28 @@ public class PkActivityService { ...@@ -225,9 +281,28 @@ public class PkActivityService {
return groupListResponse; return groupListResponse;
}
public Response doDraw() throws Exception{
String url = "http://" + ManagerHost + "/newmanager/betOpenPrize/doDraw";
Map<String,Object> para = new HashMap<>();
// para.put("pageNo","1");
// para.put("pageSize","20");
Response doDrawResponse = given().cookies(authorization.ssoLogin()).params(para).get(url);
try{
Assert.assertEquals(doDrawResponse.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("pk活动开奖接口失败,返回信息:"+doDrawResponse.asString());
}catch(Error er){
throw new Exception("pk活动开奖接口失败,返回信息:"+doDrawResponse.asString());
}
return doDrawResponse;
} }
// public static void main(String[] args) throws Exception{ // public static void main(String[] args) throws Exception{
// String endTime = "2021-12-31 23:55:00"; // String endTime = "2021-12-31 23:55:00";
// PkActivityService pkActivityService = new PkActivityService(); // PkActivityService pkActivityService = new PkActivityService();
......
...@@ -142,6 +142,7 @@ public class SignService { ...@@ -142,6 +142,7 @@ public class SignService {
map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}"); map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}");
map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}"); map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}");
map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":100,\"activityCount\":100}],\"plSkinOpen2Dev\":true,\"open\":true}"); map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":100,\"activityCount\":100}],\"plSkinOpen2Dev\":true,\"open\":true}");
map.put("firstSignReward","[]"); map.put("firstSignReward","[]");
......
package http.service.hd; package http.service.hd;
import cn.com.duiba.activity.center.api.params.MainmeetActivityParams;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import http.service.Authorization; import http.service.Authorization;
import base.DuibaLog; import base.DuibaLog;
...@@ -15,6 +16,7 @@ import java.util.List; ...@@ -15,6 +16,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.post;
@Service @Service
public class DeveloperService { public class DeveloperService {
...@@ -912,4 +914,200 @@ public class DeveloperService { ...@@ -912,4 +914,200 @@ public class DeveloperService {
return response; return response;
} }
//保存自有活动工具-所有字段
public Response saveHdAll(String id,String creditsType,String title,String limitCount,String limitScope,String freeLimit,String freeScope,String awards,String bannerImgNew) throws Exception {
String url=hdHost+"/launch/save";
Map<String,String> map = new HashMap<>();
map.put("id",id);
map.put("subType","turntable_circle");
map.put("creditsType",creditsType);
map.put("title",title);
map.put("credits","10");
map.put("limitCount",limitCount);
map.put("limitScope",limitScope);
map.put("freeLimit",freeLimit);
map.put("freeScope",freeScope);
map.put("optionNum","");
map.put("anticheatExchangeLimit","true");
map.put("autoOffDate","2030-12-01 00:00");
map.put("banner","//yun.duiba.com.cn/upload/r1u3O1460639179556.png");
map.put("thumbnail","//yun.duiba.com.cn/upload/R8Hac1467009242903.png");
map.put("questionRecord","[]");
map.put("awards",awards);
map.put("appId","2239");
map.put("bannerImgNew",bannerImgNew);
logger.info("请求创建自有活动工具url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
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;
}
//开发者后台编辑自有活动
public Response editData(String actId,String type,String appId) throws Exception {
String url=hdHost+"/launch/editData";
Map<String,String> map = new HashMap<>();
map.put("actId",actId);
map.put("type",type);
map.put("appId",appId);
logger.info("请求编辑自有活动url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
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;
}
//保存自有单品抽奖--所有字段
public Response saveDpAll(String id,String title,String mainAppItemId,String appItemTitle,String appItemType, String mainAppItemRemaining,String freeDrawLimit,String freeDrawLimitScope,String bannerImgNew,String vipLimitType,String vipLimits,String exchangeLimit) throws Exception {
String url=hdHost+"/appSingleLottery/saveOrUpdate";
Map<String,String> map = new HashMap<>();
map.put("appId","2239");
map.put("id",id);
map.put("appItemTitle",appItemTitle);
map.put("title",title);
map.put("mainAppItemRemaining",mainAppItemRemaining);
map.put("preMainAppItemRemaining","0");
map.put("credits","50");
map.put("mainAppItemRate","66.66");
map.put("minComein","100");
map.put("autoOffDate","2020-11-01 00:00");
map.put("introduction","自动化测试单品抽奖 奖品说明");
map.put("vipLimitType",vipLimitType);
map.put("vipLimits",vipLimits);
map.put("moreExchangeLimit","true");
map.put("freeDrawLimit",freeDrawLimit);
map.put("freeDrawLimitScope",freeDrawLimitScope);
map.put("consumerDrawLimit","2");
map.put("consumerDrawLimitScope","everyday");
map.put("consumerWinLimit","1");
map.put("everydayWinLimit","10");
map.put("startDay","2018-11-26");
map.put("endDay","2020-02-01");
map.put("startHours","6");
map.put("startTminute","0");
map.put("endThours","22");
map.put("endTminute","0");
map.put("exchangeLimit",exchangeLimit);
map.put("appItemType",appItemType);
map.put("mainAppItemId",mainAppItemId);
map.put("mainAppItemDegree","");
map.put("appItemId",mainAppItemId);
map.put("logo","//yun.dui88.com/images/201610/dczuwpckbw.png");
map.put("smallImage","//yun.dui88.com/images/201610/2tvxvbhj3x.jpg");
map.put("image","//yun.dui88.com/images/201610/sk21di3uia.jpg");
map.put("bannerImgNew",bannerImgNew);
logger.info("请求创建单品抽奖url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
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;
}
//开发者后台编辑自有单品抽奖活动
public Response editDetail(String appId,String singleLotteryId) throws Exception {
String url=hdHost+"/appSingleLottery/editDetail";
Map<String,String> map = new HashMap<>();
map.put("appId",appId);
map.put("singleLotteryId",singleLotteryId);
logger.info("请求编辑自有单品抽奖活动url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).get("http://"+url);
response.prettyPrint();
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;
}
//保存自有手动开奖--所有字段
public Response saveManualLottery(String title,String consumerDrawLimit,String consumerDrawLimitScope,String freeLimit,String freeLimitScope,String bannerImgNew) throws Exception {
String url=hdHost+"/appManualLottery/create";
Map<String,String> map = new HashMap<>();
map.put("title",title);
map.put("credits","50");
map.put("bannerImage","//yun.duiba.com.cn/upload/buctmou88a.png");
map.put("smallImage","//yun.duiba.com.cn/upload/wf0u6dtq7e.png");
map.put("image","//yun.duiba.com.cn/upload/nwmcomavqu.png");
map.put("bannerImgNew",bannerImgNew);
map.put("appId","2239");
map.put("marketPrice","10");
map.put("introduction","测试奖品说明");
map.put("consumerDrawLimit",consumerDrawLimit);
map.put("consumerDrawLimitScope",consumerDrawLimitScope);
map.put("freeLimit",freeLimit);
map.put("freeLimitScope",freeLimitScope);
map.put("overDate","2020-11-01");
logger.info("请求创建自有手动开奖url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
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;
}
//编辑自有手动开奖
public Response editManualLottery(String manualLotteryId) throws Exception {
String url=hdHost+"/appManualLottery/edit";
Map<String,String> map = new HashMap<>();
map.put("appId","2239");
map.put("manualLotteryId",manualLotteryId);
logger.info("请求编辑自有手动开奖url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).get("http://"+url);
response.prettyPrint();
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;
}
} }
...@@ -13,7 +13,7 @@ import static com.codeborne.selenide.Selenide.open; ...@@ -13,7 +13,7 @@ import static com.codeborne.selenide.Selenide.open;
public class 优惠券_ExchangeTest_ui extends DuibaBaseUi{ public class 优惠券_ExchangeTest_ui extends DuibaBaseUi{
@Test @Test
public void 优惠券兑换_正常流程() throws Exception { public void 优惠券兑换_正常流程() throws Exception {
open("http://47.97.214.108/user/index"); open("http://dafuweng.duibatest.com.cn/user/index");
clickByTextEqual("4762"); clickByTextEqual("4762");
switchWindow(); switchWindow();
sleep(2); sleep(2);
......
...@@ -22,8 +22,10 @@ import ui.common.WebDriverType; ...@@ -22,8 +22,10 @@ import ui.common.WebDriverType;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Map;
import static com.codeborne.selenide.Condition.text; import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.$;
...@@ -62,13 +64,9 @@ public class test extends DuibaBaseUi { ...@@ -62,13 +64,9 @@ public class test extends DuibaBaseUi {
} }
@Test @Test
public void test1(){ public void test1() throws SQLException {
open("https://www.biying.com"); Map<String,Object> map = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_group_relation where bet_id = 1232");
Reporter.log("rererfddfdfdfdfdfdf");
Reporter.log("rererfddfdfdfdfdfdf");
Reporter.log("rererfddfdfdfdfdfdf");
Reporter.log("rererfddfdfdfdfdfdf");
Reporter.log("rererfddfdfdfdfdfdf");
} }
@Test @Test
......
/**
* Copyright (C), 2015-2018
* FileName: BASE64
* Author: qianwenjun
* Date: 2018/9/11 10:02
* Description:
*/
package utils;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/9/11
* @since 1.0.0
*/
public class BASE64 {
/**
* BASE64解密
*
* @param key
* @return
* @throws Exception
*/
public static byte[] decryptBASE64(String key) throws Exception {
return (new BASE64Decoder()).decodeBuffer(key);
}
/**
* BASE64加密
*
* @param key
* @return
* @throws Exception
*/
public static String encryptBASE64(byte[] key) throws Exception {
return (new BASE64Encoder()).encodeBuffer(key);
}
}
\ No newline at end of file
/**
* Copyright (C), 2015-2018
* FileName: GetCookieUtil
* Author: qianwenjun
* Date: 2018/11/28 13:34
* Description:
*/
package utils;
import base.DuibaLog;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.restassured.response.Response;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/11/28
* @since 1.0.0
*/
public class GetCookieUtil {
private static DuibaLog logger = DuibaLog.getLogger();
public static JSONObject getConsumerIdFromCookie(String url) throws Exception{
// Response response = given().get(url);
Response response=given().redirects().follow(false).get(url);
response.prettyPrint();
Map<String,String> cookies = response.getCookies();
String cookieValue = response.getCookie("_ac");
byte[] bytes = BASE64.decryptBASE64(cookieValue);
JSONObject userCookie = JSON.parseObject(new String(bytes,"utf-8"));
// Headers allHeaders = response.getHeaders();
// String headerName = response.getHeader("Set-Cookie");
logger.info("userCookie="+JSONObject.toJSONString(userCookie));
logger.info("aid="+userCookie.get("aid")+",cid="+userCookie.get("cid"));
return userCookie;
}
public static String genUrl(String uid,String appkey) throws Exception{
String res = null;
String url = "http://home.m.duibatest.com.cn/test/generateSign";
Map<String,String> para = new HashMap<>();
para.put("appKey",appkey);
para.put("uid",uid);
Response response = given().params(para).get(url);
response.prettyPrint();
res = response.jsonPath().getString("url").toString();
return res;
}
}
\ No newline at end of file
...@@ -4,8 +4,8 @@ proxyserver.ip=172.16.80.203 ...@@ -4,8 +4,8 @@ proxyserver.ip=172.16.80.203
proxyserver.port=22 proxyserver.port=22
proxyserver.user=dev proxyserver.user=dev
proxyserver.prvkey=key/hzlId_rsa proxyserver.prvkey=key/hzlId_rsa
dafuweng.host=47.97.214.108 dafuweng.host=dafuweng.duibatest.com.cn
dafuweng.port=9002 dafuweng.port=80
uid=2707 uid=2707
appId=2239 appId=2239
hdserver.host=hd.dlp.duibatest.com.cn hdserver.host=hd.dlp.duibatest.com.cn
...@@ -24,7 +24,7 @@ trade.host = activity.m.duibatest.com.cn ...@@ -24,7 +24,7 @@ trade.host = activity.m.duibatest.com.cn
//\u6570\u636E\u5E93\u914D\u7F6E //\u6570\u636E\u5E93\u914D\u7F6E
db.name = duiba_test db.name = duiba_test
db.password= svbP3KUw2PurAnBb2rbs3vohF db.password= svbP3KUw2PurAnBb2rbs3vohF
db.url = jdbc:mysql://rdswy2b9wy53044250u1o.mysql.rds.aliyuncs.com:3306/ db.url = jdbc:mysql://47.97.127.67:13001/?tinyInt1isBit=false
db.driver= com.mysql.cj.jdbc.Driver db.driver= com.mysql.cj.jdbc.Driver
db.maxtotal = 6 db.maxtotal = 6
...@@ -32,39 +32,46 @@ db.maxtotal = 6 ...@@ -32,39 +32,46 @@ db.maxtotal = 6
pluginTest.project=插件 pluginTest.project=插件
pluginTest.names=zhaoran,qianwenjun pluginTest.names=zhaoran,qianwenjun
pluginTest.group=插件-接口自动化 pluginTest.group=插件-接口自动化
pluginTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaPlugin_interface/HTML_Report/suite1_test1_results.html pluginTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaPlugin_interface/HTML_20Report/suite1_test1_results.html
pluginTest.job=duibaPlugin_interface
signTest.project=签到 signTest.project=签到
signTest.names=zhousongbo signTest.names=zhousongbo
signTest.group=签到-接口自动化 signTest.group=签到-接口自动化
signTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaSign_interface/HTML_Report/suite1_test1_results.html signTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaSign_interface/HTML_20Report/suite1_test1_results.html
signTest.job=duibaSign_interface
FloorTest.project=楼层 FloorTest.project=楼层
FloorTest.names=zhaoran,qianwenjun FloorTest.names=zhaoran,qianwenjun
FloorTest.group=楼层-接口自动化 FloorTest.group=楼层-接口自动化
FloorTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaFloor_interface/HTML_Report/suite1_test1_results.html FloorTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaFloor_interface/HTML_20Report/suite1_test1_results.html
FloorTest.job=duibaFloor_interface
DuibaTest.project=活动工具 DuibaTest.project=活动工具
DuibaTest.names=zhaoran,qianwenjun DuibaTest.names=zhaoran,qianwenjun
DuibaTest.group=活动工具-接口自动化 DuibaTest.group=活动工具-接口自动化
DuibaTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duiba_interface/HTML_Report/suite1_test1_results.html DuibaTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duiba_interface/HTML_20Report/suite1_test1_results.html
DuibaTest.job=duiba_interface
AccessTest.project=综合业务(单品抽奖/秒杀/游戏) AccessTest.project=综合业务(单品抽奖/秒杀/游戏)
AccessTest.names=zhaoran,qianwenjun AccessTest.names=zhaoran,qianwenjun
AccessTest.group=综合业务-接口自动化 AccessTest.group=综合业务-接口自动化
AccessTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_Report/suite1_test1_results.html AccessTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_20Report/suite1_test1_results.html
AccessTest.job=duibaAccess_interface
JenkinsTest.project=综合业务(单品抽奖/秒杀/游戏) JenkinsTest.project=综合业务(单品抽奖/秒杀/游戏)
JenkinsTest.names=zhaoran,qianwenjun JenkinsTest.names=zhaoran,qianwenjun
JenkinsTest.group=综合业务-接口自动化 JenkinsTest.group=综合业务-接口自动化
JenkinsTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_Report/suite1_test1_results.html JenkinsTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_20Report/suite1_test1_results.html
ExchangeTest.project=普兑业务 ExchangeTest.project=普兑业务
ExchangeTest.names=panyuli ExchangeTest.names=panyuli
ExchangeTest.group=普兑业务-接口自动化 ExchangeTest.group=普兑业务-接口自动化
ExchangeTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_Report/suite1_test1_results.html ExchangeTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_20Report/suite1_test1_results.html
ExchangeTest.job=duibaExchange_interface
SeckillTest.project=秒杀业务 SeckillTest.project=秒杀业务
SeckillTest.names=qianwenjun SeckillTest.names=qianwenjun
SeckillTest.group=秒杀业务-接口自动化 SeckillTest.group=秒杀业务-接口自动化
SeckillTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_Report/suite1_test1_results.html SeckillTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_20Report/suite1_test1_results.html
\ No newline at end of file SeckillTest.job=Seckill_interface
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