Commit 7f72e747 authored by wangxiaoshuang's avatar wangxiaoshuang

Merge branch 'develop' into wxs

parents 871f2ba4 2def637a
......@@ -387,7 +387,7 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_创建活动楼层皮肤" })
@Test
public void B_手机端活动() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -444,7 +444,7 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_手机端活动" })
@Test
public void C_删除活动楼层皮肤() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......
......@@ -154,7 +154,7 @@ public class Banner_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_创建banner楼层皮肤" })
@Test
public void B_banner楼层活动校验() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -212,7 +212,7 @@ public class Banner_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_banner楼层活动校验" })
@Test
public void C_banner商品校验() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......
......@@ -342,7 +342,7 @@ public class Coupon_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_创建优惠券楼层皮肤" })
@Test
public void B_优惠券手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -392,7 +392,7 @@ public class Coupon_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_优惠券手机端" })
@Test
public void C_删除优惠券楼层皮肤() throws Exception {
......
......@@ -230,7 +230,7 @@ public class Game_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_创建游戏楼层皮肤" })
@Test
public void B_游戏手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -272,7 +272,7 @@ public class Game_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_游戏手机端" })
@Test
public void C_删除游戏楼层皮肤() throws Exception {
......
......@@ -222,7 +222,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_创建icon楼层皮肤" })
@Test
public void B_icon添加图标() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -296,7 +296,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_icon添加图标" })
@Test
public void C_icon编辑图标() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -352,7 +352,7 @@ public class Icon_FloorTest extends DuibaTestBase {
Assert.assertEquals(map.get("logo"),"//yun.dui88.com/images/201806/9lz5ifre0h.png","今日必抢logo校验错误");
}
@Test(dependsOnMethods = { "C_icon编辑图标" })
@Test
public void D_icon删除图标() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -388,7 +388,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "D_icon删除图标" })
@Test
public void E_删除icon楼层皮肤() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......
......@@ -362,7 +362,7 @@ public class Item_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_item创建楼层皮肤" })
@Test
public void B_item手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -404,7 +404,7 @@ public class Item_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_item手机端" })
@Test
public void C_item删除楼层皮肤() throws Exception {
......
......@@ -806,7 +806,7 @@ public class Seckill_FloorTest extends DuibaTestBase {
response = floorService.switchOpenState(authorization.ssoLogin(),skinId,"true");
}
@Test(dependsOnMethods = { "A_Seckill创建楼层皮肤" })
@Test
public void B_Seckill手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -849,7 +849,7 @@ public class Seckill_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_Seckill手机端" })
@Test
public void C_Seckill删除楼层皮肤() throws Exception {
......
......@@ -244,7 +244,7 @@ public class Showcase_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_Showcase创建楼层皮肤" })
@Test
public void B_Showcase手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -289,7 +289,7 @@ public class Showcase_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_Showcase手机端" })
@Test
public void C_Showcase删除楼层皮肤() throws Exception {
......
......@@ -510,7 +510,7 @@ public class Sign_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_sign创建楼层皮肤" })
@Test
public void B_sign手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -545,7 +545,7 @@ public class Sign_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_sign手机端" })
@Test
public void C_sign删除楼层皮肤() throws Exception {
......
......@@ -136,7 +136,7 @@ public class 新旧集卡_发卡_DuibaTest extends DuibaTestBase {
}
@Test
//@Test
public void 活动工具发旧集卡_扣积分() throws Exception{
String activityId = "37274";
......@@ -172,7 +172,7 @@ public class 新旧集卡_发卡_DuibaTest extends DuibaTestBase {
@Test
//@Test
public void 活动工具发新集卡_扣积分() throws Exception{
String activityId = "37275";
......
......@@ -306,6 +306,7 @@ public class pk_押注测试_AccessTest extends DuibaTestBase {
doJoinResponse.prettyPrint();
Assert.assertEquals(doJoinResponse.jsonPath().getString("code").toString(),"100060");
clear(consumerIds);
}
......
/**
* Copyright (C), 2015-2018
* FileName: pk_瓜分红包_首页中奖弹层测试_AccessTest
* Author: qianwenjun
* Date: 2018/12/22 12:38
* Description:
*/
package http.cases.PkTest;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject;
import http.model.PkPopPrizeVo;
import http.service.Activity.PkService;
import http.service.Manager.EditManagerInfoService;
import http.service.Manager.PkActivityService;
import http.service.hd.DeveloperConfigService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
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;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/12/22
* @since 1.0.0
*/
public class pk_瓜分红包_发券测试 extends DuibaTestBase {
@Autowired
PkService pkService;
@Autowired
PkActivityService pkActivityService;
@Autowired
DeveloperConfigService developerConfigService;
@Autowired
EditManagerInfoService editManagerInfoService;
private static DuibaLog logger = DuibaLog.getLogger();
private Integer user01 = 5447;//appid=21982
private Integer user02 = 5448;//appid=21982
// private Integer user03 = 5449;//appid=21982
//
// private Integer user04 = 5450;//appid=21982
List<String> newBetIds = new ArrayList<>();
private String consumerIds = "";
@Test(priority = 0)
public void 瓜分红包_首页不中奖_发券() throws Exception{
String newBetId = "";
List<String> optionsIds = new ArrayList<>();
String groupId = "199";
newBetId = createPk("2","2020-08-12 00:00:00",groupId);
newBetIds.add(newBetId);
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());
Response res1 = pkService.doJoin(user01,newBetId,optionsIds.get(0));
Response res2 = pkService.doJoin(user02,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);
Response popRes = pkService.popup(user02);
popRes.prettyPrint();
Assert.assertEquals(popRes.jsonPath().getString("data.show"),"false","校验是否展示弹层失败");
Assert.assertEquals(popRes.jsonPath().getString("data.totalBonus"),"0.0","校验红包值失败");
Assert.assertEquals(popRes.jsonPath().getString("data.drawType"),"0","校验开奖类型失败");
Assert.assertEquals(popRes.jsonPath().getString("data.lucky"),"true","校验不发福袋失败失败");
Assert.assertEquals(popRes.jsonPath().getString("data.prizeList"),null,"校验中奖list为null");
Response popRes1 = pkService.popup(user01);
popRes1.prettyPrint();
Assert.assertEquals(popRes1.jsonPath().getString("data.show"),"true","校验是否展示弹层失败");
Assert.assertEquals(popRes1.jsonPath().getString("data.totalBonus"),"0.1","校验红包值失败");
Assert.assertEquals(popRes1.jsonPath().getString("data.drawType"),"0","校验开奖类型失败");
Assert.assertEquals(popRes1.jsonPath().getString("data.lucky"),"false","校验不发福袋失败失败");
List<PkPopPrizeVo> prizeVoList = popRes.jsonPath().getList("data.prizeList",PkPopPrizeVo.class);
logger.info("开奖结果的list为:"+JSONObject.toJSONString(prizeVoList));
for (PkPopPrizeVo prize:prizeVoList){
if (prize.getBonusType().equals("2")){
Assert.assertEquals(prize.getTotalBonus(),"10","校验list的瓜分红包金额失败");
}
}
}
@Test
public void 押注_新用户首次参与测试() throws Exception{
Map<String,String> user = this.createUser();
consumerIds = user.get("consumerId");
logger.info("consumerIds的信息为"+consumerIds);
String newBetId = "";
List<String> optionsIds = new ArrayList<>();
String groupId = "200";
newBetId = createPk("2","2020-08-12 00:00:00",groupId);
newBetIds.add(newBetId);
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());
Response doJoinResponse = pkService.doJoin2(Integer.valueOf(user.get("uid")),newBetId,optionsIds.get(0));
doJoinResponse.prettyPrint();
Assert.assertEquals(doJoinResponse.jsonPath().getString("code").toString(),"100060");
}
public String 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");
logger.info("newBetId的信息为"+betId);
Response betRelation = pkActivityService.betGroupRelation(betId,endTime,groupId);
Response modifyStatusResponse = pkActivityService.modifySatus(betId);
return betId;
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
String endTimeStr = "2018-11-26 20:24:39";
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活动首次参与用户发券","103");
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = 'pk活动首次参与用户发券' and app_id = '103'\n");
String uid = user.get("id").toString();
String url = GetCookieUtil.genUrl(uid,"3NhqvHsNBDfcAJBUvdxmAs8mHq2d");
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 clear(String comsumerIds) throws Exception{
Boolean res = jdbc.update("delete from dafuweng.user where name = 'pk活动首次参与用户' and app_id = '103'");
String dbName = "new_consumer.consumer_"+ String.format("%04d", Long.parseLong(comsumerIds)/10000000);
logger.info("用户的分表名dbName为"+dbName);
Boolean res1 = jdbc.update("delete from "+dbName+" where id = ?",comsumerIds);
}
// @AfterClass
public void tearDown() {
try {
for (String newBetId:newBetIds){
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id = ?",newBetId);
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id = ?",newBetId);
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",newBetId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",newBetId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",newBetId);
}
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/12/22 12:38
* Description:
*/
package http.cases.PkTest;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject;
import http.model.PkPopPrizeVo;
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 java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/12/22
* @since 1.0.0
*/
public class pk_瓜分红包_首页中奖弹层测试_AccessTest extends DuibaTestBase {
@Autowired
PkService pkService;
@Autowired
PkActivityService pkActivityService;
private static DuibaLog logger = DuibaLog.getLogger();
private Integer user01 = 5434;//appid=21982
private String consumerId01 = "100122071";
private Integer user02 = 5435;//appid=21982
private String consumerId02 = "100122072";
private Integer user03 = 5449;//appid=21982
private Integer user04 = 5450;//appid=21982
List<String> newBetIds = new ArrayList<>();
@Test(priority = 0)
public void 瓜分红包_首页中奖() throws Exception{
String newBetId = "";
List<String> optionsIds = new ArrayList<>();
String groupId = "194";
newBetId = createPk("2","2020-08-12 00:00:00",groupId);
newBetIds.add(newBetId);
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());
Response res1 = pkService.doJoin(user03,newBetId,optionsIds.get(0));
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);
Response popRes = pkService.popup(user03);
popRes.prettyPrint();
Assert.assertEquals(popRes.jsonPath().getString("data.show"),"true","校验是否展示弹层失败");
Assert.assertEquals(popRes.jsonPath().getString("data.totalBonus"),"0.1","校验是否展示弹层失败");
Assert.assertEquals(popRes.jsonPath().getString("data.drawType"),"0","校验开奖类型失败");
Assert.assertEquals(popRes.jsonPath().getString("data.lucky"),"false","校验不发福袋失败失败");
List<PkPopPrizeVo> prizeVoList = popRes.jsonPath().getList("data.prizeList",PkPopPrizeVo.class);
logger.info("开奖结果的list为:"+JSONObject.toJSONString(prizeVoList));
for (PkPopPrizeVo prize:prizeVoList){
if (prize.getBonusType().equals("2")){
Assert.assertEquals(prize.getTotalBonus(),"10","校验list的瓜分红包金额失败");
}
}
}
@Test(priority = 2)
public void 瓜分红包_首页不中奖() throws Exception{
String newBetId = "";
List<String> optionsIds = new ArrayList<>();
String groupId = "194";
newBetId = createPk("2","2020-08-12 00:00:00",groupId);
newBetIds.add(newBetId);
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());
Response res1 = pkService.doJoin(user01,newBetId,optionsIds.get(0));
Response res2 = pkService.doJoin(user02,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);
Response popRes = pkService.popup(user02);
popRes.prettyPrint();
Assert.assertEquals(popRes.jsonPath().getString("data.show"),"false","校验是否展示弹层失败");
Assert.assertEquals(popRes.jsonPath().getString("data.totalBonus"),"0.0","校验红包值失败");
Assert.assertEquals(popRes.jsonPath().getString("data.drawType"),"0","校验开奖类型失败");
Assert.assertEquals(popRes.jsonPath().getString("data.lucky"),"false","校验不发福袋失败失败");
Assert.assertEquals(popRes.jsonPath().getString("data.prizeList"),null,"校验中奖list为null");
}
@Test(priority = 1)
public void 瓜分红包_首页中_多次中奖() throws Exception{
for (int i=0;i<3;i++){
String newBetId = "";
List<String> optionsIds = new ArrayList<>();
String groupId = "194";
newBetId = createPk("2","2020-08-12 00:00:00",groupId);
newBetIds.add(newBetId);
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 j=0;j<pks.size();j++){
optionsIds.add(pks.get(j).get("id").toString());
}
logger.info("pk活动id为:"+newBetId+",选项id为:"+ optionsIds.toString());
Response res1 = pkService.doJoin(user04,newBetId,optionsIds.get(0));
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);
Response popRes = pkService.popup(user04);
popRes.prettyPrint();
Assert.assertEquals(popRes.jsonPath().getString("data.show"),"true","校验是否展示弹层失败");
Assert.assertEquals(popRes.jsonPath().getString("data.totalBonus"),"0.3","校验是否展示弹层失败");
Assert.assertEquals(popRes.jsonPath().getString("data.drawType"),"0","校验开奖类型失败");
Assert.assertEquals(popRes.jsonPath().getString("data.lucky"),"false","校验不发福袋失败失败");
List<PkPopPrizeVo> prizeVoList = popRes.jsonPath().getList("data.prizeList",PkPopPrizeVo.class);
logger.info("开奖结果的list为:"+JSONObject.toJSONString(prizeVoList));
for (PkPopPrizeVo prize:prizeVoList){
if (prize.getBonusType().equals("2")){
Assert.assertEquals(prize.getTotalBonus(),"30","校验list的瓜分红包金额失败");
}
}
}
public String 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");
logger.info("newBetId的信息为"+betId);
Response betRelation = pkActivityService.betGroupRelation(betId,endTime,groupId);
Response modifyStatusResponse = pkActivityService.modifySatus(betId);
return betId;
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
String endTimeStr = "2018-11-26 20:24:39";
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 {
for (String newBetId:newBetIds){
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id = ?",newBetId);
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id = ?",newBetId);
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",newBetId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",newBetId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",newBetId);
}
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
}
}
\ No newline at end of file
......@@ -59,9 +59,9 @@ public class 插件工具抽奖测试_pluginTest extends DuibaTestBase {
Object[][] result = null;
if(method.getName().equals("插件工具抽奖测试")) {
result = new Object[][]{
new Object[]{1,"1100","插件出奖开心码测试"},
// new Object[]{2,"881","插件工具积分消耗"},
// new Object[]{3,"1137","插件工具免费次数使用"},
// new Object[]{1,"1100","插件出奖开心码测试"},
new Object[]{2,"881","插件工具积分消耗"},
new Object[]{3,"1137","插件工具免费次数使用"},
};
}
......
......@@ -28,6 +28,19 @@ public class 补给站_活动_DuibaTest extends AbstractTestNGSpringContextTests
//添加活动
@Test(description = "//添加活动")
public void a_添加活动() throws Exception{
//查询订单列表
Response orderResponse = developerBJZ.selectOrders("1",appId);
String id = orderResponse.jsonPath().getString("data.list");
logger.info("待付款订单id为:"+id);
if(id.equals("[]")){
logger.info("订购列表无待付款订单");
}else{
id = orderResponse.jsonPath().getString("data.list[0].id");
logger.info("待付款订单id为:"+id);
developerBJZ.cancleOrder(id,appId);
logger.info("待付款订单取消成功");
}
//查询热门活动-活动列表,获取商品ID
Response response=developerBJZ.saasActivitys("3",appId);
String goodItemId= String.valueOf(response.jsonPath().getString("data.saasActivitys[0].id"));
......
package http.cases.SaasDeveloperTest;
import base.Config;
import base.DuibaBase;
import http.service.Manager.ADeveloperService;
import http.service.Saas.UpdateAppInfoService;
import base.DuibaLog;
import io.restassured.response.Response;
import org.apache.commons.exec.ExecuteException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.Assert;
import org.testng.annotations.Test;
@ContextConfiguration(classes = Config.class)
public class 设置_应用信息_DuibaTest extends AbstractTestNGSpringContextTests {
//@ContextConfiguration(classes = Config.class)
public class 设置_应用信息_DuibaTest extends DuibaBase {
private DuibaLog logger = DuibaLog.getLogger();
@Autowired
UpdateAppInfoService updateAppInfoService;
@Autowired
ADeveloperService aDeveloperService;
String appId = "19515";
//设置--保存应用信息
@Test
public void 保存应用信息() throws Exception{
String appId="19515";
String earnCreditsUrl="https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com";
String creditsDetailUrl="https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com";
Response response= updateAppInfoService.appInfo(appId);
Boolean isDecimalOpen=response.jsonPath().getBoolean("data.isDecimalOpen");
logger.info("******"+isDecimalOpen);
//@Test
public void 保存应用信息() throws Exception {
String appId = "19515";
String earnCreditsUrl = "https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com";
String creditsDetailUrl = "https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com";
Response response = updateAppInfoService.appInfo(appId);
Boolean isDecimalOpen = response.jsonPath().getBoolean("data.isDecimalOpen");
logger.info("******" + isDecimalOpen);
String unitName = isDecimalOpen ? "元" : "积分";
updateAppInfoService.UpdateAppInfo(appId,unitName,earnCreditsUrl,creditsDetailUrl,isDecimalOpen);
updateAppInfoService.UpdateAppInfo(appId, unitName, earnCreditsUrl, creditsDetailUrl, isDecimalOpen);
Thread.sleep(1000);
Response response2= updateAppInfoService.appInfo(appId);
Response response2 = updateAppInfoService.appInfo(appId);
Assert.assertEquals(response2.jsonPath().getString("data.name"), "(saas自动化)至尊版", "校验应用名称失败");
Assert.assertEquals(response2.jsonPath().getString("data.earnCreditsLetter"), "积分文案&2", "校验积分文案失败");
Assert.assertEquals(response2.jsonPath().getString("data.creditsDetailUrl"), "https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com", "校验积分明细链接失败");
logger.info("保存应用信息成功");
}
@Test(description = "// 查询员工信息——高级管理员信息")
public void a_查询高级管理员信息() throws Exception {
Response response1 = aDeveloperService.developer("109","text");
logger.info("response1");
Response response2=updateAppInfoService.selectEmployeeList("","",appId);
logger.info("response2");
String mappname=response1.jsonPath().getString("list[0].appName");
String memail=response1.jsonPath().getString("list[0].email");
String mname=response1.jsonPath().getString("list[0].name");
String demail=response2.jsonPath().getString("data.list[0].developerAccount");
String dname=response2.jsonPath().getString("data.list[0].nickName");
// 校验2个接口的信息是否一致
Assert.assertEquals(mappname,"(saas自动化)至尊版", "校验应用名称失败");
Assert.assertEquals(memail,demail,"校验邮箱失败");
Assert.assertEquals(mname,dname,"校验高级管理员名称失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[0].roleName"),"高级管理员","校验角色名称失败");
logger.info("校验高级管理员信息成功");
}
@Test(description = "//添加/编辑员工")
public void b_添加员工() throws Exception{
Response response=updateAppInfoService.selectAllRoles(appId);
//查询角色接口,得到普通管理员的角色ID
String roleId=response.jsonPath().getString("data[1].id");
//添加一个注册过的开发者&普通管理员信息
updateAppInfoService.saveOrUpdate("18258853242","hmx自动化测试",roleId,"普通管理员",appId);
//刷新员工管理列表
updateAppInfoService.selectEmployeeList("","1",appId);
//校验是否添加成功
Assert.assertEquals(updateAppInfoService.selectEmployeeList("","",appId).jsonPath().getString("data.list[1].developerAccount"),"18258853242", "校验账号信息失败");
Assert.assertEquals(updateAppInfoService.selectEmployeeList("","",appId).jsonPath().getString("data.list[1].nickName"),"hmx自动化测试", "校验名称失败");
Assert.assertEquals(updateAppInfoService.selectEmployeeList("","",appId).jsonPath().getString("data.list[1].roleName"),"普通管理员", "校验角色名称失败");
logger.info("校验普通管理员信息添加成功");
}
@Test(description = "兑吧账号精确搜索,姓名模糊搜索")
public void c_搜索场景() throws Exception{
//通过邮箱号精确搜索
updateAppInfoService.selectEmployeeList("","wxs@duiba.com.cn",appId);
//通过手机号精确搜索
updateAppInfoService.selectEmployeeList("","18258853242",appId);
//姓名模糊搜索
updateAppInfoService.selectEmployeeList("","hmx",appId);
//通过角色名称搜索
updateAppInfoService.selectEmployeeList("395","",appId);
logger.info("校验各种搜索成功");
}
@Test(description = "删除添加的管理员")
public void d_删除管理员() throws Exception{
Response response = updateAppInfoService.selectEmployeeList("","",appId);
String id = response.jsonPath().getString("data.list[1].id");
logger.info("员工id为:"+id);
response = updateAppInfoService.delete(appId,id);
logger.info("员工删除成功!");
}
}
/**
* Copyright (C), 2015-2018
* FileName: 购物车测试
* Author: zhaoran
* Date: 2018/12/10 19:45
* Description:
*/
package http.cases.SaasDeveloperTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.PkService;
import http.service.Authorization;
import http.service.Saas.MallService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
public class 购物车测试 extends DuibaTestBase {
@Value("${activity.host}")
String activityHost;
@Autowired
MallService mallService;
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid = 5415;
@Test
public void 加入购物车() throws Exception{
//获取当前购物车数量
Response response = mallService.getMallCount(uid);
response.prettyPrint();
logger.info("购物车当前的数量为:"+response.jsonPath().getString("data.trolleyItemCount"));
}
}
\ No newline at end of file
......@@ -9,12 +9,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import utils.MatcherString;
import utils.RedisUtil;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -23,7 +21,7 @@ import static io.restassured.RestAssured.given;
/**
* Created by zhaoran on 2018/6/8.
*/
public class 自有单抽限制_AccessTest extends DuibaTestBase {
public class 自有单抽限制 extends DuibaTestBase {
@Autowired
SingleLotteryService singleLotteryService;
@Autowired
......
/**
* Copyright (C), 2015-2018
* FileName: PkPopPrizeVo
* Author: qianwenjun
* Date: 2018/12/22 14:07
* Description:
*/
package http.model;
import lombok.Getter;
import lombok.Setter;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/12/22
* @since 1.0.0
*/
@Getter
@Setter
public class PkPopPrizeVo {
private String bonusType;
private String pluginId;
private String title;
private String totalBonus;
}
\ No newline at end of file
......@@ -300,7 +300,7 @@ public class Authorization {
public Map hdLoginSaasNew(String account,String appId){
String path = "/doLoginNew";
int i=10;
logger.info("hdCookiesSaasByApp cookies:"+hdCookiesSaasNew.toString());
logger.info("hdCookiesSaasNew cookies:"+hdCookiesSaasNew.toString());
Map<String,String> hdCookies = hdCookiesSaasNew.get(appId);
while((hdCookies==null||hdCookies.size()==0)&&i>0) {
Response token=this.hdGetToken();
......@@ -328,7 +328,7 @@ public class Authorization {
i--;
}
logger.info("hdCookiesSaasByApp cookies集合:"+hdCookiesSaasNew.toString());
logger.info("hdCookiesSaasNew cookies集合:"+hdCookiesSaasNew.toString());
return hdCookies;
}
......
......@@ -97,4 +97,32 @@ public class ADeveloperService {
}
return response;
}
//管理后台-开发者维护-查询开发者账号详细信息
public Response developer(String queryStrId,String type) throws Exception {
String url ="http://" + ManagerHost + "/newmanager/ADeveloper/developer";
Map<String,String> map = new HashMap<>();
map.put("queryStr","");
map.put("queryStrId",queryStrId);
map.put("type",type);
map.put("pageNo","1");
map.put("pageSize","20");
logger.info("url"+url);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.ssoLogin()).params(map).get(url);
response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("success"), "true");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
}
package http.service.Saas;
import base.DuibaLog;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.testng.Assert;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
/**
* Created by zhaoran on 2018/12/19.
*/
@Service
public class MallService {
@Value("${activity.host}")
String activityHost;
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
//获取购物车列表商品
public Response mallget(Integer uid) throws Exception {
String url = activityHost+"/mall-api/consumer/shopping-trolley/get";
Response response=given().cookies(authorization.dafuwengLogin(uid)).get(url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("购物车列表接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("购物车列表接口失败,返回信息:"+response.asString());
}
return response;
}
//获取购物车列表商品
public Response getMallCount(Integer uid) throws Exception {
String url = activityHost+"/mall-api/consumer/market-activity/getMallCount";
Response response=given().cookies(authorization.dafuwengLogin(uid)).get(url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("购物车数目接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("购物车数目接口失败,返回信息:"+response.asString());
}
return response;
}
// 加入购物车
public Response malladd(String appItemId,Integer uid) throws Exception {
String url = activityHost+"/mall-api/consumer/shopping-trolley/add";
Map<String,String> map = new HashMap<>();
map.put("appItemId",appItemId);
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).body(jsonParam).post(url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("添加购物车接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("添加购物车接口失败,返回信息:"+response.asString());
}
return response;
}
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package http.service.Saas;
import base.DuibaLog;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -73,4 +75,83 @@ public class UpdateAppInfoService {
return response;
}
//查询员工管理高级管理员信息(模糊查询,没有传参数)
public Response selectEmployeeList(String roleId,String keyword,String appId) throws Exception {
String url = "http://" + hdHost + "/employee/selectEmployeeList";
Map<String, String> map = new HashMap<>();
map.put("roleId",roleId);
map.put("rowId","1");
map.put("keyword",keyword);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//查询有的角色信息
public Response selectAllRoles(String appId) throws Exception {
String url = "http://" + hdHost + "/employee/selectAllRoles";
Map<String, String> map = new HashMap<>();
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//添加员工——普通管理员
public Response saveOrUpdate(String developerAccount,String nickName,String roleId,String roleName,String appId) throws Exception {
String url = "http://" + hdHost + "/employee/saveOrUpdate";
Map<String, String> map = new HashMap<>();
map.put("developerAccount",developerAccount);
map.put("nickName",nickName);
map.put("roleId",roleId);
map.put("roleName",roleName);
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
Response response =given().contentType("application/json;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).body(jsonParam).post(url);
response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//删除管理员
public Response delete(String appId,String id) throws Exception {
String url = "http://" + hdHost + "/employee/delete";
Map<String, String> map = new HashMap<>();
map.put("id",id);
Response response = given().cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("/employee/delete失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("/employee/delete失败,返回信息:" + response.asString());
}
return response;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment