Commit d9cf33cb authored by 马博's avatar 马博

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

parents 5dc5104d 39a9ab0a
......@@ -15,7 +15,7 @@ import java.util.Map;
/**
* Created by mabo on 2018/5/17
*/
public class 手动开奖出奖_DuibaTest extends DuibaTestBase {
public class 手动开奖出奖 extends DuibaTestBase {
@Autowired
NewActivityService newActivityService;
@Autowired
......
......@@ -23,7 +23,7 @@ import java.lang.reflect.Method;
* Created by lvwenyan on 2018/11/23.
*/
public class 新建活动测试_DuibaTest extends DuibaTestBase{
public class 新建活动测试 extends DuibaTestBase{
@Autowired
DeveloperService developerService;
......
......@@ -18,7 +18,7 @@ import org.testng.annotations.Test;
* Created by zhaoran on 2018/5/19.
*/
@ContextConfiguration(classes = Config.class)
public class 活动中奖限制_DuibaTest extends AbstractTestNGSpringContextTests {
public class 活动中奖限制 extends AbstractTestNGSpringContextTests {
@Autowired
SigninService signinService;
@Autowired
......
......@@ -19,7 +19,7 @@ import java.lang.reflect.Method;
* Created by zhaoran on 2018/3/15
*/
@ContextConfiguration(classes = Config.class)
public class 活动次数测试_DuibaTest extends AbstractTestNGSpringContextTests {
public class 活动次数测试 extends AbstractTestNGSpringContextTests {
@Autowired
NewActivityService newActivityService;
......
......@@ -15,7 +15,7 @@ import org.testng.annotations.Test;
* Created by zhaoran on 2018/1/2
*/
@ContextConfiguration(classes = Config.class)
public class 独立活动测试_DuibaTest extends AbstractTestNGSpringContextTests {
public class 独立活动测试 extends AbstractTestNGSpringContextTests {
@Autowired
NewActivityService newActivityService;
......
......@@ -17,7 +17,7 @@ import java.util.Map;
/**
* Created by mabo on 2018/5/17
*/
public class 自有活动出奖_DuibaTest extends DuibaTestBase {
public class 自有活动出奖 extends DuibaTestBase {
@Autowired
NewActivityService newActivityService;
@Autowired
......
......@@ -23,7 +23,7 @@ import java.util.Map;
* Created by zhaoran on 2018/5/19.
*/
@ContextConfiguration(classes = Config.class)
public class 自有答题测试_DuibaTest extends DuibaTestBase {
public class 自有答题测试 extends DuibaTestBase {
@Autowired
SigninService signinService;
@Autowired
......
......@@ -19,7 +19,7 @@ import org.testng.annotations.Test;
import java.util.Map;
//@ContextConfiguration(classes = DuibaConfig.class)
public class Exchange_ExchangeTest extends CheckTemplet {
public class Exchange extends CheckTemplet {
@Value("${manager.host}")
String ManagerHost;
@Autowired
......
......@@ -23,7 +23,7 @@ import java.util.Map;
* Created by yeqinqin on 2018/4/24.
*/
public class ObjectExchange_ExchangeTest extends CheckTemplet {
public class ObjectExchange extends CheckTemplet {
@Autowired
private MobileService mobileService;
......
......@@ -29,7 +29,7 @@ import java.util.concurrent.ThreadFactory;
/**
* Created by mabo on 2018/9/13
*/
public class Qb_兑换流程测试_ExchangeTest extends CheckTemplet {
public class Qb_兑换流程测试 extends CheckTemplet {
@Autowired
private MobileService mobileService;
@Autowired
......
......@@ -26,7 +26,7 @@ import java.util.Map;
/**
* Created by mabo on 2018/9/13
*/
public class Qb_兑换限制测试_ExchangeTest extends CheckTemplet {
public class Qb_兑换限制测试 extends CheckTemplet {
@Autowired
private MobileService mobileService;
@Autowired
......
......@@ -24,7 +24,7 @@ import static io.restassured.RestAssured.given;
* Created by lvwenyan on 2019/3/14
*/
public class 多档位话费_兑换流程测试_ExchangeTest extends CheckTemplet {
public class 多档位话费_兑换流程测试 extends CheckTemplet {
@Autowired
private MobileService mobileService;
......
......@@ -28,7 +28,7 @@ import static io.restassured.RestAssured.given;
* Created by lvwenyan on 2018/08/24.
*/
public class 支付宝_兑换流程测试_ExchangeTest extends CheckTemplet {
public class 支付宝_兑换流程测试 extends CheckTemplet {
@Autowired
AlipayExchangeService alipayExchangeService;
......
......@@ -23,7 +23,7 @@ import java.util.Map;
* Created by lvwenyan on 2019/5/30
*/
public class Qb_兑换流程测试_ExchangeTest extends CheckTemplet {
public class Qb_兑换流程测试 extends CheckTemplet {
@Autowired
gawService gawService;
......
......@@ -23,7 +23,7 @@ import java.util.Map;
* Created by lvwenyan on 2019/5/30
*/
public class 新多档位话费_兑换流程测试_ExchangeTest extends CheckTemplet {
public class 新多档位话费_兑换流程测试 extends CheckTemplet {
@Autowired
gawService gawService;
......
......@@ -28,7 +28,7 @@ import static io.restassured.RestAssured.given;
* Created by lvwenyan on 2019/05/23.
*/
public class 新支付宝_兑换流程测试_ExchangeTest extends CheckTemplet {
public class 新支付宝_兑换流程测试 extends CheckTemplet {
@Autowired
gawService gawService;
......
......@@ -23,7 +23,7 @@ import static io.restassured.RestAssured.given;
/**
* Created by mabo on 2019/2/28
*/
public class 话费_兑换限制测试_ExchangeTest extends CheckTemplet {
public class 话费_兑换限制测试 extends CheckTemplet {
@Autowired
private MobileService mobileService;
@Autowired
......
......@@ -34,7 +34,7 @@ import static io.restassured.RestAssured.urlEncodingEnabled;
* Created by lvwenyan on 2019/3/26.
*/
public class 兑吧卡密_兑换流程测试_ExchangeTest extends CheckTemplet {
public class 兑吧卡密_兑换流程测试 extends CheckTemplet {
@Autowired
gawService gawService;
......
......@@ -29,7 +29,7 @@ import static io.restassured.RestAssured.given;
*/
public class 兑吧新优惠券_兑换流程测试_ExchangeTest extends CheckTemplet {
public class 兑吧新优惠券_兑换流程测试 extends CheckTemplet {
@Autowired
......
......@@ -31,7 +31,7 @@ import static io.restassured.RestAssured.given;
* Created by lvwenyan on 2019/3/19.
*/
public class 兑吧新实物_兑换流程测试_ExchangeTest extends CheckTemplet {
public class 兑吧新实物_兑换流程测试 extends CheckTemplet {
@Autowired
gawService gawService;
......
......@@ -30,7 +30,7 @@ import static io.restassured.RestAssured.given;
* Created by lvwenyan on 2018/07/06.
*/
public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTemplet {
public class 兑吧老优惠券_兑换流程测试 extends CheckTemplet {
@Autowired
private MobileService mobileService;
......
......@@ -31,7 +31,7 @@ import static io.restassured.RestAssured.given;
/**
* Created by yeqinqin on 2018/6/11.
*/
public class 兑吧老实物_兑换流程测试_ExchangeTest extends CheckTemplet {
public class 兑吧老实物_兑换流程测试 extends CheckTemplet {
@Autowired
private MobileService mobileService;
......
......@@ -22,7 +22,7 @@ import java.util.Map;
* Created by lvwenyan on 2018/06/08.
*/
public class 商品订单失败测试_ExchangeTest extends CheckTemplet {
public class 商品订单失败测试 extends CheckTemplet {
@Autowired
......
......@@ -25,7 +25,7 @@ import static io.restassured.RestAssured.given;
*/
//@ContextConfiguration(classes = DuibaConfig.class)
public class 平台券_兑换流程测试_ExchangeTest extends CheckTemplet {
public class 平台券_兑换流程测试 extends CheckTemplet {
@Autowired
AppPlatformCouponService appPlatformCouponService;
......
......@@ -23,7 +23,7 @@ import java.util.Map;
* 测试开发者账号:zhaoran@duiba.com.cn , 用户uid:4386
*/
public class 开发者账户余额校验测试_ExchangeTest extends CheckTemplet {
public class 开发者账户余额校验测试 extends CheckTemplet {
@Autowired
......
......@@ -22,7 +22,7 @@ import java.util.Map;
/**
* Created by mabo on 2019/3/25
*/
public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTemplet{
public class 自有新优惠券_兑换限制测试 extends CheckTemplet{
@Autowired
http.service.app.gawService gawService;
......
......@@ -27,7 +27,7 @@ import static io.restassured.config.RestAssuredConfig.newConfig;
/**
* Created by mabo on 2019/3/26
*/
public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemplet {
public class 自有新卡密_兑换限制测试 extends CheckTemplet {
/**
* 15968831723 duibaduiba123
* 查询库存 SELECT stock_id,id from tb_goods_batch where gtype = 6 and gid = 50 //gtype=6 表示卡密类型,gid 是卡密的id,查到的id是goods_batch_id
......
......@@ -16,7 +16,7 @@ import java.lang.reflect.Method;
import java.sql.SQLException;
import java.util.Map;
public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemplet {
public class 自有新实物_兑换流程测试 extends CheckTemplet {
@Autowired
http.service.app.gawService gawService;
@Autowired
......
......@@ -19,7 +19,7 @@ import java.util.Map;
/**
* Created by mabo on 2019/3/26
*/
public class 自有新虚拟商品_充值_兑换限制_ExchangeTest extends CheckTemplet{
public class 自有新虚拟商品_充值_兑换限制 extends CheckTemplet{
@Autowired
http.service.app.gawService gawService;
@Autowired
......
......@@ -28,7 +28,7 @@ import static io.restassured.RestAssured.given;
/**
* Created by mabo on 2019/3/22
*/
public class 自有老优惠券商品_兑换限制测试_ExchangeTest extends CheckTemplet {
public class 自有老优惠券商品_兑换限制测试 extends CheckTemplet {
@Autowired
private MobileService mobileService;
@Autowired
......
......@@ -27,7 +27,7 @@ import static io.restassured.RestAssured.given;
/**
* Created by mabo on 2019/3/22
*/
public class 自有老实物_兑换限制测试_ExchangeTest extends CheckTemplet {
public class 自有老实物_兑换限制测试 extends CheckTemplet {
@Autowired
private MobileService mobileService;
@Autowired
......
......@@ -24,7 +24,7 @@ import java.util.Map;
/**
* Created by mabo on 2019/3/25
*/
public class 自有老虚拟商品_兑换限制测试_ExchangeTest extends CheckTemplet {
public class 自有老虚拟商品_兑换限制测试 extends CheckTemplet {
@Autowired
private MobileService mobileService;
@Autowired
......
......@@ -25,7 +25,7 @@ import static io.restassured.RestAssured.given;
* Created by panyuli on 2018/07/06.
*/
public class 自有老优惠券_兑换流程测试_ExchangeTest extends CheckTemplet {
public class 自有老优惠券_兑换流程测试 extends CheckTemplet {
@Autowired
......
......@@ -22,7 +22,7 @@ import java.util.Map;
/**
* Created by panyuli on 2018/6/11.
*/
public class 虚拟商品_兑换异常测试_ExchangeTest extends CheckTemplet {
public class 虚拟商品_兑换异常测试 extends CheckTemplet {
@Autowired
private MobileService mobileService;
......
......@@ -41,7 +41,7 @@ public class 游戏_中奖优惠券_AccessTest extends DuibaTestBase {
@Test
//@Test
public void 游戏_普通优惠券中奖测试() throws Exception{
try {
//查询游戏前奖项库存信息
......@@ -55,6 +55,7 @@ public class 游戏_中奖优惠券_AccessTest extends DuibaTestBase {
Long itemStock = Long.parseLong(itemStockResult.get("stock").toString());
Response response = this.playGame("20178","z0eyz5d3","88",uid_Nomal);
logger.info("dddddddddddd"+response.prettyPrint());
//游戏后的奖项库存
Map<String,Object> ngameStockResult1 = jdbc.findSimpleResult("select * from ngame.ngame_stock where game_option_id = ?\n",optionId);
String optionStock1 = ngameStockResult1.get("stock").toString();
......@@ -116,7 +117,7 @@ public class 游戏_中奖优惠券_AccessTest extends DuibaTestBase {
int j=8;
while (j>0&&((!checkNomal("getStartStatus",statusResponse))||(message.equals("处理中")))){
Thread.sleep(1000);
Thread.sleep(10000);
statusResponse = newGameService.getStartStatus(ticketId,uid);
statusResponse.prettyPrint();
statusSuccess = MatcherString.getString(statusResponse.asString(),"\"success\": (.*?),",1);
......
......@@ -23,7 +23,7 @@ import java.util.Map;
* Created by zhaoran on 2018/1/2
*/
@ContextConfiguration(classes = Config.class)
public class 优惠券测试_DuibaTest extends AbstractTestNGSpringContextTests {
public class 优惠券测试 extends AbstractTestNGSpringContextTests {
@Autowired
NewActivityService newActivityService;
......
......@@ -16,7 +16,7 @@ import org.testng.annotations.Test;
* Created by lvwenyan on 2019/4/4.
*/
public class 兑吧活动工具_新商品_DuibaTest extends DuibaTestBase {
public class 兑吧活动工具_新商品 extends DuibaTestBase {
@Autowired
AdminNewDuibaHdtoolService adminNewDuibaHdtoolService;
......
......@@ -16,7 +16,7 @@ import java.util.Map;
/**
* Created by zhaoran on 2018/1/2
*/
public class 新活动工具测试_DuibaTest extends DuibaTestBase {
public class 新活动工具测试 extends DuibaTestBase {
@Autowired
NewActivityService newActivityService;
......
......@@ -19,7 +19,7 @@ import java.util.Map;
* Created by lvwenyan on 2019/4/4.
*/
public class 自有活动工具_新商品_DuibaTest extends DuibaTestBase {
public class 自有活动工具_新商品 extends DuibaTestBase {
@Autowired
LaunchService launchService;
......
......@@ -3,7 +3,8 @@
* FileName: 瓜分积分测试_AccessTest
* Author: zhaoran
* Date: 2018/12/10 19:45
* Description: "appId": 21771
* AppId: 21827
* Description:
*/
package http.cases.PkMoudleTest;
......@@ -11,7 +12,6 @@ package http.cases.PkMoudleTest;
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 http.service.hd.PkDevelopService;
......@@ -24,8 +24,8 @@ import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
......@@ -40,9 +40,9 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid1 = 5029;
private static Integer uid2 = 5058;
private static Integer uid3 = 5059;
private static Integer uid1 = 5080;
private static Integer uid2 = 5081;
private static Integer uid3 = 5086;
private static String betId;
private static String optionId1;
private static String optionId2;
......@@ -50,7 +50,7 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
@Test
public void 创建PK活动() throws Exception{
Response response = pkDevelopService.betEditor("21771","2","4",null,"1","30");
Response response = pkDevelopService.betEditor("21827","2","4","1","1","30");
Assert.assertEquals(response.jsonPath().getString("desc"),"成功","创建组件化pk活动失败");
response = pkService.getBetList(uid1);
......@@ -98,7 +98,9 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
Response res2 = pkService.doJoin(uid2,betId,optionId1);
Response res3 = pkService.doJoin(uid3,betId,optionId2);
//查询数据库,投注前积分(抽奖扣积分流程校验)
Thread.sleep(5000);
//查询数据库,投注后积分(抽奖扣积分流程校验)
mapuser1 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid1);
mapuser2 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid2);
mapuser3 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
......@@ -133,9 +135,9 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
logger.info("用户2开奖前积分:"+credits2);
logger.info("用户3开奖前积分:"+credits3);
//增加积分: 30/(2+2)
credits1 = String.valueOf(Integer.valueOf(credits1)+7);
credits2 = String.valueOf(Integer.valueOf(credits2)+7);
//增加积分:设置实际每人瓜分1积分
credits1 = String.valueOf(Integer.valueOf(credits1)+1);
credits2 = String.valueOf(Integer.valueOf(credits2)+1);
//修改开奖时间
this.modifyOpenPrizeTime(betId,60);
......@@ -174,9 +176,9 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0661 where consumer_id = '100112021' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"7","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0691 where consumer_id = '100112051' and duiba_activity_id = ?\n",betId);
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0723 where consumer_id = '100112083' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"1","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0724 where consumer_id = '100112084' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
logger.info("用户01获取的积分值为:"+user01_order.get("add_credits").toString()+",用户03获取的积分值为:"+user02_order.get("add_credits").toString());
......@@ -194,9 +196,12 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
public void 出奖弹层校验() throws Exception {
Response response = pkService.popup(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"7","中奖弹窗积分校验失败");
//Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"1","中奖弹窗积分校验失败");
Assert.assertTrue(new BigDecimal(response.jsonPath().getString("data.prizeList[0].totalBonus")).compareTo(new BigDecimal("1"))==0,"中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"4","中奖弹窗类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.unitName"),"金币","积分单位校验失败");
Response response2 = pkService.popup(uid3);
response.prettyPrint();
......@@ -206,6 +211,8 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
@Test(dependsOnMethods = { "出奖弹层校验" })
public void 战绩页校验() throws Exception {
Thread.sleep(10000);
Response response = pkService.list(uid1);
response.prettyPrint();
......@@ -221,20 +228,20 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].optionId"),optionId1,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].rank"),"1","活动投注结果校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"4","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"66.7","活动投注人数比例校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"4","活动投注人数校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"66.7","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].optionId"),optionId2,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].rank"),"2","活动投注结果校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"2","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"33.3","活动投注人数比例校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"2","活动投注人数校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"33.3","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId1,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.07","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"1","兑换状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.01","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"2","兑换状态校验失败");
response = pkService.list(uid3);
response.prettyPrint();
......@@ -256,12 +263,17 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",betId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",betId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",betId);
Boolean result6 = jdbc.update("delete from credits_dev.operating_activity where type = 53 and app_id = 21827");
Boolean result7 = jdbc.update("delete from act_com_conf.tb_bet_act_group where app_id = 21827");
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
DateTime time1 = new DateTime();
......@@ -276,6 +288,4 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
Boolean result2 = jdbc.update("update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = ?\n",endTimeStr,betId);
}
}
\ No newline at end of file
......@@ -28,7 +28,7 @@ import java.sql.SQLException;
import java.util.Map;
public class 瓜分积分_实际瓜分_主胜方_AccessTest extends DuibaTestBase {
public class 瓜分积分_实际瓜分_主胜方 extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
......
......@@ -3,8 +3,7 @@
* FileName: 瓜分积分测试_AccessTest
* Author: zhaoran
* Date: 2018/12/10 19:45
* AppId: 21827
* Description:
* Description: "appId": 21771
*/
package http.cases.PkMoudleTest;
......@@ -12,6 +11,7 @@ package http.cases.PkMoudleTest;
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 http.service.hd.PkDevelopService;
......@@ -24,12 +24,12 @@ import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
public class 瓜分积分_实际瓜分_废弃 extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
......@@ -40,9 +40,9 @@ public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid1 = 5080;
private static Integer uid2 = 5081;
private static Integer uid3 = 5086;
private static Integer uid1 = 5029;
private static Integer uid2 = 5058;
private static Integer uid3 = 5059;
private static String betId;
private static String optionId1;
private static String optionId2;
......@@ -50,7 +50,7 @@ public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
@Test
public void 创建PK活动() throws Exception{
Response response = pkDevelopService.betEditor("21827","2","4","1","1","30");
Response response = pkDevelopService.betEditor("21771","2","4",null,"1","30");
Assert.assertEquals(response.jsonPath().getString("desc"),"成功","创建组件化pk活动失败");
response = pkService.getBetList(uid1);
......@@ -98,9 +98,7 @@ public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
Response res2 = pkService.doJoin(uid2,betId,optionId1);
Response res3 = pkService.doJoin(uid3,betId,optionId2);
Thread.sleep(5000);
//查询数据库,投注后积分(抽奖扣积分流程校验)
//查询数据库,投注前积分(抽奖扣积分流程校验)
mapuser1 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid1);
mapuser2 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid2);
mapuser3 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
......@@ -135,9 +133,9 @@ public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
logger.info("用户2开奖前积分:"+credits2);
logger.info("用户3开奖前积分:"+credits3);
//增加积分:设置实际每人瓜分1积分
credits1 = String.valueOf(Integer.valueOf(credits1)+1);
credits2 = String.valueOf(Integer.valueOf(credits2)+1);
//增加积分: 30/(2+2)
credits1 = String.valueOf(Integer.valueOf(credits1)+7);
credits2 = String.valueOf(Integer.valueOf(credits2)+7);
//修改开奖时间
this.modifyOpenPrizeTime(betId,60);
......@@ -176,9 +174,9 @@ public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0723 where consumer_id = '100112083' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"1","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0724 where consumer_id = '100112084' and duiba_activity_id = ?\n",betId);
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0661 where consumer_id = '100112021' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"7","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0691 where consumer_id = '100112051' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
logger.info("用户01获取的积分值为:"+user01_order.get("add_credits").toString()+",用户03获取的积分值为:"+user02_order.get("add_credits").toString());
......@@ -196,12 +194,9 @@ public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
public void 出奖弹层校验() throws Exception {
Response response = pkService.popup(uid1);
response.prettyPrint();
//Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"1","中奖弹窗积分校验失败");
Assert.assertTrue(new BigDecimal(response.jsonPath().getString("data.prizeList[0].totalBonus")).compareTo(new BigDecimal("1"))==0,"中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"7","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"4","中奖弹窗类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.unitName"),"金币","积分单位校验失败");
Response response2 = pkService.popup(uid3);
response.prettyPrint();
......@@ -211,8 +206,6 @@ public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
@Test(dependsOnMethods = { "出奖弹层校验" })
public void 战绩页校验() throws Exception {
Thread.sleep(10000);
Response response = pkService.list(uid1);
response.prettyPrint();
......@@ -228,20 +221,20 @@ public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].optionId"),optionId1,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].rank"),"1","活动投注结果校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"4","活动投注人数校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"66.7","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"4","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"66.7","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].optionId"),optionId2,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].rank"),"2","活动投注结果校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"2","活动投注人数校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"33.3","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"2","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"33.3","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId1,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.01","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"2","兑换状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.07","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"1","兑换状态校验失败");
response = pkService.list(uid3);
response.prettyPrint();
......@@ -263,17 +256,12 @@ public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",betId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",betId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",betId);
Boolean result6 = jdbc.update("delete from credits_dev.operating_activity where type = 53 and app_id = 21827");
Boolean result7 = jdbc.update("delete from act_com_conf.tb_bet_act_group where app_id = 21827");
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
DateTime time1 = new DateTime();
......@@ -288,4 +276,6 @@ public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
Boolean result2 = jdbc.update("update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = ?\n",endTimeStr,betId);
}
}
\ No newline at end of file
......@@ -21,6 +21,7 @@ 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.BeforeClass;
import org.testng.annotations.Test;
import java.math.BigDecimal;
......@@ -40,17 +41,37 @@ public class 瓜分红包_实际瓜分 extends DuibaTestBase {
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid1 = 5088;
private static Integer uid2 = 5089;
private static Integer uid3 = 5090;
private static Integer uid1 = 5144;
private static Integer uid2 = 5145;
private static Integer uid3 = 5146;
private static String betId;
private static String optionId1;
private static String optionId2;
//@BeforeClass
// public void beforeclass() {
// try {
// Map<String,Object> map = jdbc.findSimpleResult("SELECT * FROM credits_dev.operating_activity where type = 53 and app_id = 21829");
// String rel_id = String.valueOf(map.get("id"));
// Boolean result9 = jdbc.update("delete from act_com_conf.tb_red_account_period_rel where rel_id > ?",rel_id);
// } catch (Exception e){
// e.printStackTrace();
// }
// }
@Test
public void 创建PK活动() throws Exception{
Response response = pkDevelopService.betEditor("21828","1","2",null,"1","30");
logger.info("开始生成预算token");
Response response = pkDevelopService.temporaryCard("21829","2","5","10","2019-03-04T16:00:00.000Z","2029-03-22T16:00:00.000Z");
String token = response.jsonPath().getString("data.checkUuid");
logger.info("生成预算token为:"+token);
pkDevelopService.preSaveCheck("21829",token);
logger.info("预算确认成功!");
response = pkDevelopService.betEditor_red("21829",token,"1","2","0.01","0","10");
Assert.assertEquals(response.jsonPath().getString("desc"),"成功","创建组件化pk_分红包活动失败");
response = pkService.getBetList(uid1);
......@@ -89,16 +110,14 @@ public class 瓜分红包_实际瓜分 extends DuibaTestBase {
logger.info("用户2投注前积分:"+credits2);
logger.info("用户3投注前积分:"+credits3);
//扣去1积分
credits1 = String.valueOf(Integer.valueOf(credits1)-1);
credits2 = String.valueOf(Integer.valueOf(credits2)-1);
credits3 = String.valueOf(Integer.valueOf(credits3)-1);
Response res1 = pkService.doJoin(uid1,betId,optionId1);
Response res2 = pkService.doJoin(uid2,betId,optionId1);
Response res3 = pkService.doJoin(uid3,betId,optionId2);
//查询数据库,投注前积分(抽奖扣积分流程校验)
Thread.sleep(5000);
//查询数据库,投注后积分(抽奖扣积分流程校验)
mapuser1 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid1);
mapuser2 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid2);
mapuser3 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
......@@ -121,11 +140,11 @@ public class 瓜分红包_实际瓜分 extends DuibaTestBase {
@Test(dependsOnMethods = { "投注" })
public void 开奖() throws Exception {
//查询数据库,开奖前红包余额
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0788 where consumer_id = '100112148' and account_type = '6'\n");
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0830 where consumer_id = '100112190' and account_type = '6'\n");
String use1_Acc1 = user01_account1.get("balance_amount").toString();
Map<String,Object> user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0824 where consumer_id = '100112184' and account_type = '6'\n");
Map<String,Object> user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0838 where consumer_id = '100112198' and account_type = '6'\n");
String use2_Acc1 = user02_account1.get("balance_amount").toString();
Map<String,Object> user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0825 where consumer_id = '100112185' and account_type = '6'\n");
Map<String,Object> user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0839 where consumer_id = '100112199' and account_type = '6'\n");
String use3_Acc1 = user03_account1.get("balance_amount").toString();
......@@ -133,10 +152,10 @@ public class 瓜分红包_实际瓜分 extends DuibaTestBase {
logger.info("用户2开奖前红包余额:"+use2_Acc1);
logger.info("用户3开奖前红包余额:"+use3_Acc1);
//预期增加红包: 750
//预期增加红包: 1
DecimalFormat decimalFormat = new DecimalFormat("###################.###########");
use1_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use1_Acc1),750));
use2_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use2_Acc1),750));
use1_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use1_Acc1),1));
use2_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use2_Acc1),1));
//修改开奖时间
this.modifyOpenPrizeTime(betId,60);
......@@ -147,11 +166,11 @@ public class 瓜分红包_实际瓜分 extends DuibaTestBase {
Thread.sleep(8000);
//查询数据库,开奖后红包余额
user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0788 where consumer_id = '100112148' and account_type = '6'\n");
user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0830 where consumer_id = '100112190' and account_type = '6'\n");
String use1_Acc2 = user01_account1.get("balance_amount").toString();
user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0824 where consumer_id = '100112184' and account_type = '6'\n");
user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0838 where consumer_id = '100112198' and account_type = '6'\n");
String use2_Acc2 = user02_account1.get("balance_amount").toString();
user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0825 where consumer_id = '100112185' and account_type = '6'\n");
user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0839 where consumer_id = '100112199' and account_type = '6'\n");
String use3_Acc2 = user03_account1.get("balance_amount").toString();
logger.info("用户1开奖后积分:"+use1_Acc2);
......@@ -173,9 +192,9 @@ public class 瓜分红包_实际瓜分 extends DuibaTestBase {
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0788 where consumer_id = '100112148' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"750","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0825 where consumer_id = '100112185' and duiba_activity_id = ?\n",betId);
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0830 where consumer_id = '100112190' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"1","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0839 where consumer_id = '100112199' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
logger.info("用户01获取的积分值为:"+user01_order.get("add_credits").toString()+",用户03获取的积分值为:"+user02_order.get("add_credits").toString());
......@@ -193,9 +212,11 @@ public class 瓜分红包_实际瓜分 extends DuibaTestBase {
public void 出奖弹层校验() throws Exception {
Response response = pkService.popup(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"750","中奖弹窗积分校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"1","中奖弹窗积分校验失败");
Assert.assertTrue(new BigDecimal(response.jsonPath().getString("data.prizeList[0].totalBonus")).compareTo(new BigDecimal("1"))==0,"中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"2","中奖弹窗类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.totalBonus"),"7.5","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.totalBonus"),"0.01","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败");
Response response2 = pkService.popup(uid3);
......@@ -206,14 +227,15 @@ public class 瓜分红包_实际瓜分 extends DuibaTestBase {
@Test(dependsOnMethods = { "出奖弹层校验" })
public void 战绩页校验() throws Exception {
Thread.sleep(10000);
Response response = pkService.list(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.list[0].userWin"),"true","中奖记录校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.id"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.shareExp"),"30","活动瓜分金额校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.shareExp"),"10","活动瓜分金额校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.configStatus"),"4","活动状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.creditsValue"),"1.00","活动消耗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.creditsValue"),"0","活动消耗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.betType"),"1","活动押注类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.bonusType"),"2","活动瓜分类型校验失败");
......@@ -221,19 +243,19 @@ public class 瓜分红包_实际瓜分 extends DuibaTestBase {
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].optionId"),optionId1,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].rank"),"1","活动投注结果校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"4","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"66.7","活动投注人数比例校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"544","活动投注人数校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"66.9","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].optionId"),optionId2,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].rank"),"2","活动投注结果校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"2","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"33.3","活动投注人数比例校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"269","活动投注人数校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"33.1","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId1,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"7.5","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.01","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"2","兑换状态校验失败");
response = pkService.list(uid3);
......@@ -251,11 +273,19 @@ public class 瓜分红包_实际瓜分 extends DuibaTestBase {
@AfterClass
public void afterclass() {
try {
// Map<String,Object> map = jdbc.findSimpleResult("SELECT * FROM act_com_conf.tb_red_account_period where app_id = 21829");
// String rel_id = String.valueOf(map.get("id"));
// Boolean result9 = jdbc.update("delete from act_com_conf.tb_red_account_period_rel where rel_id = ?",rel_id);
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id = ?",betId);
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id = ?",betId);
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",betId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",betId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",betId);
Boolean result6 = jdbc.update("delete from credits_dev.operating_activity where type = 53 and app_id = 21829");
Boolean result7 = jdbc.update("delete from act_com_conf.tb_red_account_period where app_id = 21829");
Boolean result8 = jdbc.update("delete from act_com_conf.tb_bet_act_group where app_id = 21829");
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
......@@ -276,6 +306,7 @@ public class 瓜分红包_实际瓜分 extends DuibaTestBase {
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);
Thread.sleep(60000);
}
/**
......
......@@ -21,7 +21,6 @@ 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.BeforeClass;
import org.testng.annotations.Test;
import java.math.BigDecimal;
......@@ -30,7 +29,7 @@ import java.text.DecimalFormat;
import java.util.Map;
public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
public class 瓜分红包_实际瓜分_废弃 extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
......@@ -41,37 +40,17 @@ public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid1 = 5144;
private static Integer uid2 = 5145;
private static Integer uid3 = 5146;
private static Integer uid1 = 5088;
private static Integer uid2 = 5089;
private static Integer uid3 = 5090;
private static String betId;
private static String optionId1;
private static String optionId2;
//@BeforeClass
// public void beforeclass() {
// try {
// Map<String,Object> map = jdbc.findSimpleResult("SELECT * FROM credits_dev.operating_activity where type = 53 and app_id = 21829");
// String rel_id = String.valueOf(map.get("id"));
// Boolean result9 = jdbc.update("delete from act_com_conf.tb_red_account_period_rel where rel_id > ?",rel_id);
// } catch (Exception e){
// e.printStackTrace();
// }
// }
@Test
public void 创建PK活动() throws Exception{
logger.info("开始生成预算token");
Response response = pkDevelopService.temporaryCard("21829","2","5","10","2019-03-04T16:00:00.000Z","2029-03-22T16:00:00.000Z");
String token = response.jsonPath().getString("data.checkUuid");
logger.info("生成预算token为:"+token);
pkDevelopService.preSaveCheck("21829",token);
logger.info("预算确认成功!");
response = pkDevelopService.betEditor_red("21829",token,"1","2","0.01","0","10");
Response response = pkDevelopService.betEditor("21828","1","2",null,"1","30");
Assert.assertEquals(response.jsonPath().getString("desc"),"成功","创建组件化pk_分红包活动失败");
response = pkService.getBetList(uid1);
......@@ -110,14 +89,16 @@ public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
logger.info("用户2投注前积分:"+credits2);
logger.info("用户3投注前积分:"+credits3);
//扣去1积分
credits1 = String.valueOf(Integer.valueOf(credits1)-1);
credits2 = String.valueOf(Integer.valueOf(credits2)-1);
credits3 = String.valueOf(Integer.valueOf(credits3)-1);
Response res1 = pkService.doJoin(uid1,betId,optionId1);
Response res2 = pkService.doJoin(uid2,betId,optionId1);
Response res3 = pkService.doJoin(uid3,betId,optionId2);
Thread.sleep(5000);
//查询数据库,投注后积分(抽奖扣积分流程校验)
//查询数据库,投注前积分(抽奖扣积分流程校验)
mapuser1 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid1);
mapuser2 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid2);
mapuser3 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
......@@ -140,11 +121,11 @@ public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
@Test(dependsOnMethods = { "投注" })
public void 开奖() throws Exception {
//查询数据库,开奖前红包余额
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0830 where consumer_id = '100112190' and account_type = '6'\n");
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0788 where consumer_id = '100112148' and account_type = '6'\n");
String use1_Acc1 = user01_account1.get("balance_amount").toString();
Map<String,Object> user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0838 where consumer_id = '100112198' and account_type = '6'\n");
Map<String,Object> user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0824 where consumer_id = '100112184' and account_type = '6'\n");
String use2_Acc1 = user02_account1.get("balance_amount").toString();
Map<String,Object> user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0839 where consumer_id = '100112199' and account_type = '6'\n");
Map<String,Object> user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0825 where consumer_id = '100112185' and account_type = '6'\n");
String use3_Acc1 = user03_account1.get("balance_amount").toString();
......@@ -152,10 +133,10 @@ public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
logger.info("用户2开奖前红包余额:"+use2_Acc1);
logger.info("用户3开奖前红包余额:"+use3_Acc1);
//预期增加红包: 1
//预期增加红包: 750
DecimalFormat decimalFormat = new DecimalFormat("###################.###########");
use1_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use1_Acc1),1));
use2_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use2_Acc1),1));
use1_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use1_Acc1),750));
use2_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use2_Acc1),750));
//修改开奖时间
this.modifyOpenPrizeTime(betId,60);
......@@ -166,11 +147,11 @@ public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
Thread.sleep(8000);
//查询数据库,开奖后红包余额
user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0830 where consumer_id = '100112190' and account_type = '6'\n");
user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0788 where consumer_id = '100112148' and account_type = '6'\n");
String use1_Acc2 = user01_account1.get("balance_amount").toString();
user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0838 where consumer_id = '100112198' and account_type = '6'\n");
user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0824 where consumer_id = '100112184' and account_type = '6'\n");
String use2_Acc2 = user02_account1.get("balance_amount").toString();
user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0839 where consumer_id = '100112199' and account_type = '6'\n");
user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0825 where consumer_id = '100112185' and account_type = '6'\n");
String use3_Acc2 = user03_account1.get("balance_amount").toString();
logger.info("用户1开奖后积分:"+use1_Acc2);
......@@ -192,9 +173,9 @@ public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0830 where consumer_id = '100112190' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"1","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0839 where consumer_id = '100112199' and duiba_activity_id = ?\n",betId);
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0788 where consumer_id = '100112148' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"750","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0825 where consumer_id = '100112185' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
logger.info("用户01获取的积分值为:"+user01_order.get("add_credits").toString()+",用户03获取的积分值为:"+user02_order.get("add_credits").toString());
......@@ -212,11 +193,9 @@ public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
public void 出奖弹层校验() throws Exception {
Response response = pkService.popup(uid1);
response.prettyPrint();
// Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"1","中奖弹窗积分校验失败");
Assert.assertTrue(new BigDecimal(response.jsonPath().getString("data.prizeList[0].totalBonus")).compareTo(new BigDecimal("1"))==0,"中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"750","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"2","中奖弹窗类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.totalBonus"),"0.01","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.totalBonus"),"7.5","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败");
Response response2 = pkService.popup(uid3);
......@@ -227,15 +206,14 @@ public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
@Test(dependsOnMethods = { "出奖弹层校验" })
public void 战绩页校验() throws Exception {
Thread.sleep(10000);
Response response = pkService.list(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.list[0].userWin"),"true","中奖记录校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.id"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.shareExp"),"10","活动瓜分金额校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.shareExp"),"30","活动瓜分金额校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.configStatus"),"4","活动状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.creditsValue"),"0","活动消耗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.creditsValue"),"1.00","活动消耗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.betType"),"1","活动押注类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.bonusType"),"2","活动瓜分类型校验失败");
......@@ -243,19 +221,19 @@ public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].optionId"),optionId1,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].rank"),"1","活动投注结果校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"544","活动投注人数校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"66.9","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"4","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"66.7","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].optionId"),optionId2,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].rank"),"2","活动投注结果校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"269","活动投注人数校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"33.1","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"2","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"33.3","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId1,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.01","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"7.5","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"2","兑换状态校验失败");
response = pkService.list(uid3);
......@@ -273,19 +251,11 @@ public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
@AfterClass
public void afterclass() {
try {
// Map<String,Object> map = jdbc.findSimpleResult("SELECT * FROM act_com_conf.tb_red_account_period where app_id = 21829");
// String rel_id = String.valueOf(map.get("id"));
// Boolean result9 = jdbc.update("delete from act_com_conf.tb_red_account_period_rel where rel_id = ?",rel_id);
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id = ?",betId);
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id = ?",betId);
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",betId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",betId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",betId);
Boolean result6 = jdbc.update("delete from credits_dev.operating_activity where type = 53 and app_id = 21829");
Boolean result7 = jdbc.update("delete from act_com_conf.tb_red_account_period where app_id = 21829");
Boolean result8 = jdbc.update("delete from act_com_conf.tb_bet_act_group where app_id = 21829");
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
......@@ -306,7 +276,6 @@ public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
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);
Thread.sleep(60000);
}
/**
......
/**
* Copyright (C), 2015-2018
* FileName: 配置测试_AccessTest
* FileName: 配置测试
* Author: zhaoran
* Date: 2018/12/10 19:45
* Description:
......@@ -29,7 +29,7 @@ import java.util.Map;
import static io.restassured.RestAssured.given;
public class 配置测试_AccessTest extends DuibaTestBase {
public class 配置测试 extends DuibaTestBase {
@Value("${activity.host}")
String activityHost;
......
......@@ -38,7 +38,7 @@ import java.util.Map;
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_瓜分优惠券_AccessTest extends DuibaTestBase {
public class pk_瓜分优惠券 extends DuibaTestBase {
@Autowired
PkService pkService;
......
/**
* Copyright (C), 2015-2018
* FileName: pk_瓜分红包_首页中奖弹层测试_AccessTest
* FileName: pk_瓜分红包_首页中奖弹层测试
* Author: qianwenjun
* Date: 2018/12/22 12:38
* Description:
......
......@@ -39,7 +39,7 @@ import java.util.Map;
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_瓜分红包_投放两个app_AccessTest extends DuibaTestBase {
public class pk_瓜分红包_投放两个app extends DuibaTestBase {
@Autowired
PkService pkService;
......
......@@ -39,7 +39,7 @@ import java.util.Map;
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_瓜分红包_押注人数不同测试_AccessTest extends DuibaTestBase {
public class pk_瓜分红包_押注人数不同测试 extends DuibaTestBase {
@Autowired
PkService pkService;
......
......@@ -39,7 +39,7 @@ import java.util.Map;
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_瓜分红包_押注人数相同测试_AccessTest extends DuibaTestBase {
public class pk_瓜分红包_押注人数相同测试 extends DuibaTestBase {
@Autowired
PkService pkService;
......
/**
* Copyright (C), 2015-2018
* FileName: pk_瓜分红包_首页中奖弹层测试_AccessTest
* FileName: pk_瓜分红包_首页中奖弹层测试
* Author: qianwenjun
* Date: 2018/12/22 12:38
* Description:
......@@ -38,7 +38,7 @@ import static io.restassured.RestAssured.given;
* @create 2018/12/22
* @since 1.0.0
*/
public class pk_瓜分红包_首页中奖弹层测试_AccessTest extends DuibaTestBase {
public class pk_瓜分红包_首页中奖弹层测试 extends DuibaTestBase {
@Autowired
......
......@@ -17,7 +17,7 @@ import java.util.Map;
/**
* Created by zhaoran on 2018/6/8.
*/
public class 自有单品抽奖_AccessTest extends DuibaTestBase {
public class 自有单品抽奖 extends DuibaTestBase {
@Autowired
SingleLotteryService singleLotteryService;
private static DuibaLog logger = DuibaLog.getLogger();
......
......@@ -17,7 +17,7 @@ import java.util.Map;
/**
* Created by lvwenyan on 2019/4/4.
*/
public class 自有单品抽奖_新商品_AccessTest extends DuibaTestBase {
public class 自有单品抽奖_新商品 extends DuibaTestBase {
@Autowired
SingleLotteryService singleLotteryService;
......
......@@ -14,7 +14,7 @@ import java.util.Map;
/**
* Created by zhaoran on 2018/6/8.
*/
public class 自有库存不足_AccessTest extends DuibaTestBase {
public class 自有库存不足 extends DuibaTestBase {
@Autowired
SingleLotteryService singleLotteryService;
private static DuibaLog logger = DuibaLog.getLogger();
......
......@@ -13,7 +13,7 @@ import org.testng.annotations.Test;
import java.util.Map;
public class 权益一期线上用户核销中匹配兑换码兑换_DuibaTest extends CheckTemplet {
public class 权益一期线上用户核销中匹配兑换码兑换 extends CheckTemplet {
@Autowired
public equityPrizeService equityPrizeService;
@Autowired
......
......@@ -16,7 +16,7 @@ import java.util.List;
import java.util.Map;
public class 权益二期线上用户核销匹配权益及兑换码兑换_DuibaTest extends CheckTemplet {
public class 权益二期线上用户核销匹配权益及兑换码兑换 extends CheckTemplet {
@Autowired
public equityPrizeService equityPrizeService;
@Autowired
......
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