Commit 3f5b963f authored by panyuli's avatar panyuli

Merge branch 'master' into panyuli

# Conflicts:
#	src/test/java/http/cases/ExchangeTest/虚拟商品_兑换异常测试_ExchangeTest.java
parents a1215f12 cda1dcfc
......@@ -207,6 +207,12 @@
<version>2.9.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>5.0.0</version>
</dependency>
</dependencies>
<build>
......
......@@ -173,4 +173,6 @@ public class MysqlConnPool {
}
return list;
}
}
......@@ -62,7 +62,7 @@ public class TestListener implements ITestListener {
serviceDoctor();
}catch (SkipException e){
SFExpress.skip = context.getAllTestMethods().length;
throw e;
// throw e;
}
}
......
......@@ -34,6 +34,7 @@ public class 答题_创建答题活动_DuibaTest extends DuibaTestBase {
@Test
public void 创建答题活动() throws Exception{
logger.info("创建答题活动");
CustomHdToolVO customHdToolVO = new CustomHdToolVO();
customHdToolVO.setActId(null);
......
......@@ -507,7 +507,7 @@ public class ObjectExchange_ExchangeTest extends DuibaTestBase{
credits = String.valueOf(Integer.valueOf(credits) - 100);
//兑换详情页
Response response = mobileService.detail(authorization.dafuwengLogin(uid), "55");
Map<String, String> map = authorization.dafuwengLogin(uid);
//Map<String, String> map = authorization.dafuwengLogin(uid);
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "活动详情页请求异常");
//支付宝(1元)兑换
response = couponExchangeService.alipayExchange(uid,"55");
......@@ -544,6 +544,7 @@ public class ObjectExchange_ExchangeTest extends DuibaTestBase{
}
//查询数据库,获取当前积分
Thread.sleep(2000);
mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid);
String creditsNew = String.valueOf(mapuser.get("credits"));
logger.info("兑换后积分:" + creditsNew);
......
......@@ -44,6 +44,10 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
DevItemService devItemService;
@Autowired
ActivityService activityService;
private int uid = 4642;
private String appId = "21465";
private Map hdCookies;
private DuibaLog logger = DuibaLog.getLogger();
private String skinId=null;
......@@ -51,11 +55,12 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
@BeforeClass
public void beforeClass(){
try{
hdCookies = authorization.hdLoginCommonNew("13193354006");
Map map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_skin where skin_name = ?","mabo楼层皮肤ActiveGroup");
skinId = String.valueOf(map.get("id"));
map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_code WHERE floor_name= ?","maboActiveGroup");
floorId = String.valueOf(map.get("id"));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response = floorService.deleteFloor(authorization.ssoLogin(),floorId);
......@@ -387,11 +392,11 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740",skinId);
Response response = devSkinService.saveSkin(hdCookies,appId,skinId);
Thread.sleep(60000);
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -403,15 +408,15 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
String floorType = MatcherString.getString(jsonCfg.getList("").get(0).toString(),"floorType=(.*?),",1);
response = homeService.floor(authorization.dafuwengLogin(2753),floorType,dataType,"3",floorId);
response = homeService.floor(authorization.dafuwengLogin(uid),floorType,dataType,"3",floorId);
String s = response.asString();
JsonPath jsonPath=from(s.substring(s.indexOf("{"),s.length()-1));
List<Map> list = jsonPath.getList("list",Map.class);
// response = devItemService.appItems(authorization.hdLoginmabo(),"18740");
response = activityService.list2(authorization.hdLoginmabo(),"18740");
// response = devItemService.appItems(hdCookies,appId);
response = activityService.list2(hdCookies,appId);
response.prettyPrint();
List<Map> maplist = response.jsonPath().getList("data.list",Map.class);
int size = maplist.size();
......@@ -445,7 +450,7 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
......
......@@ -42,23 +42,28 @@ public class Banner_FloorTest extends DuibaTestBase {
private String floorId=null;
private DuibaLog logger = DuibaLog.getLogger();
private int uid = 4643;
private String appId = "21466";
private Map hdCookies;
@BeforeClass
public void beforeClass(){
try{
List<Map> list = devFloorBannerService.selectedList(authorization.hdLoginmabo(),"18740");
hdCookies = authorization.hdLoginCommonNew("13193354007");
List<Map> list = devFloorBannerService.selectedList(hdCookies,appId);
for(int i=0;i<list.size();i++){
Map map = list.get(i);
String bannerId = String.valueOf(map.get("bannerId"));
devFloorBannerService.delBanner(authorization.hdLoginmabo(),"18740",bannerId);
devFloorBannerService.delBanner(hdCookies,appId,bannerId);
}
Map map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_skin where skin_name = ?","mabo楼层皮肤banner");
skinId = String.valueOf(map.get("id"));
map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_code WHERE floor_name= ?","maboTest楼层banner");
floorId = String.valueOf(map.get("id"));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response = floorService.deleteFloor(authorization.ssoLogin(),floorId);
......@@ -154,21 +159,21 @@ public class Banner_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740",skinId);
Response response = devSkinService.saveSkin(hdCookies,appId,skinId);
response = devFloorBannerService.activityList(authorization.hdLoginmabo(),"18740","");
response = devFloorBannerService.activityList(hdCookies,appId,"");
response.prettyPrint();
JSONObject json = new JSONObject();
json.putAll(getByName(response.jsonPath().getList("data"),"【自动化】出奖虚拟商品"));
json.put("appId", 18740);
json.put("appId", appId);
json.put("new", false);
json.put("selected", false);
json.put("show", true);
devFloorBannerService.saveActivityBanner(authorization.hdLoginmabo(),json.toJSONString()).prettyPrint();
devFloorBannerService.saveActivityBanner(hdCookies,json.toJSONString()).prettyPrint();
Thread.sleep(60000);
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -180,7 +185,7 @@ public class Banner_FloorTest extends DuibaTestBase {
String floorType = MatcherString.getString(jsonCfg.getList("").get(0).toString(),"floorType=(.*?),",1);
response = homeService.floor(authorization.dafuwengLogin(2753),floorType,dataType,"3",floorId);
response = homeService.floor(authorization.dafuwengLogin(uid),floorType,dataType,"3",floorId);
String s = response.asString();
JsonPath jsonPath=from(s.substring(s.indexOf("{"),s.length()-1));
......@@ -201,7 +206,7 @@ public class Banner_FloorTest extends DuibaTestBase {
// Assert.assertEquals(link,"//activity.m.duibatest.com.cn/newtools/index?id=21344&dbnewopen&dpm=18740.5.231.3&dcm=202.21344.0.0","");
Assert.assertEquals(title,"【自动化】出奖虚拟商品","");
Assert.assertEquals(sourceType,"13","");
Assert.assertEquals(activityId,"21344","");
Assert.assertEquals(activityId,"36114","");
......@@ -212,18 +217,18 @@ public class Banner_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devFloorBannerService.itemList(authorization.hdLoginmabo(),"18740","");
Response response = devFloorBannerService.itemList(hdCookies,appId,"");
response.prettyPrint();
JSONObject json = new JSONObject();
json.putAll(getByName(response.jsonPath().getList("data"),"mabo自动化实物"));
json.put("appId", 18740);
json.put("appId", appId);
json.put("new", false);
json.put("selected", false);
json.put("show", true);
devFloorBannerService.saveItemBanner(authorization.hdLoginmabo(),json.toJSONString()).prettyPrint();
devFloorBannerService.saveItemBanner(hdCookies,json.toJSONString()).prettyPrint();
Thread.sleep(62000);
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -235,7 +240,7 @@ public class Banner_FloorTest extends DuibaTestBase {
String floorType = MatcherString.getString(jsonCfg.getList("").get(0).toString(),"floorType=(.*?),",1);
response = homeService.floor(authorization.dafuwengLogin(2753),floorType,dataType,"3",floorId);
response = homeService.floor(authorization.dafuwengLogin(uid),floorType,dataType,"3",floorId);
response.prettyPrint();
String s = response.asString();
......@@ -251,11 +256,11 @@ public class Banner_FloorTest extends DuibaTestBase {
String sourceType = String.valueOf(map.get("sourceType"));
Assert.assertEquals(image,"//yun.dui88.com/images/201805/7mwt22vdfu.jpg","");
Assert.assertEquals(image,"//yun.dui88.com/images/201811/tkuykkb8s2.jpg","");
// Assert.assertEquals(link,"//goods.m.duibatest.com.cn/mobile/appItemDetail?appItemId=163948&dbnewopen&dpm=18740.5.231.2&dcm=102.163948.0.0","");
Assert.assertEquals(title,"mabo自动化实物","");
Assert.assertEquals(sourceType,"0","");
Assert.assertEquals(appItemId,"163948","");
Assert.assertEquals(appItemId,"186478","");
......@@ -264,7 +269,7 @@ public class Banner_FloorTest extends DuibaTestBase {
public void D_banner自定义外链接() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
String appId = "18740";
// String appId = "18740";
String bannerImgNew = "";
String img = "//yun.dui88.com/images/201805/hdgasav66e.jpg";
String title = "banner上传自动化测试";
......@@ -278,10 +283,10 @@ public class Banner_FloorTest extends DuibaTestBase {
json.put("url",url);
devFloorBannerService.uploadBanner(authorization.hdLoginmabo(),json.toJSONString()).prettyPrint();
devFloorBannerService.uploadBanner(hdCookies,json.toJSONString()).prettyPrint();
Thread.sleep(60000);
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -293,7 +298,7 @@ public class Banner_FloorTest extends DuibaTestBase {
String floorType = MatcherString.getString(jsonCfg.getList("").get(0).toString(),"floorType=(.*?),",1);
Response response = homeService.floor(authorization.dafuwengLogin(2753),floorType,dataType,"3",floorId);
Response response = homeService.floor(authorization.dafuwengLogin(uid),floorType,dataType,"3",floorId);
String s = response.asString();
......@@ -330,15 +335,15 @@ public class Banner_FloorTest extends DuibaTestBase {
public void E_删除banner皮肤和楼层() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
List<Map> list = devFloorBannerService.selectedList(authorization.hdLoginmabo(),"18740");
List<Map> list = devFloorBannerService.selectedList(hdCookies,appId);
for(int i=0;i<list.size();i++){
Map map = list.get(i);
String bannerId = String.valueOf(map.get("bannerId"));
devFloorBannerService.delBanner(authorization.hdLoginmabo(),"18740",bannerId);
devFloorBannerService.delBanner(hdCookies,appId,bannerId);
}
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response.prettyPrint();
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response.prettyPrint();
......@@ -366,7 +371,7 @@ public class Banner_FloorTest extends DuibaTestBase {
//@Test
public void test1(){
Response response = homeService.index(2753);
Response response = homeService.index(uid);
String html = response.asString();
// System.out.println(html);
String find = "var CfG={(.*?)";
......
......@@ -47,14 +47,19 @@ public class Coupon_FloorTest extends DuibaTestBase {
private String floorId=null;
private DuibaLog logger = DuibaLog.getLogger();
private int uid = 4644;
private String appId = "21467";
private Map hdCookies;
@BeforeClass
public void beforeClass(){
try{
hdCookies = authorization.hdLoginCommonNew("13193354008");
Map map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_skin where skin_name = ?","mabo楼层皮肤conpon");
skinId = String.valueOf(map.get("id"));
map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_code WHERE floor_name= ?","maboConpon");
floorId = String.valueOf(map.get("id"));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response = floorService.deleteFloor(authorization.ssoLogin(),floorId);
......@@ -342,11 +347,11 @@ public class Coupon_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740",skinId);
Response response = devSkinService.saveSkin(hdCookies,appId,skinId);
int showNum = 5;
int showNum = 3;
JSONObject json = new JSONObject();
json.put("appId","18740");
json.put("appId",appId);
json.put("floorId",floorId);
json.put("floorTitle","优惠券");
json.put("showNum",String.valueOf(showNum));
......@@ -354,14 +359,14 @@ public class Coupon_FloorTest extends DuibaTestBase {
response = devFloorChildPageService.couponPageConfig(authorization.hdLoginmabo(),json.toJSONString());
response = devFloorChildPageService.couponPageConfig(hdCookies,json.toJSONString());
Thread.sleep(70000);
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -373,7 +378,7 @@ public class Coupon_FloorTest extends DuibaTestBase {
String floorType = MatcherString.getString(jsonCfg.getList("").get(0).toString(),"floorType=(.*?),",1);
response = homeService.floor(authorization.dafuwengLogin(2753),floorType,dataType,"3",floorId);
response = homeService.floor(authorization.dafuwengLogin(uid),floorType,dataType,"3",floorId);
String s = response.asString();
JsonPath jsonPath=from(s.substring(s.indexOf("{"),s.length()-1));
......@@ -393,7 +398,7 @@ public class Coupon_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response.prettyPrint();
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response.prettyPrint();
......
......@@ -42,14 +42,19 @@ public class Game_FloorTest extends DuibaTestBase {
private String floorId=null;
private DuibaLog logger = DuibaLog.getLogger();
private int uid = 4648;
private String appId = "21468";
private Map hdCookies;
@BeforeClass
public void beforeClass(){
try{
hdCookies = authorization.hdLoginCommonNew("13193354009");
Map map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_skin where skin_name = ?","mabo楼层皮肤Game");
skinId = String.valueOf(map.get("id"));
map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_code WHERE floor_name= ?","maboGame");
floorId = String.valueOf(map.get("id"));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response = floorService.deleteFloor(authorization.ssoLogin(),floorId);
......@@ -230,11 +235,11 @@ public class Game_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740",skinId);
Response response = devSkinService.saveSkin(hdCookies,appId,skinId);
Thread.sleep(60000);
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -246,7 +251,7 @@ public class Game_FloorTest extends DuibaTestBase {
String floorType = MatcherString.getString(jsonCfg.getList("").get(0).toString(),"floorType=(.*?),",1);
response = homeService.floor(authorization.dafuwengLogin(2753),floorType,dataType,"3",floorId);
response = homeService.floor(authorization.dafuwengLogin(uid),floorType,dataType,"3",floorId);
String s = response.asString();
response.prettyPrint();
......@@ -273,7 +278,7 @@ public class Game_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response.prettyPrint();
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response.prettyPrint();
......
......@@ -47,28 +47,33 @@ public class Icon_FloorTest extends DuibaTestBase {
private String skinId=null;
private String floorId=null;
private String bannerId = null;
private int uid = 4650;
private String appId = "21469";
private Map hdCookies;
@BeforeClass
public void beforeClass(){
try{
hdCookies = authorization.hdLoginCommonNew("13193354010");
Map map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_skin where skin_name = ?","mabo楼层皮肤icon");
skinId = String.valueOf(map.get("id"));
map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_code WHERE floor_name= ?","maboicon");
floorId = String.valueOf(map.get("id"));
Response response = devFloorIconService.selectedList(authorization.hdLoginmabo(),"18740");
Response response = devFloorIconService.selectedList(hdCookies,appId);
List<Map> list = response.jsonPath().getList("data",Map.class);
map = getByName(list,"今日必抢");
if(map!=null){
JSONObject json = new JSONObject();
json.put("appId","18740");
json.put("appId",appId);
json.put("bannerId",map.get("bannerId").toString());
response = devFloorIconService.delIcon(authorization.hdLoginmabo(),json.toJSONString());
response = devFloorIconService.delIcon(hdCookies,json.toJSONString());
}
response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
response = devSkinService.saveSkin(hdCookies,appId,"106");
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response = floorService.deleteFloor(authorization.ssoLogin(),floorId);
......@@ -223,10 +228,10 @@ public class Icon_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
//应用皮肤
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740",skinId);
Response response = devSkinService.saveSkin(hdCookies,appId,skinId);
JSONObject json = new JSONObject();
json.put("appId","18740");
json.put("appId",appId);
json.put("classifySwitch","false");
json.put("iconType","list");
json.put("img","//yun.dui88.com/duibaManagerWeb/dnb7ivbsjr.png");
......@@ -243,12 +248,12 @@ public class Icon_FloorTest extends DuibaTestBase {
json.put("payload","null");
response = devFloorIconService.saveIcon(authorization.hdLoginmabo(),json.toJSONString());
response = devFloorIconService.saveIcon(hdCookies,json.toJSONString());
response.prettyPrint();
Thread.sleep(70000);
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -261,7 +266,7 @@ public class Icon_FloorTest extends DuibaTestBase {
response = homeService.floor(authorization.dafuwengLogin(2753),floorType,dataType,"3",floorId);
response = homeService.floor(authorization.dafuwengLogin(uid),floorType,dataType,"3",floorId);
response.prettyPrint();
String s = response.asString();
JsonPath jsonPath=from(s.substring(s.indexOf("{"),s.length()-1));
......@@ -296,7 +301,7 @@ public class Icon_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devFloorIconService.selectedList(authorization.hdLoginmabo(),"18740");
Response response = devFloorIconService.selectedList(hdCookies,appId);
List<Map> list = response.jsonPath().getList("data",Map.class);
Map map = getByTitle(list,"今日必抢");
......@@ -306,7 +311,7 @@ public class Icon_FloorTest extends DuibaTestBase {
bannerId = map.get("bannerId").toString();
JSONObject json = new JSONObject();
json.put("appId","18740");
json.put("appId",appId);
json.put("bannerId",bannerId);
json.put("classifyImage","null");
json.put("classifySwitch","false");
......@@ -316,11 +321,11 @@ public class Icon_FloorTest extends DuibaTestBase {
json.put("sourceRelationId","2");
json.put("title","今日必抢1");
response = devFloorIconService.updateIcon(authorization.hdLoginmabo(),json.toJSONString());
response = devFloorIconService.updateIcon(hdCookies,json.toJSONString());
response.prettyPrint();
Thread.sleep(60000);
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -333,7 +338,7 @@ public class Icon_FloorTest extends DuibaTestBase {
response = homeService.floor(authorization.dafuwengLogin(2753),floorType,dataType,"3",floorId);
response = homeService.floor(authorization.dafuwengLogin(uid),floorType,dataType,"3",floorId);
response.prettyPrint();
String s = response.asString();
......@@ -353,13 +358,13 @@ public class Icon_FloorTest extends DuibaTestBase {
logger.info(df.format(new Date()));
JSONObject json = new JSONObject();
json.put("appId","18740");
json.put("appId",appId);
json.put("bannerId",bannerId);
Response response = devFloorIconService.delIcon(authorization.hdLoginmabo(),json.toJSONString());
Response response = devFloorIconService.delIcon(hdCookies,json.toJSONString());
response.prettyPrint();
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -389,7 +394,7 @@ public class Icon_FloorTest extends DuibaTestBase {
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response.prettyPrint();
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response.prettyPrint();
......
......@@ -47,15 +47,20 @@ public class Item_FloorTest extends DuibaTestBase {
private String skinId=null;
private String floorId=null;
private DuibaLog logger = DuibaLog.getLogger();
private int uid = 4658;
private String appId = "21470";
private Map hdCookies;
@BeforeClass
public void beforeClass(){
try{
hdCookies = authorization.hdLoginCommonNew("13193354011");
Map map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_skin where skin_name = ?","mabo楼层皮肤Item");
skinId = String.valueOf(map.get("id"));
map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_code WHERE floor_name= ?","maboItem");
floorId = String.valueOf(map.get("id"));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response = floorService.deleteFloor(authorization.ssoLogin(),floorId);
......@@ -362,11 +367,11 @@ public class Item_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740",skinId);
Response response = devSkinService.saveSkin(hdCookies,appId,skinId);
Thread.sleep(70000);
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -378,11 +383,11 @@ public class Item_FloorTest extends DuibaTestBase {
String floorType = MatcherString.getString(jsonCfg.getList("").get(0).toString(),"floorType=(.*?),",1);
response = homeService.floor(authorization.dafuwengLogin(2753),floorType,dataType,"3",floorId);
response = homeService.floor(authorization.dafuwengLogin(uid),floorType,dataType,"3",floorId);
String s = response.asString();
response = devFloorService.itemSelectedList("18740");
response = devFloorService.itemSelectedList(appId);
List<Map> listDev = response.jsonPath().getList("data",Map.class);
JsonPath jsonPath=from(s.substring(s.indexOf("{"),s.length()-1));
......@@ -405,7 +410,7 @@ public class Item_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response.prettyPrint();
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response.prettyPrint();
......
......@@ -43,14 +43,20 @@ public class Seckill_FloorTest extends DuibaTestBase {
private String floorId=null;
private DuibaLog logger = DuibaLog.getLogger();
private int uid = 4654;
private String appId = "21471";
private Map hdCookies;
@BeforeClass
public void beforeClass(){
try{
hdCookies = authorization.hdLoginCommonNew("13193354012");
Map map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_skin where skin_name = ?","mabo楼层皮肤Sckill");
skinId = String.valueOf(map.get("id"));
map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_code WHERE floor_name= ?","maboSckill");
floorId = String.valueOf(map.get("id"));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response = floorService.deleteFloor(authorization.ssoLogin(),floorId);
......@@ -805,11 +811,11 @@ public class Seckill_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740",skinId);
Response response = devSkinService.saveSkin(hdCookies,appId,skinId);
Thread.sleep(60000);
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -821,7 +827,7 @@ public class Seckill_FloorTest extends DuibaTestBase {
String floorType = MatcherString.getString(jsonCfg.getList("").get(0).toString(),"floorType=(.*?),",1);
response = homeService.floor(authorization.dafuwengLogin(2753),floorType,dataType,"3",floorId);
response = homeService.floor(authorization.dafuwengLogin(uid),floorType,dataType,"3",floorId);
String s = response.asString();
String source = s.substring(s.indexOf("{"),s.length()-1);
......@@ -837,9 +843,9 @@ public class Seckill_FloorTest extends DuibaTestBase {
url = getMatcher(url,source,1);
Assert.assertEquals(activityId,"820","");
Assert.assertEquals(image,"//yun.dui88.com/images/201801/7de9zo957y.png","");
Assert.assertEquals(operatingActivityId,"25550","");
Assert.assertEquals(operatingActivityId,"36116","");
Assert.assertTrue(url.contains("//activity.m.duibatest.com.cn/SecondsKillActivity/index?id=25550"));
Assert.assertTrue(url.contains("//activity.m.duibatest.com.cn/SecondsKillActivity/index?id=36116"));
}
......@@ -849,7 +855,7 @@ public class Seckill_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response.prettyPrint();
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response.prettyPrint();
......
......@@ -47,14 +47,19 @@ public class Showcase_FloorTest extends DuibaTestBase {
private String floorId=null;
private DuibaLog logger = DuibaLog.getLogger();
private int uid = 4634;
private String appId = "21464";
private Map hdCookies;
@BeforeClass
public void beforeClass(){
try{
hdCookies = authorization.hdLoginCommonNew("13193354005");
Map map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_skin where skin_name = ?","mabo楼层皮肤Showcase");
skinId = String.valueOf(map.get("id"));
map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_code WHERE floor_name= ?","maboShowcase");
floorId = String.valueOf(map.get("id"));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response = floorService.deleteFloor(authorization.ssoLogin(),floorId);
......@@ -244,11 +249,11 @@ public class Showcase_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740",skinId);
Response response = devSkinService.saveSkin(hdCookies,appId,skinId);
Thread.sleep(60000);
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -260,14 +265,14 @@ public class Showcase_FloorTest extends DuibaTestBase {
String floorType = MatcherString.getString(jsonCfg.getList("").get(0).toString(),"floorType=(.*?),",1);
response = homeService.floor(authorization.dafuwengLogin(2753),floorType,dataType,"3",floorId);
response = homeService.floor(authorization.dafuwengLogin(uid),floorType,dataType,"3",floorId);
String s = response.asString();
JsonPath jsonPath=from(s.substring(s.indexOf("{"),s.length()-1));
List<Map> list = jsonPath.getList("list",Map.class);
response = devFloorShowcaseService.getShowcaseContent(authorization.hdLoginmabo(),"18740");
response = devFloorShowcaseService.getShowcaseContent(hdCookies,appId);
List<Map> listDev = response.jsonPath().getList("data",Map.class);
//开发者配置和手机端配置校验
......@@ -290,7 +295,7 @@ public class Showcase_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response.prettyPrint();
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response.prettyPrint();
......
......@@ -43,16 +43,21 @@ public class Sign_FloorTest extends DuibaTestBase {
private String floorId=null;
private DuibaLog logger = DuibaLog.getLogger();
private int uid = 4572;
private String appId = "21446";
private Map hdCookies;
@BeforeClass
public void beforeClass(){
try{
hdCookies = authorization.hdLoginCommonNew("13193354004");//authorization.hdLoginmabo();
Map map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_skin where skin_name = ?","mabo楼层皮肤Sign");
skinId = String.valueOf(map.get("id"));
map = jdbc.findSimpleResult("select * from credits_dev.tb_credits_floor_code WHERE floor_name= ?","maboSign");
floorId = String.valueOf(map.get("id"));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response = floorService.deleteFloor(authorization.ssoLogin(),floorId);
......@@ -510,11 +515,11 @@ public class Sign_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740",skinId);
Response response = devSkinService.saveSkin(hdCookies,appId,skinId);
Thread.sleep(60000);
JsonPath jsonCfg = homeService.getCFG(2753);
JsonPath jsonCfg = homeService.getCFG(uid);
Assert.assertEquals(jsonCfg.getList("").size(),1,"banner展示数量和配置不符");
......@@ -526,7 +531,7 @@ public class Sign_FloorTest extends DuibaTestBase {
String floorType = MatcherString.getString(jsonCfg.getList("").get(0).toString(),"floorType=(.*?),",1);
response = homeService.floor(authorization.dafuwengLogin(2753),floorType,dataType,"3",floorId);
response = homeService.floor(authorization.dafuwengLogin(uid),floorType,dataType,"3",floorId);
String s = response.asString();
......@@ -546,7 +551,7 @@ public class Sign_FloorTest extends DuibaTestBase {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
Response response = devSkinService.saveSkin(authorization.hdLoginmabo(),"18740","198");
Response response = devSkinService.saveSkin(hdCookies,appId,"106");
response.prettyPrint();
response = floorService.deleteSkin(authorization.ssoLogin(),skinId,"1");
response.prettyPrint();
......
......@@ -61,7 +61,7 @@ public class 游戏_中奖异常流程测试_AccessTest extends DuibaTestBase {
try {
Map<String,Object> ngameOptionResult = jdbc.findSimpleResult("select * from ngame.ngame_stock where game_option_id = (select id from ngame.duiba_ngame_options where duiba_game_id = ? and deleted = 0)\n","1335");
Map<String,Object> itemStockResult = jdbc.findSimpleResult("select * from stock.tb_stock where stock_id in (select stock_id from goods.item where id = ?","27235");
Map<String,Object> itemStockResult = jdbc.findSimpleResult("select * from stock.tb_stock where stock_id = (select stock_id from goods.item where id = ?)","27235");
Long optionStock = Long.parseLong(ngameOptionResult.get("stock").toString());
Long itemStock = Long.parseLong(itemStockResult.get("stock").toString());
logger.info("奖项原库存值为"+optionStock+"商品原库存为"+itemStock);
......
......@@ -92,9 +92,11 @@ public class 游戏_获取游戏信息测试_AccessTest extends DuibaTestBase {
response.prettyPrint();
Assert.assertEquals(MatcherString.getString(response.asString(),"\"success\": (.*?),",1),"true","校验预览结果失败");
String url = MatcherString.getString(response.asString(),"\"url\": \"(.*?)\"",1);
Assert.assertTrue(url.contains("http://activity.m.duibatest.com.cn/autoLogin/autologin?appKey=jlg88lyxz7siqtmr&uid=duiba-preview-user"),"校验获取的链接失败");
logger.info("url的信息为" +url);
Assert.assertTrue(url.contains("https://activity.m.duibatest.com.cn/autoLogin/autologin?appKey=jlg88lyxz7siqtmr&uid=duiba-preview-user"),"校验获取的链接失败");
String[] redirect = url.split("redirect=");
// logger.info("redirect的信息为" +redirect[1]);
logger.info("redirect的信息为" +redirect[1]);
Assert.assertTrue(String.valueOf(redirect[1]).contains("id%3D1338"),"校验重定向的活动id失败");
}
......
......@@ -25,7 +25,7 @@ import java.util.Map;
/**
* Created by zhaoran on 2018/07/10
*/
public class 中奖发奖限制_DuibaTest extends DuibaTestBase {
public class 中奖发奖限制 extends DuibaTestBase {
@Autowired
NewActivityService newActivityService;
......@@ -57,10 +57,10 @@ public class 中奖发奖限制_DuibaTest extends DuibaTestBase {
public void after() throws Exception{
//数据库删除
try {
jdbc.update("delete from hdtool_conf.duiba_hdtool where title=?", "【自动化】多奖项中奖限制"+data);
jdbc.update("delete from credits_dev.operating_activity where title=?","【自动化】多奖项中奖限制"+data);
jdbc.update("delete from hdtool_conf.duiba_hdtool where title=?", "【自动化】奖品发放限制"+data2);
jdbc.update("delete from credits_dev.operating_activity where title=?","【自动化】奖品发放限制"+data2);
jdbc.update("delete from hdtool_conf.duiba_hdtool where title=?", "【自动化】多奖项中奖限制_DuibaTest"+data);
jdbc.update("delete from credits_dev.operating_activity where title=?","【自动化】多奖项中奖限制_DuibaTest"+data);
jdbc.update("delete from hdtool_conf.duiba_hdtool where title=?", "【自动化】奖品发放限制_DuibaTest"+data2);
jdbc.update("delete from credits_dev.operating_activity where title=?","【自动化】奖品发放限制_DuibaTest"+data2);
} catch (Exception e) {
System.out.println(e);
}
......@@ -147,7 +147,7 @@ public class 中奖发奖限制_DuibaTest extends DuibaTestBase {
@Test
public void 多奖项中奖限制测试() throws Exception {
data = PublicMethod.data();
String title = "【自动化】多奖项中奖限制"+data;
String title = "【自动化】多奖项中奖限制_DuibaTest"+data;
this.创建并上架活动(title);
......@@ -182,7 +182,7 @@ public class 中奖发奖限制_DuibaTest extends DuibaTestBase {
@Test
public void 奖品发放限制测试() throws Exception {
data2 = PublicMethod.data();
String title = "【自动化】奖品发放限制"+data2;
String title = "【自动化】奖品发放限制_DuibaTest"+data2;
this.创建并上架活动2(title);
//获取管理员后台活动信息
......
package http.cases.NewActivityTest;
import com.alibaba.fastjson.JSON;
import base.DuibaTestBase;
import utils.PublicMethod;
import http.enums.ActivityDataTypeEnum;
import http.model.AwardVO;
import http.model.CustomHdToolVO;
import http.service.Activity.ManagerService;
import http.service.Activity.NewActivityService;
import http.service.hd.ActivityService;
import http.service.hd.CustomHdToolCtrlService;
import http.service.hd.DeveloperService;
import base.DuibaLog;
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.RedisUtil;
import java.util.ArrayList;
import java.util.List;
/**
* Created by zhaoran on 2018/07/10
*/
public class 多奖项中奖限制 extends DuibaTestBase {
public class 多奖项中奖限制_DuibaTest extends DuibaTestBase {
@Autowired
NewActivityService newActivityService;
......@@ -37,111 +30,50 @@ public class 多奖项中奖限制 extends DuibaTestBase {
@Autowired
ActivityService activityService;
private static DuibaLog logger = DuibaLog.getLogger();
//指定用户
private static int uid = 2720;
//兑吧活动id
private static String actId ;
//活动入库id
private static String id ;
private static String data;
@AfterClass
public void after() throws Exception{
//数据库删除
try {
jdbc.update("delete from duiba_hdtool where title=?", "【自动化】多奖项中奖限制"+data);
jdbc.update("delete from credits_dev.operating_activity where title=?","【自动化】多奖项中奖限制"+data);
//case:[多奖项中奖限制测试_永久]数据处理:删除永久中奖记录
jdbc.update("UPDATE ckvtable.tb_kvtable_0687 SET int_value = '0' WHERE vkey = 'activity-centerwinOptionNum_100025007_35869_hdtool25885'");
//case:[多奖项中奖限制测试_每日]数据处理:删除每日中奖记录
RedisUtil.clearKey("PRIZE_K004_35934_100025007");
} catch (Exception e) {
System.out.println(e);
}
}
public void 创建并上架活动(String title) throws Exception {
//管理后台创建活动并开启
logger.info("创建多奖项中奖限制活动");
CustomHdToolVO customHdToolVO = new CustomHdToolVO();
customHdToolVO.setActId(null);
customHdToolVO.setTitle(title);
customHdToolVO.setFacePrice("0.01");
customHdToolVO.setBrickId(167L);
customHdToolVO.setFactoryKey(ActivityDataTypeEnum.HDTOOL.getKey());
customHdToolVO.setOpenMutliPrizeLimit(true);
AwardVO awardVO1 = AwardVO.谢谢参与();
AwardVO awardVO2 = AwardVO.幸运福袋();
AwardVO awardVO3 = AwardVO.话费充值(1,"多档位话费充值","话费","100","1",true,null);
List<AwardVO> list = new ArrayList<AwardVO>();
list.add(awardVO1);
list.add(awardVO2);
list.add(awardVO3);
String awards = JSON.toJSONString(list);
//logger.info("设置的奖品信息:"+awards);
customHdToolVO.setAwards(awards);
customHdToolVO.setRule("多奖项中奖限制活动");
Response response = customHdToolCtrlService.saveOrEdit(customHdToolVO);
Assert.assertTrue(response.jsonPath().getBoolean("success"));
actId = response.jsonPath().getString("data.actId");
logger.info("多奖项中奖限制兑吧活动id为:"+actId);
managerService.switchSpecifyAndBlack("1",actId);
//定向开发者
managerService.saveSpecify(actId,"2239");
//开发者上架活动
Response HdResponse = developerService.joinIn(actId,"12");
logger.info("创建活动并上架成功");
}
@Test
public void 多奖项中奖限制测试() throws Exception {
data = PublicMethod.data();
String title = "【自动化】多奖项中奖限制"+data;
this.创建并上架活动(title);
//获取管理员后台活动信息
Response ManagerResponse = managerService.edit(actId);
//获取奖品剩余库存
String appItemId = String.valueOf(ManagerResponse.jsonPath().getString("data.awards[2].appItemId"));
logger.info("预设必中奖品类型为:"+ManagerResponse.jsonPath().getString("data.awards[2].type"));
logger.info("预设中奖几率为:"+ManagerResponse.jsonPath().getString("data.awards[2].probability")+"%");
logger.info("预设中奖每人限制:"+ManagerResponse.jsonPath().getString("data.awards[2].limit")+"次");
logger.info("预设剩余奖品数:"+ManagerResponse.jsonPath().getString("data.awards[2].remaind")+"个");
//获取入库id
ManagerResponse = developerService.list2(title);
id = ManagerResponse.jsonPath().getString("data.list[0].id");
public void 多奖项中奖限制测试_永久() throws Exception {
//第一次抽奖
Response response = this.新活动工具接口传参(id,"adsdas","iOS");
Response response = this.新活动工具接口传参("35869","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"phonebill","第一次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.title")),"话费","第一次抽奖出奖title失败");
//第二次抽奖
response = this.新活动工具接口传参(id,"adsdas","iOS");
// if(activityService.isRunning("10.110.10.12","17791","tuia-engine")){
//logger.info("tuia-engine服务启动成功");
response = this.新活动工具接口传参("35869","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"lucky","第二次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.useBtnText")),"马上使用","第二次抽奖出奖文案失败");
// }else{
// logger.info("tuia-engine服务启动未成功,福袋降级成谢谢参与!");
// Assert.assertEquals(response.jsonPath().getString("lottery.type"), "thanks", "校验类型失败");
// }
this.删除活动();
}
@Test
public void 多奖项中奖限制测试_每日() throws Exception {
//第一次抽奖
Response response = this.新活动工具接口传参("35934","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"phonebill","第一次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.title")),"话费","第一次抽奖出奖title失败");
//第二次抽奖
response = this.新活动工具接口传参("35934","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"lucky","第二次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.useBtnText")),"马上使用","第二次抽奖出奖文案失败");
public void 删除活动() throws Exception{
//管理后台删除活动
managerService.delet(actId);
logger.info("管理后台删除活动成功!");
//开发者删除活动
developerService.delActivity(id);
logger.info("开发者后台删除活动成功!");
}
public Response 新活动工具接口传参(String activityId,String token,String device) throws Exception {
......
package http.cases.NewActivityTest;
import com.alibaba.fastjson.JSON;
import base.DuibaTestBase;
import utils.PublicMethod;
import http.enums.ActivityDataTypeEnum;
import http.model.AwardVO;
import http.model.CustomHdToolVO;
import http.service.Activity.ManagerService;
import http.service.Activity.NewActivityService;
import http.service.hd.ActivityService;
......@@ -17,14 +12,17 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import utils.HbaseService;
import java.util.ArrayList;
import java.util.List;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
/**
* Created by zhaoran on 2018/07/10
*/
public class 奖品发放限制 extends DuibaTestBase {
public class 奖品发放限制_DuibaTest extends DuibaTestBase {
@Autowired
NewActivityService newActivityService;
......@@ -36,113 +34,57 @@ public class 奖品发放限制 extends DuibaTestBase {
CustomHdToolCtrlService customHdToolCtrlService;
@Autowired
ActivityService activityService;
@Autowired
HbaseService hbaseService;
private static DuibaLog logger = DuibaLog.getLogger();
//指定用户
private static int uid = 2720;
//兑吧活动id
private static String actId ;
//活动入库id
private static String id ;
private static String data;
@AfterClass
public void after() throws Exception{
//数据库删除
try {
jdbc.update("delete from duiba_hdtool where title=?", "【自动化】奖品发放限制"+data);
jdbc.update("delete from credits_dev.operating_activity where title=?","【自动化】奖品发放限制"+data);
//case:[奖品发放限制测试_永久]数据处理:删除永久中奖记录
jdbc.update("UPDATE ckvtable.tb_kvtable_0687 SET int_value = '0' WHERE vkey = 'activity-centerwinOptionNum_100025007_35868_hdtool25884'");
//case:[奖品发放限制测试_每日]数据处理:删除每日中奖记录
String y_m_d = getTime2(0);
String key = "k05_PRIZE_K001_"+y_m_d+"_hdtool25933_100025007";
hbaseService.deleteHBASEKey2(key);
} catch (Exception e) {
System.out.println(e);
}
}
public void 创建并上架活动(String title) throws Exception {
//管理后台创建活动并开启
logger.info("创建奖品发放限制活动");
CustomHdToolVO customHdToolVO = new CustomHdToolVO();
customHdToolVO.setActId(null);
customHdToolVO.setTitle(title);
customHdToolVO.setFacePrice("0.01");
customHdToolVO.setBrickId(167L);
customHdToolVO.setFactoryKey(ActivityDataTypeEnum.HDTOOL.getKey());
//奖品发放限制设置
customHdToolVO.setOpenPrizesGrantLimit(true);
customHdToolVO.setPrizesGrantLimitDays(1);
AwardVO awardVO1 = AwardVO.谢谢参与();
AwardVO awardVO2 = AwardVO.幸运福袋();
AwardVO awardVO3 = AwardVO.话费充值(1,"多档位话费充值","话费","100","1",false,1);
List<AwardVO> list = new ArrayList<AwardVO>();
list.add(awardVO1);
list.add(awardVO2);
list.add(awardVO3);
String awards = JSON.toJSONString(list);
//logger.info("设置的奖品信息:"+awards);
customHdToolVO.setAwards(awards);
customHdToolVO.setRule("奖品发放限制为1");
Response response = customHdToolCtrlService.saveOrEdit(customHdToolVO);
Assert.assertTrue(response.jsonPath().getBoolean("success"));
actId = response.jsonPath().getString("data.actId");
logger.info("多奖项中奖限制兑吧活动id为:"+actId);
managerService.switchSpecifyAndBlack("1",actId);
//定向开发者
managerService.saveSpecify(actId,"2239");
//开发者上架活动
Response HdResponse = developerService.joinIn(actId,"12");
logger.info("创建活动并上架成功");
}
@Test
public void 奖品发放限制测试() throws Exception {
data = PublicMethod.data();
String title = "【自动化】奖品发放限制"+data;
this.创建并上架活动(title);
//获取管理员后台活动信息
Response ManagerResponse = managerService.edit(actId);
//获取奖品剩余库存
String appItemId = String.valueOf(ManagerResponse.jsonPath().getString("data.awards[2].appItemId"));
logger.info("预设必中奖品类型为:"+ManagerResponse.jsonPath().getString("data.awards[2].type"));
logger.info("预设中奖几率为:"+ManagerResponse.jsonPath().getString("data.awards[2].probability")+"%");
logger.info("预设中奖每人限制:"+ManagerResponse.jsonPath().getString("data.awards[2].limit")+"次");
logger.info("预设剩余奖品数:"+ManagerResponse.jsonPath().getString("data.awards[2].remaind")+"个");
//获取入库id
ManagerResponse = developerService.list2(title);
id = ManagerResponse.jsonPath().getString("data.list[0].id");
public void 奖品发放限制测试_永久() throws Exception {
//第一次抽奖
Response response = this.新活动工具接口传参(id,"adsdas","iOS");
Response response = this.新活动工具接口传参("35868","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"phonebill","第一次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.title")),"话费","第一次抽奖出奖title失败");
//第二次抽奖
response = this.新活动工具接口传参(id,"adsdas","iOS");
if(String.valueOf(response.jsonPath().getString("lottery.type")).equals("lucky")){
logger.info("tuia-engine服务启动成功");
response = this.新活动工具接口传参("35868","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"lucky","第一次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.useBtnText")),"马上使用","第一次抽奖出奖文案失败");
}else{
logger.info("tuia-engine服务启动未成功,福袋降级成谢谢参与!");
Assert.assertEquals(response.jsonPath().getString("lottery.type"), "thanks", "校验类型失败");
}
this.删除活动();
}
@Test
public void 奖品发放限制测试_每日() throws Exception {
//第一次抽奖
Response response = this.新活动工具接口传参("35920","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"phonebill","第一次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.title")),"话费","第一次抽奖出奖title失败");
//第二次抽奖
response = this.新活动工具接口传参("35920","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"lucky","第一次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.useBtnText")),"马上使用","第一次抽奖出奖文案失败");
public void 删除活动() throws Exception{
//管理后台删除活动
managerService.delet(actId);
logger.info("管理后台删除活动成功!");
//开发者删除活动
developerService.delActivity(id);
logger.info("开发者后台删除活动成功!");
}
public Response 新活动工具接口传参(String activityId,String token,String device) throws Exception {
......@@ -164,4 +106,16 @@ public class 奖品发放限制 extends DuibaTestBase {
return response;
}
public String getTime2(int amount){
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd", Locale.ENGLISH);
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, amount);
date = calendar.getTime();
// System.out.println(dateFormat.format(date));
String time = dateFormat.format(date);
// System.out.println(time);
return time;
}
}
\ No newline at end of file
......@@ -188,9 +188,9 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
logger.info("-------------------------------------"+data.get("casename")+"-------------------------------------");
//获取管理员后台活动信息
Response ManagerResponse = managerService.edit(data.get("actId"));
Response ManagerResponse = managerService.getDataEditConfig(data.get("actId"));
//获取奖品剩余库存
String appItemId = String.valueOf(ManagerResponse.jsonPath().getString("data.awards[1].appItemId"));
String appItemId = String.valueOf(ManagerResponse.jsonPath().getString("awards[1].appItemId"));
String Objremaind = this.getremind(appItemId);
logger.info("预设必中奖品类型为:"+ManagerResponse.jsonPath().getString("data.awards[1].type"));
logger.info("预设中奖几率为:"+ManagerResponse.jsonPath().getString("data.awards[1].probability")+"%");
......@@ -198,7 +198,7 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
logger.info("预设剩余奖品数:"+ManagerResponse.jsonPath().getString("data.awards[1].remaind")+"个");
logger.info("预设奖品库存:"+Objremaind+"个");
if (Objremaind.equals("0")){
Assert.assertEquals(ManagerResponse.jsonPath().getString("data.awards[1].valid"),"false","校验奖品是否有效失败");
Assert.assertEquals(ManagerResponse.jsonPath().getString("awards[1].valid"),"false","校验奖品是否有效失败");
}
//进行接口测试传参
......
......@@ -11,9 +11,12 @@ import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.model.BetMngVo;
import http.model.PkGroupVo;
import http.service.Manager.PkActivityService;
import io.restassured.response.Response;
import org.omg.PortableServer.LIFESPAN_POLICY_ID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
......@@ -21,7 +24,9 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import utils.MatcherString;
import javax.swing.*;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -119,6 +124,61 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
}
@Test
public void 创建pk活动组_无投放渠道(){
try {
Response beforeGroupList = pkActivityService.getBetGroupList();
List<PkGroupVo> bforeList = beforeGroupList.jsonPath().getList("data.page",PkGroupVo.class);
this.createPkGroup("1");
Response groupList = pkActivityService.getBetGroupList();
groupList.prettyPrint();
List<PkGroupVo> list = groupList.jsonPath().getList("data.page",PkGroupVo.class);
Assert.assertEquals(bforeList.size()+1,list.size(),"新增长度校验失败");
logger.info("活动组列表数据为:"+ JSONObject.toJSONString(list));
for (PkGroupVo pkGroup:list){
if (pkGroup.getTitle().equals("【勿动】新增pk组")){
Assert.assertEquals(pkGroup.getAttributionType(),"1","attributionType值校验失败");
}
}
Map<String,Object> res = jdbc.findSimpleResult("select * from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组')\n");
logger.info("groupRelation表的数据为:"+JSONObject.toJSONString(res));
Assert.assertEquals(res.get("ad_position").toString(),"","投放渠道校验失败");
Assert.assertEquals(res.get("ad_switch").toString(),"0","投放开关校验失败");
}catch (Exception e){
e.printStackTrace();
}
}
@Test
public void 创建pk活动组_有投放渠道(){
try {
Response beforeGroupList = pkActivityService.getBetGroupList();
List<PkGroupVo> bforeList = beforeGroupList.jsonPath().getList("data.page",PkGroupVo.class);
this.createPkGroup("2");
Response groupList = pkActivityService.getBetGroupList();
groupList.prettyPrint();
List<PkGroupVo> list = groupList.jsonPath().getList("data.page",PkGroupVo.class);
Assert.assertEquals(bforeList.size()+1,list.size(),"新增长度校验失败");
logger.info("活动组列表数据为:"+ JSONObject.toJSONString(list));
for (PkGroupVo pkGroup:list){
if (pkGroup.getTitle().equals("【勿动】增pk组投放")){
Assert.assertEquals(pkGroup.getAttributionType(),"1","attributionType值校验失败");
}
}
Map<String,Object> res = jdbc.findSimpleResult("select * from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放')\n");
logger.info("groupRelation表的数据为:"+JSONObject.toJSONString(res));
Assert.assertEquals(res.get("ad_positions").toString(),"1","投放渠道校验失败");
Assert.assertEquals(res.get("ad_switch").toString(),"1","投放开关校验失败");
}catch (Exception e){
e.printStackTrace();
}
}
public void createPk(String bounsType) throws Exception {
......@@ -130,12 +190,36 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
Response modifyStatusResponse = pkActivityService.modifySatus(betId);
}
public void createPkGroup(String groupType) throws Exception{
//type=1,无投放渠道;type=2,有投放渠道
if (groupType.equals("1")){
Response betGroupResponse = pkActivityService.betActGroup("【勿动】新增pk组");
String betId = MatcherString.getString(betGroupResponse.asString(),"\"data\": (\\w*)",1);
logger.info("betId的信息为"+betId);
Response betGroupRelationResponse = pkActivityService.appGroupRelation("","false","1",betId);
}else if (groupType.equals("2")){
Response betGroupResponse = pkActivityService.betActGroup("【勿动】增pk组投放");
String betId = MatcherString.getString(betGroupResponse.asString(),"\"data\": (\\w*)",1);
logger.info("betId的信息为"+betId);
Response betGroupRelationResponse = pkActivityService.appGroupRelation("1","true","1",betId);
}
}
@AfterClass
public void tearDown() {
try {
Boolean result = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\")\n");
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\"\n");
Boolean result2 = jdbc.update("delete from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组')");
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组'");
Boolean result4 = jdbc.update("delete from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放')");
Boolean result5 = jdbc.update("delete from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放'");
} catch (SQLException e) {
e.printStackTrace();
}
......
package http.cases.SaasDeveloperTest;
import base.Config;
import utils.PublicMethod;
import http.service.Saas.DeveloperVirtualService;
import http.service.Saas.SpglczService;
import base.DuibaLog;
import io.restassured.response.Response;
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;
/**
* Created by humengxin on 2018/11/08.
*/
@ContextConfiguration(classes = Config.class)
public class 商品管理操作_DuibaTest extends AbstractTestNGSpringContextTests {
@Autowired
SpglczService czService;
@Autowired
DeveloperVirtualService developerVirtualService;
private static DuibaLog logger = DuibaLog.getLogger();
@Test(description = "批量上架")
public void a_批量上架() throws Exception {
String data=PublicMethod.data();
//先添加2个商品
developerVirtualService.doUpdateVirtual("【自动化】加钱购自有虚拟商品"+data,"标识符100=10+1");
developerVirtualService.doUpdateVirtual("【自动化】加钱购自有虚拟商品"+data,"标识符100=10+1");
//查询实物商品集合
Response response= czService.appItems();
// 获取到上架商品id
String ids = response.jsonPath().getString("data.list[0].id");
String ids2 = response.jsonPath().getString("data.list[1].id");
czService.batchStandUpOrDown(ids,ids2);
//刷新查询商品集合
Response response2= czService.appItems();
//查看商品列表确认是否上架成功
Assert.assertEquals(response2.jsonPath().getString("data.list[0].statusText"),"上架", "校验商品上架失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[1].statusText"),"上架", "校验商品上架失败");
logger.info("校验商品上架成功");
}
@Test(description = "批量复制")
public void b_批量复制() throws Exception {
String data = PublicMethod.data();
//查询实物商品集合
Response response= czService.appItems();
// 获取到上架商品id
String ids = response.jsonPath().getString("data.list[0].id");
String ids2 = response.jsonPath().getString("data.list[1].id");
//复制到另一个app
czService.batchCopy(ids,ids2);
//查看另一个app下是否存在该商品
Response response2=czService.appItems2();
Assert.assertEquals(response2.jsonPath().getString("data.list[0].itemType"), "直充", "校验商品类型失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[0].belong"), "自有", "校验商品belong失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[1].itemType"), "直充", "校验商品类型失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[1].belong"), "自有", "校验商品belong失败");
logger.info("校验title,belong成功");
// 查看完存在后,再删除复制的app数据
String ids3 = response2.jsonPath().getString("data.list[0].id");
logger.info(ids3);
String ids4 = response2.jsonPath().getString("data.list[1].id");
logger.info(ids4);
//先删除20979 app数据
czService.doBatchDel2(ids3,ids4);
}
@Test(description = "批量复制-兑吧定向商品")
public void c_批量复制兑吧定向商品() throws Exception {
String data = PublicMethod.data();
//查询实物商品集合
Response response= czService.appItems3();
// 获取到兑吧定向商品id
String ids = response.jsonPath().getString("data.list[0].id");
String ids2 = response.jsonPath().getString("data.list[1].id");
//复制到另一个app
Response response2= czService.batchCopy(ids,ids2);
//提示兑吧商品不支持复制
Assert.assertEquals(response2.jsonPath().getString("data.errorList[0].message"), "定向商品不支持复制", "校验异常场景失败");
Assert.assertEquals(response2.jsonPath().getString("data.errorList[0].title"), "【SaaS-自动化测试】实物勿动", "校验title失败");
logger.info("校验message,title成功");
}
@Test(description = "批量删除")
public void d_批量删除() throws Exception {
String data = PublicMethod.data();
//查询实物商品集合
Response response= czService.appItems();
// 获取到上架商品id
String ids = response.jsonPath().getString("data.list[0].id");
String ids2 = response.jsonPath().getString("data.list[1].id");
//先删除19515 app数据
czService.doBatchDel(ids,ids2);
}
@Test(description = "添加商品分组并把2个商品加入分组")
public void e_添加分组() throws Exception {
String data=PublicMethod.data();
//添加商品分组
czService.editClassify();
// 查询商品分组是否添加成功
czService.classify();
//先添加2个商品,加入到商品分组中
developerVirtualService.doUpdateVirtual("【自动化】加钱购自有虚拟商品"+data,"标识符100=10+1");
developerVirtualService.doUpdateVirtual("【自动化】加钱购自有虚拟商品"+data,"标识符100=10+1");
//查询实物商品集合
Response response= czService.appItems();
// 获取到上架商品id
String s1 = response.jsonPath().getString("data.list[0].id");
String s2 = response.jsonPath().getString("data.list[1].id");
Response response2= czService.classify();
String classifyId = response2.jsonPath().getString("data.list[0].id");
czService.saveToClassify(classifyId,s1,s2);
//查询商品分组集合,确认2个商品是否添加到分组中
Response response3=czService.classify();
//查看商品列表确认是否上架成功
Assert.assertEquals(response3.jsonPath().getString("data.list[0].appItemNum"),"2", "校验商品加入分组成功");
Assert.assertEquals(response3.jsonPath().getString("data.list[0].name"),"【自动化】商品分组1", "校验商品分组名称失败");
logger.info("校验商品分组成功");
}
@Test(description = "移除分组")
public void f_移除分组() throws Exception {
String data=PublicMethod.data();
Response response=czService.classify();
String classifyId = response.jsonPath().getString("data.list[0].id");
Response response2=czService.appItems4(classifyId);
String appItemId=response2.jsonPath().getString("data.list[0].id");
String appItemId2=response2.jsonPath().getString("data.list[1].id");
//移除分组
czService.removeClassifyAppItem(appItemId,classifyId);
czService.removeClassifyAppItem(appItemId2,classifyId);
Assert.assertEquals(czService.removeClassifyAppItem(appItemId,classifyId).jsonPath().getString("data.message"),"移除成功", "校验移除商品接口成功");
logger.info("校验移除商品分组成功");
}
@Test(description = "删除分组")
public void g_删除分组() throws Exception {
String data=PublicMethod.data();
String classifyId = czService.classify().jsonPath().getString("data.list[0].id");
czService.deleteClassify(classifyId);
// 查询商品分组列表
Response response=czService.classify();
Assert.assertEquals(response.jsonPath().getString("data.totalCount"),"0", "校验商品分组删除接口失败");
logger.info("校验商品分组删除接口成功");
}
}
package http.cases.SaasDeveloperTest;
import base.Config;
import http.service.Saas.SignService;
import utils.PublicMethod;
import base.DuibaLog;
import io.restassured.response.Response;
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;
/**
* Created by humengxin on 2018/11/13.
*/
@ContextConfiguration(classes = Config.class)
public class 签到管理_DuibaTest extends AbstractTestNGSpringContextTests {
@Autowired
SignService signService;
private static DuibaLog logger = DuibaLog.getLogger();
@Test(description = "新建签到活动")
public void a_新建签到活动() throws Exception {
signService.find();
//保存
signService.save();
signService.findConfigById();
signService.configEdit();
signService.find();
}
@Test(description = "预览签到活动")
public void b_预览签到活动() throws Exception {
Response response= signService.link();
}
@Test(description = "获取链接")
public void c_获取链接() throws Exception {
String data = PublicMethod.data();
//查询实物商品集合
Response response= signService.getSignActivityUrl();
//查看商品列表确认是否上架成功
Assert.assertEquals(response.jsonPath().getString("data.isContainsCreditsRemainQueryUrl"),"true", "校验获取链接失败");
logger.info("校验获取链接成功");
}
@Test(description = "编辑签到活动")
public void d_编辑签到活动() throws Exception {
signService.findConfigById();
signService.configEdit();
signService.find();
}
@Test(description = "查询总签到个数")
public void e_查询总签到个数() throws Exception {
String data = PublicMethod.data();
Response response=signService.selectsignOperList();
//查看签到列表个数是否成功
Assert.assertEquals(response.jsonPath().getString("data.list[0].id"),"90", "校验签到id失败");
Assert.assertEquals(response.jsonPath().getString("data.params.total"),"1", "校验总个数失败");
logger.info("校验签到总个数成功");
}
@Test(description = "删除签到")
public void f_删除签到() throws Exception {
String data = PublicMethod.data();
Response response=signService.selectsignOperList();
String id=response.jsonPath().getString("data.list[0].signOperatingId");
//查看签到列表个数是否成功
Response response1=signService.deleteSignOperatingById(id);
Assert.assertEquals(response1.jsonPath().getString("data.message"),"删除成功!", "校验删除成功失败");
logger.info("校验删除成功");
}
}
\ No newline at end of file
/**
* Copyright (C), 2015-2018
* FileName: 兑吧_优惠券秒杀商品兑换测试_ScekillTest
* FileName: 兑吧_优惠券秒杀商品兑换测试_SeckillTest
* Author: qianwenjun
* Date: 2018/5/31 17:57
* Description: 开发者自有秒杀商品测试
......@@ -29,7 +29,7 @@ import java.util.Map;
* @create 2018/5/31
* @since 1.0.0
*/
public class 兑吧_优惠券秒杀商品兑换测试_ScekillTest extends DuibaTestBase {
public class 兑吧_优惠券秒杀商品兑换测试_SeckillTest extends DuibaTestBase {
@Autowired
......
/**
* Copyright (C), 2015-2018
* FileName: 兑吧_优惠券秒杀商品兑换测试_ScekillTest
* FileName: 兑吧_优惠券秒杀商品兑换测试_SeckillTest
* Author: qianwenjun
* Date: 2018/5/31 17:57
* Description: 开发者自有秒杀商品测试
......@@ -29,7 +29,7 @@ import java.util.Map;
* @create 2018/5/31
* @since 1.0.0
*/
public class 兑吧_实物秒杀商品兑换测试_ScekillTest extends DuibaTestBase {
public class 兑吧_实物秒杀商品兑换测试_SeckillTest extends DuibaTestBase {
@Autowired
......
/**
* Copyright (C), 2015-2018
* FileName: 天天秒杀_秒杀活动兑换测试_ScekillTest
* FileName: 天天秒杀_秒杀活动兑换测试_SeckillTest
* Author: qianwenjun
* Date: 2018/6/20 20:38
* Description:
......@@ -37,7 +37,7 @@ import static io.restassured.RestAssured.given;
* @create 2018/6/20
* @since 1.0.0
*/
public class 天天秒杀_秒杀活动兑换测试_ScekillTest extends DuibaTestBase {
public class 天天秒杀_秒杀活动兑换测试_SeckillTest extends DuibaTestBase {
@Autowired
SeckillService seckillService;
......
/**
* Copyright (C), 2015-2018
* FileName: 天天秒杀_秒杀详情测试_ScekillTest1
* FileName: 天天秒杀_秒杀详情测试_SeckillTest
* Author: qianwenjun
* Date: 2018/6/20 11:46
* Description:
......@@ -36,7 +36,7 @@ import static io.restassured.RestAssured.given;
* @create 2018/6/20
* @since 1.0.0
*/
public class 天天秒杀_秒杀详情测试_ScekillTest1 extends DuibaTestBase {
public class 天天秒杀_秒杀详情测试_SeckillTest extends DuibaTestBase {
@Autowired
SeckillService seckillService;
......
/**
* Copyright (C), 2015-2018
* FileName: 秒杀_秒杀商品详情测试_ScekillTest1
* FileName: 秒杀_秒杀商品详情测试_SeckillTest
* Author: qianwenjun
* Date: 2018/5/31 19:19
* Description:
......@@ -27,7 +27,7 @@ import utils.MatcherString;
* @create 2018/5/31
* @since 1.0.0
*/
public class 秒杀_秒杀商品详情测试_ScekillTest1 extends DuibaTestBase {
public class 秒杀_秒杀商品详情测试_SeckillTest extends DuibaTestBase {
@Autowired
SeckillService seckillService;
......
/**
* Copyright (C), 2015-2018
* FileName: 兑吧_优惠券秒杀商品兑换测试_ScekillTest
* FileName: 兑吧_优惠券秒杀商品兑换测试_SeckillTest
* Author: qianwenjun
* Date: 2018/5/31 17:57
* Description: 开发者自有秒杀商品测试
......@@ -29,7 +29,7 @@ import java.util.Map;
* @create 2018/5/31
* @since 1.0.0
*/
public class 秒杀商品_兑换异常库存不足测试_ScekillTest1 extends DuibaTestBase {
public class 秒杀商品_兑换异常库存不足测试_SeckillTest extends DuibaTestBase {
@Autowired
......
/**
* Copyright (C), 2015-2018
* FileName: 兑吧_优惠券秒杀商品兑换测试_ScekillTest
* FileName: 兑吧_优惠券秒杀商品兑换测试_SeckillTest
* Author: qianwenjun
* Date: 2018/5/31 17:57
* Description: 开发者自有秒杀商品测试
......@@ -27,7 +27,7 @@ import utils.MatcherString;
* @create 2018/5/31
* @since 1.0.0
*/
public class 秒杀商品_地址限制兑换异常测试_ScekillTest1 extends DuibaTestBase {
public class 秒杀商品_地址限制兑换异常测试_SeckillTest extends DuibaTestBase {
@Autowired
......
/**
* Copyright (C), 2015-2018
* FileName: 兑吧_优惠券秒杀商品兑换测试_ScekillTest
* FileName: 兑吧_优惠券秒杀商品兑换测试_SeckillTest
* Author: qianwenjun
* Date: 2018/5/31 17:57
* Description: 开发者自有秒杀商品测试
......@@ -29,7 +29,7 @@ import java.util.Map;
* @create 2018/5/31
* @since 1.0.0
*/
public class 秒杀商品_达到兑换限制异常测试_ScekillTest1 extends DuibaTestBase {
public class 秒杀商品_达到兑换限制异常测试_SeckillTest extends DuibaTestBase {
@Autowired
......
/**
* Copyright (C), 2015-2018
* FileName: 兑吧_优惠券秒杀商品兑换测试_ScekillTest
* FileName: 兑吧_优惠券秒杀商品兑换测试_SeckillTest
* Author: qianwenjun
* Date: 2018/5/31 17:57
* Description: 开发者自有秒杀商品测试
......@@ -29,7 +29,7 @@ import java.util.Map;
* @create 2018/5/31
* @since 1.0.0
*/
public class 自有_优惠券秒杀商品兑换测试_ScekillTest extends DuibaTestBase {
public class 自有_优惠券秒杀商品兑换测试_SeckillTest extends DuibaTestBase {
@Autowired
......
/**
* Copyright (C), 2015-2018
* FileName: 兑吧_优惠券秒杀商品兑换测试_ScekillTest
* FileName: 兑吧_优惠券秒杀商品兑换测试_SeckillTest
* Author: qianwenjun
* Date: 2018/5/31 17:57
* Description: 开发者自有秒杀商品测试
......@@ -29,7 +29,7 @@ import java.util.Map;
* @create 2018/5/31
* @since 1.0.0
*/
public class 自有_实物秒杀商品兑换测试_ScekillTest extends DuibaTestBase {
public class 自有_实物秒杀商品兑换测试_SeckillTest extends DuibaTestBase {
@Autowired
......
/**
* Copyright (C), 2015-2018
* FileName: 兑吧_优惠券秒杀商品兑换测试_ScekillTest
* FileName: 兑吧_优惠券秒杀商品兑换测试_SeckillTest
* Author: qianwenjun
* Date: 2018/5/31 17:57
* Description: 开发者自有秒杀商品测试
......@@ -30,7 +30,7 @@ import java.util.Map;
* @create 2018/5/31
* @since 1.0.0
*/
public class 自有_虚拟商品秒杀商品兑换测试_ScekillTest extends DuibaTestBase {
public class 自有_虚拟商品秒杀商品兑换测试_SeckillTest extends DuibaTestBase {
@Autowired
......
package http.cases.WalletTest;
import base.DuibaTestBase;
import utils.RedisUtil;
import http.service.Activity.SeedRedPacketService;
import http.service.Activity.WalletAccountService;
import http.service.Authorization;
import base.DuibaLog;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* Created by mabo on 2018/8/15
*/
public class 种红包_AccessTest extends DuibaTestBase{
@Autowired
SeedRedPacketService seedRedPacketService;
@Autowired
WalletAccountService walletAccountService;
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
@Test
public void 种红包() throws Exception {
//redis设置种植次数为1
RedisUtil.setKey("AC_K057_19380_1_100066444","1");
//查询数据库
Map<String,Object> map = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0140 where account_id = '100066444_6_0'");
//除以100
BigDecimal account =new BigDecimal(map.get("balance_amount").toString()).divide(new BigDecimal("100"));
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(3454);
//调用获取getWalletAccount,获取账户金额
Response response = walletAccountService.getWalletAccount(cookies);
String balanceAmount = response.jsonPath().getString("balanceAmount");
//校验,与数据对比
Assert.assertTrue(new BigDecimal(balanceAmount).compareTo(account)==0,"钱包账户异常");
//调用getLandList接口
response = seedRedPacketService.getLandList(cookies,"1","424");
String numberIsFull = response.jsonPath().getString("data.numberIsFull");
//校验可种植状态
Assert.assertEquals(numberIsFull,"false","可种植状态异常");
Thread.sleep(2000);
//调用种植seed
response = seedRedPacketService.seed(cookies,"1","424","1");
numberIsFull = response.jsonPath().getString("data.numberIsFull");
//校验可种植状态
Assert.assertEquals(numberIsFull,"false","可种植状态异常");
//种子号
String orderId = response.jsonPath().getString("data.orderNum");
Assert.assertNotNull(orderId,"订单号为空");
//生长时间
String grownNeedTime = response.jsonPath().getString("data.grownNeedTime");
Assert.assertEquals(grownNeedTime,"1","获取红包时间间隔异常");
Thread.sleep(2000);
//获取种植结果状态getOrderStatus,异步接口,while循环,status为2处理完成,1处理中
response = seedRedPacketService.getOrderStatus(cookies,orderId);
String status = response.jsonPath().getString("data");
int i =5;
while(i>0&&status.equals("1")){
response = seedRedPacketService.getOrderStatus(cookies,orderId);
status = response.jsonPath().getString("data");
i--;
}
//获取种植获得金额
response = seedRedPacketService.reap(cookies,"1",orderId);
response.prettyPrint();
String addAccount = response.jsonPath().getString("data.redPacketAmount");
//获得金额与原金额相加
BigDecimal newAccount = new BigDecimal(addAccount).add(account);
//数据库查询校验账户增加是否正常
map = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0140 where account_id = '100066444_6_0'");
account = new BigDecimal(map.get("balance_amount").toString()).divide(new BigDecimal("100"));
Assert.assertTrue(account.compareTo(newAccount)==0,"钱包账户增加异常");
}
@Test
public void 每日种红包限制() throws Exception {
RedisUtil.setKey("AC_K057_19380_1_100066444","8");
String data = RedisUtil.getKey("AC_K057_19380_1_100066444");
Map cookies = authorization.dafuwengLogin(3454);
Response response = seedRedPacketService.getLandList(cookies,"1","424");
String numberIsFull = response.jsonPath().getString("data.numberIsFull");
Assert.assertEquals(numberIsFull,"true","可种植状态异常");
response = seedRedPacketService.seed(cookies,"1","424","1");
numberIsFull = response.jsonPath().getString("data.numberIsFull");
Assert.assertEquals(numberIsFull,"true","可种植状态异常");
}
@Test(description = "第二块土地种植一次解锁")
public void 解锁土地() throws Exception {
Response response = seedRedPacketService.updateUserLand("19380","1","2","100066444","2");
Map cookies = authorization.dafuwengLogin(3454);
response = seedRedPacketService.unlockLand(cookies,"1","424","2");
response = seedRedPacketService.getLandList(cookies,"1","424");
List<Map> list = response.jsonPath().getList("data.landList",Map.class);
int landStatus = (int)list.get(1).get("landStatus");
Assert.assertEquals(landStatus,3,"解锁失败");
logger.info("解锁土地成功");
}
}
package http.cases.WalletTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.SeedRedPacketService;
import http.service.Activity.WalletAccountService;
import http.service.Authorization;
import http.service.Manager.EditManagerInfoService;
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.BeforeClass;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.util.Map;
import static io.restassured.RestAssured.given;
/**
* Created by 赵然 on 2018/11/08
*/
public class 种红包新用户_AccessTest extends DuibaTestBase{
@Autowired
SeedRedPacketService seedRedPacketService;
@Autowired
WalletAccountService walletAccountService;
@Autowired
EditManagerInfoService editManagerInfoService;
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
//指定用户
private static int uid;
private static String consumerId;
private static String tag;
@BeforeClass
public void beforeclass() {
try {
this.createUser();
} catch (Exception e) {
logger.info("数据前后置操作异常");
}
}
@AfterClass
public void afterclass() {
try {
this.clear();
} catch (Exception e) {
logger.info("数据后置操作异常");
}
}
@Test
public void a_新人收红包() throws Exception {
logger.info("用户信息为,uid="+uid+",consumerId="+consumerId);
tag = String.format("%04d", Long.parseLong(consumerId) % 1024);
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid);
//调用getLandList接口,生成新人待收获红包,并校验第一块土地默认解锁
Response response = seedRedPacketService.getLandList(cookies,"1","424");
String landStatus = response.jsonPath().getString("data.landList[0].landStatus");
Assert.assertEquals(landStatus,"4","新人第一块土地状态校验失败");
Thread.sleep(1000);
//获取新人红包订单号
Map<String,Object> sqlResult = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_"+tag+" where consumer_id ="+consumerId+" and activity_type = 'seedRedPacket'");
String orderId = sqlResult.get("order_num").toString();
String add_credits = sqlResult.get("add_credits").toString();
Assert.assertEquals(add_credits,"20","新人红包金额校验失败");
//获取新人红包兑换状态:1-待兑换
String exchange_status = sqlResult.get("exchange_status").toString();
logger.info("收获前,exchange_status状态为:"+exchange_status);
Assert.assertEquals(exchange_status,"1","新人红包兑换状态校验失败");
//获取种植获得金额
response = seedRedPacketService.reap(cookies,"1",orderId);
response.prettyPrint();
String isDecr = response.jsonPath().getString("data.isDecr");
String isFirstReap = response.jsonPath().getString("data.isFirstReap");
String redPacketAmount = response.jsonPath().getString("data.redPacketAmount");
Assert.assertEquals(isDecr,"false","红包衰减校验失败");
Assert.assertEquals(isFirstReap,"true","类型是否新人红包校验失败");
Assert.assertTrue(new BigDecimal(redPacketAmount).compareTo(new BigDecimal("0.2"))==0,"新人红包金额校验失败");
//获取新人红包兑换状态:2-兑换成功
Map<String,Object> sqlResult2 = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_"+tag+" where consumer_id ="+consumerId+" and activity_type = 'seedRedPacket'");
String exchange_status2 = sqlResult2.get("exchange_status").toString();
logger.info("收获后,exchange_status状态为:"+exchange_status2);
Assert.assertEquals(exchange_status2,"2","新人红包兑换状态校验失败");
//调用获取getWalletAccount,获取账户金额
response = walletAccountService.getWalletAccount(cookies);
String balanceAmount = response.jsonPath().getString("balanceAmount");
//校验,与数据对比
Assert.assertTrue(new BigDecimal(balanceAmount).compareTo(new BigDecimal("0.2"))==0,"新人红包入账失败");
logger.info("新人红包入账失败");
}
@Test
public void b_入账明细校验() throws Exception {
//获取数据库扣款记录
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_account_log.tb_consumer_accounts_log where account_id = '"+consumerId+"_6_0'");
String change_money = String.valueOf(selectResult.get("change_money"));
String action_type = String.valueOf(selectResult.get("action_type"));
String sub_type = String.valueOf(selectResult.get("sub_type"));
String biz_description = String.valueOf(selectResult.get("biz_description"));
Assert.assertEquals(change_money, "20", "数据库扣款金额校验失败");
Assert.assertEquals(action_type, "1", "数据库账户动作校验失败");
Assert.assertEquals(sub_type, "1", "数据库日志类型校验失败");
Assert.assertEquals(biz_description, "种红包活动用户领取红包收入", "数据库业务描述校验失败");
logger.info("数据库新人红包入账记录校验成功");
//获取最新的提现记录
Map cookies = authorization.dafuwengLogin(uid);
Response response = walletAccountService.walletDetail(cookies);
String money = response.jsonPath().getString("data[0].money");
String subType = response.jsonPath().getString("data[0].subType");
String description = response.jsonPath().getString("data[0].description");
Assert.assertTrue(new BigDecimal(money).compareTo(new BigDecimal("0.2"))==0,"扣款金额校验失败");
Assert.assertEquals(subType, "1", "日志类型校验失败");
Assert.assertEquals(description,"种红包活动用户领取红包收入", "数据库业务描述校验失败");
logger.info("余额明细列表校验成功");
}
public void createUser() throws Exception{
Response response = editManagerInfoService.createUser("种红包新用户","68");
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '种红包新用户' and app_id = '68'");
uid = Integer.valueOf(user.get("id").toString());
String url = "http://47.97.214.108/user/loginDuiba?uid=" + uid;
Response login = given().get(url);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = '19380'",uid);
consumerId = consumer.get("id").toString();
}
public void clear(){
try {
jdbc.update("delete from dafuweng.user where name = '种红包新用户' and app_id = '68'");
jdbc.update("delete from new_consumer.consumer_0010 where id = ?",consumerId);
} catch (Exception e) {
logger.info("数据后置操作异常");
}
}
}
package http.cases.WalletTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.SeedRedPacketService;
import http.service.Activity.WalletAccountService;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.text.SimpleDateFormat;
import java.util.*;
import static io.restassured.RestAssured.given;
/**
* Created by mabo on 2018/8/15
*/
public class 种红包条件解锁_AccessTest extends DuibaTestBase{
@Value("${activity.host}")
String activityHost;
@Autowired
SeedRedPacketService seedRedPacketService;
@Autowired
WalletAccountService walletAccountService;
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
//指定用户
private static int uid = 4552;
private static String consumerId = "100101015";
@BeforeClass
public void beforeclass() {
try {
seedRedPacketService.updateUserLand("19380","1","8",consumerId,"1");
seedRedPacketService.updateUserLand("19380","1","6",consumerId,"1");
seedRedPacketService.updateUserLand("19380","1","4",consumerId,"1");
} catch (Exception e) {
logger.info("数据前后置操作异常");
}
}
@Test(description = "第四块土地消耗积分解锁")
public void 第四块土地解锁() throws Exception {
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid);
//调用getLandList接口
Response response = seedRedPacketService.getLandList(cookies,"1","424");
String landStatus = response.jsonPath().getString("data.landList[3].landStatus");
logger.info("第四块土地状态为:可解锁-"+landStatus);
Assert.assertEquals(landStatus,"2","第四块土地状态校验失败");
//调用解锁土地接口
response = seedRedPacketService.unlockLand(cookies,"1","424","4");
//调用getLandList接口
response = seedRedPacketService.getLandList(cookies,"1","424");
landStatus = response.jsonPath().getString("data.landList[3].landStatus");
logger.info("第四块土地状态为:空地-"+landStatus);
Assert.assertEquals(landStatus,"3","第四块土地状态校验失败");
}
@Test(description = "第四块土地消耗积分解锁")
public void 第四块土地解锁_未达条件() throws Exception {
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(4582);
//调用getLandList接口
Response response = seedRedPacketService.getLandList(cookies,"1","424");
String landStatus = response.jsonPath().getString("data.landList[3].landStatus");
logger.info("第四块土地状态为:未解锁-"+landStatus);
Assert.assertEquals(landStatus,"1","第四块土地状态校验失败");
//调用解锁土地接口
Map<String,String> map = new HashMap<>();
map.put("activityId","1");
map.put("floorId","424");
map.put("landId","4");
map.put("dcm","228.4.2.0");
map.put("dpm","19380.5.424.4");
logger.info("请求unlockLand接口,landId=4");
response = given().cookies(cookies).params(map).get(activityHost+"/seedRedPacket/unlockLand");
Assert.assertEquals(response.jsonPath().getString("success"),"false","/seedRedPacket/seed接口失败");
Assert.assertEquals(response.jsonPath().getString("desc"),"用户地块不是可解锁状态","/seedRedPacket/seed接口失败");
logger.info("用户未达条件,地块不是可解锁状态");
}
@Test(description = "第六块土地兑换一次解锁")
public void 第六块土地解锁() throws Exception {
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid);
//调用getLandList接口
Response response = seedRedPacketService.getLandList(cookies,"1","424");
String landStatus = response.jsonPath().getString("data.landList[5].landStatus");
logger.info("第六块土地状态为:可解锁-"+landStatus);
Assert.assertEquals(landStatus,"2","第六块土地状态校验失败");
//调用解锁土地接口
response = seedRedPacketService.unlockLand(cookies,"1","424","6");
//调用getLandList接口
response = seedRedPacketService.getLandList(cookies,"1","424");
landStatus = response.jsonPath().getString("data.landList[5].landStatus");
logger.info("第六块土地状态为:空地-"+landStatus);
Assert.assertEquals(landStatus,"3","第六块土地状态校验失败");
}
@Test(description = "第八块土地提现一次解锁")
public void 第八块土地解锁() throws Exception {
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid);
//调用getLandList接口
Response response = seedRedPacketService.getLandList(cookies,"1","424");
String landStatus = response.jsonPath().getString("data.landList[7].landStatus");
logger.info("第八块土地状态为:可解锁-"+landStatus);
Assert.assertEquals(landStatus,"2","第八块土地状态校验失败");
//调用解锁土地接口
response = seedRedPacketService.unlockLand(cookies,"1","424","8");
//调用getLandList接口
response = seedRedPacketService.getLandList(cookies,"1","424");
landStatus = response.jsonPath().getString("data.landList[7].landStatus");
logger.info("第八块土地状态为:空地-"+landStatus);
Assert.assertEquals(landStatus,"3","第八块土地状态校验失败");
}
}
package http.cases.WalletTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.SeedRedPacketService;
import http.service.Activity.WalletAccountService;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import utils.RedisUtil;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* Created by mabo on 2018/8/15
*/
public class 种红包登录解锁_AccessTest extends DuibaTestBase{
@Autowired
SeedRedPacketService seedRedPacketService;
@Autowired
WalletAccountService walletAccountService;
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
//指定用户
private static int uid = 4565;
private static String consumerId = "100101043";
@BeforeClass
public void beforeclass() {
try {
//还原用户的连续登陆天数为2
RedisUtil.setKey( "AAW_K146_19380_"+consumerId+"_"+getTime(),"2");
seedRedPacketService.updateUserLand("19380","1","3",consumerId,"1");
seedRedPacketService.updateUserLand("19380","1","5",consumerId,"1");
seedRedPacketService.updateUserLand("19380","1","7",consumerId,"1");
} catch (Exception e) {
logger.info("数据前后置操作异常");
}
}
@Test(description = "第三块土地连续登录3天解锁")
public void a_第三块土地解锁() throws Exception {
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid);
//调用getLandList接口
Response response = seedRedPacketService.getLandList(cookies,"1","424");
String landStatus = response.jsonPath().getString("data.landList[2].landStatus");
logger.info("第三块土地状态为:未解锁-"+landStatus);
Assert.assertEquals(landStatus,"1","第三块土地状态校验失败");
//修改redis用户连续登陆天数为3天
RedisUtil.setKey( "AAW_K146_19380_"+consumerId+"_"+getTime(),"3");
//调用getLandList接口
response = seedRedPacketService.getLandList(cookies,"1","424");
landStatus = response.jsonPath().getString("data.landList[2].landStatus");
logger.info("第三块土地状态为:可解锁-"+landStatus);
Assert.assertEquals(landStatus,"2","第三块土地状态校验失败");
//调用解锁土地接口
response = seedRedPacketService.unlockLand(cookies,"1","424","3");
//调用getLandList接口
response = seedRedPacketService.getLandList(cookies,"1","424");
landStatus = response.jsonPath().getString("data.landList[2].landStatus");
logger.info("第三块土地状态为:空地-"+landStatus);
Assert.assertEquals(landStatus,"3","第三块土地状态校验失败");
}
@Test(description = "第五块土地连续登录7天解锁")
public void b_第五块土地解锁() throws Exception {
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid);
//调用getLandList接口
Response response = seedRedPacketService.getLandList(cookies,"1","424");
String landStatus = response.jsonPath().getString("data.landList[4].landStatus");
logger.info("第五块土地状态为:未解锁-"+landStatus);
Assert.assertEquals(landStatus,"1","第五块土地状态校验失败");
//修改redis用户连续登陆天数为3天
RedisUtil.setKey( "AAW_K146_19380_"+consumerId+"_"+getTime(),"7");
//调用getLandList接口
response = seedRedPacketService.getLandList(cookies,"1","424");
landStatus = response.jsonPath().getString("data.landList[4].landStatus");
logger.info("第五块土地状态为:可解锁-"+landStatus);
Assert.assertEquals(landStatus,"2","第五块土地状态校验失败");
//调用解锁土地接口
response = seedRedPacketService.unlockLand(cookies,"1","424","5");
//调用getLandList接口
response = seedRedPacketService.getLandList(cookies,"1","424");
landStatus = response.jsonPath().getString("data.landList[4].landStatus");
logger.info("第五块土地状态为:空地-"+landStatus);
Assert.assertEquals(landStatus,"3","第五块土地状态校验失败");
}
@Test(description = "第七块土地连续登录15天解锁")
public void c_第七块土地解锁() throws Exception {
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid);
//调用getLandList接口
Response response = seedRedPacketService.getLandList(cookies,"1","424");
String landStatus = response.jsonPath().getString("data.landList[6].landStatus");
logger.info("第七块土地状态为:未解锁-"+landStatus);
Assert.assertEquals(landStatus,"1","第七块土地状态校验失败");
//修改redis用户连续登陆天数为3天
RedisUtil.setKey( "AAW_K146_19380_"+consumerId+"_"+getTime(),"15");
//调用getLandList接口
response = seedRedPacketService.getLandList(cookies,"1","424");
landStatus = response.jsonPath().getString("data.landList[6].landStatus");
logger.info("第七块土地状态为:可解锁-"+landStatus);
Assert.assertEquals(landStatus,"2","第七块土地状态校验失败");
//调用解锁土地接口
response = seedRedPacketService.unlockLand(cookies,"1","424","7");
//调用getLandList接口
response = seedRedPacketService.getLandList(cookies,"1","424");
landStatus = response.jsonPath().getString("data.landList[6].landStatus");
logger.info("第七块土地状态为:空地-"+landStatus);
Assert.assertEquals(landStatus,"3","第七块土地状态校验失败");
}
//获取当天日期
public String getTime(){
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd", Locale.ENGLISH);
Date date = new Date();
String time = dateFormat.format(date);
return time;
}
}
package http.cases.WalletTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.SeedRedPacketService;
import http.service.Activity.WalletAccountService;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import utils.HbaseService;
import utils.PublicMethod;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import static io.restassured.RestAssured.given;
/**
* Created by 赵然 on 2018/11/06
*/
public class 账户余额清零_AccessTest extends DuibaTestBase {
@Value("${activity.host}")
String activityHost;
@Autowired
SeedRedPacketService seedRedPacketService;
@Autowired
WalletAccountService walletAccountService;
@Autowired
Authorization authorization;
@Autowired
HbaseService hbaseService;
private DuibaLog logger = DuibaLog.getLogger();
//指定用户
private static int uid = 4486;
private static String consumerId = "100098059";
private static int uid2 = 4660;
private static String consumerId2 = "100104140";
@BeforeClass
public void beforeclass() {
try {
//重置账户金额10000
walletAccountService.updateConsumerAccount(consumerId,"6","10000");
} catch (Exception e) {
logger.info("数据后面置操作异常");
}
}
@Test(description = "过期日前账户余额>0")
public void a_账户过期余额清零() throws Exception {
//修改账户过期时间,确保账户始终处于过期状态
jdbc.update("update consumer_account_log.tb_expire_consumer_account set gmt_modified ='" + getTime(-1) + "' where account_id = '"+consumerId+"_6_0'");
//删除过期记录
jdbc.update("delete from consumer_account_log.tb_consumer_accounts_log where account_id = '"+consumerId+"_6_0' and biz_type='10'");
//删除自动化充值记录
jdbc.update("delete from consumer_account_log.tb_consumer_accounts_log where account_id = '"+consumerId+"_6_0' and biz_type='19'");
Map<String, Object> sqlResult = jdbc.findSimpleResult("select * from consumer_account_log.tb_expire_consumer_account where account_id = '"+consumerId+"_6_0' ");
String gmt_modified1 = String.valueOf(sqlResult.get("gmt_modified"));
logger.info("账户第一次登录时间为" + gmt_modified1);
//获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0011 where account_id = '"+consumerId+"_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
Assert.assertEquals(balance,10000,"查询账户余额失败");
logger.info("账户原有余额为" + balance);
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid);
//调用获取getWalletAccount,获取账户金额
Response response = walletAccountService.getWalletAccount(cookies);
String balanceAmount = response.jsonPath().getString("balanceAmount");
//校验,与数据对比
Assert.assertTrue(new BigDecimal(balanceAmount).compareTo(new BigDecimal("0"))==0,"钱包账户未清零");
logger.info("账户过期清零成功");
sqlResult = jdbc.findSimpleResult("select * from consumer_account_log.tb_expire_consumer_account where account_id = '"+consumerId+"_6_0' ");
String gmt_modified2 = String.valueOf(sqlResult.get("gmt_modified"));
logger.info("账户第二次登录时间为" + gmt_modified2);
Assert.assertEquals(gmt_modified1.equals(gmt_modified2)==false,true);
}
@Test(description = "过期日前账户余额>0")
public void b_扣款明细校验() throws Exception {
//获取数据库扣款记录
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_account_log.tb_consumer_accounts_log where account_id = '"+consumerId+"_6_0' and biz_type=10");
String change_money = String.valueOf(selectResult.get("change_money"));
String action_type = String.valueOf(selectResult.get("action_type"));
String sub_type = String.valueOf(selectResult.get("sub_type"));
String biz_description = String.valueOf(selectResult.get("biz_description"));
Assert.assertEquals(change_money, "10000", "数据库扣款金额校验失败");
Assert.assertEquals(action_type, "0", "数据库账户动作校验失败");
Assert.assertEquals(sub_type, "0", "数据库日志类型校验失败");
Assert.assertEquals(biz_description.contains("红包过期"), true, "数据库业务描述校验失败");
logger.info("数据库账户过期清零记录校验成功");
//获取最新的提现记录
Map cookies = authorization.dafuwengLogin(uid);
Response response = walletAccountService.walletDetail(cookies);
String money = response.jsonPath().getString("data[1].money");
String subType = response.jsonPath().getString("data[1].subType");
String description = response.jsonPath().getString("data[1].description");
Assert.assertTrue(new BigDecimal(money).compareTo(new BigDecimal("100"))==0,"扣款金额校验失败");
Assert.assertEquals(subType, "0", "日志类型校验失败");
Assert.assertEquals(description.contains("红包过期"),true, "日志类型校验失败");
logger.info("订单列表过期记录校验成功");
}
@Test(description = "老用户进入积分商城获得的金额不过期")
public void c_金额不过期测试() throws Exception {
//账户充值100
walletAccountService.updateConsumerAccount(consumerId,"6","100");
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid);
//调用获取getWalletAccount,获取账户金额
Response response = walletAccountService.getWalletAccount(cookies);
String balanceAmount = response.jsonPath().getString("balanceAmount");
logger.info("当前账户余额为:"+balanceAmount);
//校验,与数据对比
Assert.assertTrue(new BigDecimal(balanceAmount).compareTo(new BigDecimal("1"))==0,"钱包账户余额校验失败");
logger.info("钱包账户余额校验失败");
}
@Test(description = "过期日前账户余额=0")
public void d_账户过期余额清零2() throws Exception {
//修改账户过期时间,确保账户始终处于过期状态
jdbc.update("update consumer_account_log.tb_expire_consumer_account set gmt_modified ='" + getTime(-1) + "' where account_id = '"+consumerId2+"_6_0'");
Map<String, Object> sqlResult = jdbc.findSimpleResult("select * from consumer_account_log.tb_expire_consumer_account where account_id = '"+consumerId2+"_6_0' ");
String gmt_modified1 = String.valueOf(sqlResult.get("gmt_modified"));
logger.info("账户第一次登录时间为" + gmt_modified1);
//获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0972 where account_id = '"+consumerId2+"_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
Assert.assertEquals(balance,0,"查询账户余额失败");
logger.info("账户原有余额为" + balance);
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid2);
//调用获取getWalletAccount,获取账户金额
Response response = walletAccountService.getWalletAccount(cookies);
String balanceAmount = response.jsonPath().getString("balanceAmount");
//校验,与数据对比
Assert.assertTrue(new BigDecimal(balanceAmount).compareTo(new BigDecimal("0"))==0,"钱包账户未清零");
logger.info("账户过期清零成功");
sqlResult = jdbc.findSimpleResult("select * from consumer_account_log.tb_expire_consumer_account where account_id = '"+consumerId2+"_6_0' ");
String gmt_modified2 = String.valueOf(sqlResult.get("gmt_modified"));
logger.info("账户第二次登录时间为" + gmt_modified2);
Assert.assertEquals(gmt_modified1.equals(gmt_modified2)==false,true);
}
public String getTime(int amount){
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd", Locale.ENGLISH);
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.MONTH, amount);
date = calendar.getTime();
// System.out.println(dateFormat.format(date));
String time = dateFormat.format(date)+" 08:00:00";
// System.out.println(time);
return time;
}
}
/**
* Copyright (C), 2015-2018
* FileName: PkGroupVo
* Author: qianwenjun
* Date: 2018/11/12 11:01
* Description:
*/
package http.model;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/11/12
* @since 1.0.0
*/
public class PkGroupVo {
private String id;
private String title;
private String attributionType;
private String appId;
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAttributionType() {
return attributionType;
}
public void setAttributionType(String attributionType) {
this.attributionType = attributionType;
}
}
\ No newline at end of file
......@@ -109,8 +109,8 @@ public class ContractSignService {
* @return
* @throws Exception
*/
public Response getContractRank(String activityId, String topNum, String showType, int uid) throws Exception{
Map<String, String> map = new HashMap<>();
public Response getContractRank(String activityId, int topNum, int showType, int uid) throws Exception{
Map<String, Object> map = new HashMap<>();
map.put("activityId", activityId);
map.put("topNum", topNum);
map.put("showType", showType);
......@@ -204,7 +204,7 @@ public class ContractSignService {
public Response getReward(String ContractId, int uid) throws Exception{
Map<String, String> map = new HashMap<>();
map.put("activityId", ContractId);
map.put("contractId", ContractId);
logger.info("请求getReward接口,签到活动id=" + ContractId);
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).post(activityHost+"/sign/contract/getReward");
try{
......
......@@ -58,9 +58,9 @@ public class WalletAccountService {
public Response doTakePrize(Map cookies,String alipay,String realname) throws Exception {
logger.info("请求doTakePrize");
Map<String,String> map = new HashMap<>();
map.put("alipay","peeulk6392@sandbox.com");
map.put("realname","沙箱环境");
Response response = given().cookies(cookies).get(activityHost+"/walletAccount/doTakePrize");
map.put("alipay",alipay);
map.put("realname",realname);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(cookies).params(map).post(activityHost+"/walletAccount/doTakePrize");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/doTakePrize接口失败");
......@@ -73,4 +73,94 @@ public class WalletAccountService {
return response;
}
/**
* 红包账户提现
* @param cookies
* @param orderId
* @return
* @throws Exception
*/
public Response getOrderStatus(Map cookies,String orderId) throws Exception {
logger.info("请求getOrderStatus");
Map<String,String> map = new HashMap<>();
map.put("orderId",orderId);
Response response = given().cookies(cookies).params(map).post(activityHost+"/walletAccount/getOrderStatus");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/getOrderStatus接口失败");
}catch(Exception e){
throw new Exception("/walletAccount/getOrderStatus接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/walletAccount/getOrderStatus接口失败,返回信息:"+response.asString());
}
return response;
}
public Response getOrderStatus2(Map cookies,String orderId) throws Exception {
logger.info("请求getOrderStatus");
Map<String,String> map = new HashMap<>();
map.put("orderId",orderId);
Response response = given().cookies(cookies).params(map).post(activityHost+"/walletAccount/getOrderStatus");
return response;
}
/**
* 红包账户提现记录
* @param cookies
* @return
* @throws Exception
*/
public Response walletDetail(Map cookies) throws Exception {
logger.info("请求walletDetail");
Map<String,String> map = new HashMap<>();
map.put("pageNo","1");
map.put("pageSize","12");
Response response = given().cookies(cookies).params(map).get(activityHost+"/walletAccount/walletDetail");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/walletDetail接口失败");
}catch(Exception e){
throw new Exception("/walletAccount/walletDetail接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/walletAccount/walletDetail接口失败,返回信息:"+response.asString());
}
return response;
}
/**
* 红包账户修改钱包账户余额后门
* @param consumerId
* @param accountType
* @param balanceAmount
* @return
* @throws Exception
*/
public void updateConsumerAccount(String consumerId,String accountType,String balanceAmount) throws Exception {
logger.info("请求修改钱包账户余额后门:updateConsumerAccount");
Map<String,String> map = new HashMap<>();
map.put("consumerId",consumerId);
map.put("accountType",accountType);
map.put("balanceAmount",balanceAmount);
Response response = given().params(map).get(activityHost+"/aaw/automated/updateConsumerAccount");
// try{
// Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/walletDetail接口失败");
//
// }catch(Exception e){
// throw new Exception("/aaw/automated/updateConsumerAccount接口失败,返回信息:"+response.asString());
// }catch(Error er){
// throw new Exception("/aaw/automated/updateConsumerAccount接口失败,返回信息:"+response.asString());
//
// }
//return response;
}
}
......@@ -284,6 +284,36 @@ public class Authorization {
}
//取消安全校验
// logger.info(hdCookies);
return hdCookies;
}
//密码为duibaduiba123
public Map hdLoginCommonNew(String account){
String path = "/doLoginNew";
int i=10;
Map<String,String> hdCookies = hdCookiesCommon.get(account);
while((hdCookies==null||hdCookies.size()==0)&&i>0) {
Response token=this.hdGetToken();
String url = PROTOCOL + hdHost + path;
Map<String,String> cookies=token.getCookies();
Map<String, String> paras = new HashMap<>();
paras.put("account", account);
paras.put("password", SecurityUtils.getMD5("Dct7xTdGPvbUL1eOtSWoB9ySZNY="+from(token.asString()).getString("data.loginsToken")));
paras.put("redirect", "/redirectApp");
paras.put("isAutoLogin", "true");
paras.put("validate","22");
Response response = given().cookies(cookies).params(paras).post(url);
response.prettyPrint();
hdCookies=new HashMap<>(response.getCookies());
if(hdCookies==null||hdCookies.size()==0){
hdCookies.remove("csrf_token");
hdCookiesCommon.put(account,hdCookies);
}
i--;
}
//取消安全校验
// logger.info(hdCookies);
return hdCookies;
}
......
......@@ -161,6 +161,73 @@ public class PkActivityService {
}
public Response betActGroup(String betName) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/betActGroup";
Map<String,Object> para = new HashMap<>();
para.put("title",betName);
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(para));
Response betGroupResponse = given().contentType("application/json;charset=UTF-8").cookies(authorization.ssoLogin()).body(jsonParam).post(url);
betGroupResponse.prettyPrint();
try{
Assert.assertEquals(betGroupResponse.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("创建pk活动组接口失败,返回信息:"+betGroupResponse.asString());
}catch(Error er){
throw new Exception("创建pk活动组接口失败,返回信息:"+betGroupResponse.asString());
}
return betGroupResponse;
}
public Response appGroupRelation(String adPositions,String adSwitch,String appIds,String groupId) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/appGroupRelation";
Map<String,Object> para = new HashMap<>();
para.put("adPositions",adPositions);
para.put("adSwitch",adSwitch);
para.put("appIds",appIds);
para.put("groupId",groupId);
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(para));
Response betGroupRelationResponse = given().contentType("application/json;charset=UTF-8").cookies(authorization.ssoLogin()).body(jsonParam).post(url);
betGroupRelationResponse.prettyPrint();
try{
Assert.assertEquals(betGroupRelationResponse.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("创建pk活动组关系接口失败,返回信息:"+betGroupRelationResponse.asString());
}catch(Error er){
throw new Exception("创建pk活动组关系接口失败,返回信息:"+betGroupRelationResponse.asString());
}
return betGroupRelationResponse;
}
public Response getBetGroupList() throws Exception{
String url = "http://" + ManagerHost + "/newmanager/betActGroup/list";
Map<String,Object> para = new HashMap<>();
para.put("pageNo","1");
para.put("pageSize","20");
Response groupListResponse = given().cookies(authorization.ssoLogin()).params(para).get(url);
try{
Assert.assertEquals(groupListResponse.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("获取活动组列表接口失败,返回信息:"+groupListResponse.asString());
}catch(Error er){
throw new Exception("获取活动组列表接口失败,返回信息:"+groupListResponse.asString());
}
return groupListResponse;
}
// public static void main(String[] args) throws Exception{
// String endTime = "2021-12-31 23:55:00";
// PkActivityService pkActivityService = new PkActivityService();
......
package http.service.Saas;
import base.DuibaLog;
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 humengxin on 2018/11/13.
*/
@Service
public class SignService {
@Value("${hdserver.host}")
String hdHost;
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
//7查询签到管理列表数据:appid=19515
public Response selectsignOperList() throws Exception {
String url=hdHost+"/saas/selectsignOperList";
Map<String,String> map = new HashMap<>();
map.put("rowId","1");
map.put("appId","19515");
logger.info("查询签到管理列表数据url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("查询签到管理列表数据接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("查询签到管理列表数据接口失败,返回信息:"+response.asString());
}
return response;
}
//5预览签到链接:appid=20979
public Response link() throws Exception {
String url=hdHost+"/signin/preview/link";
Map<String,String> map = new HashMap<>();
map.put("type","2");
map.put("appId","19515");
map.put("activityId","90");
map.put("skinId","51");
logger.info("预览签到链接url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).params(map).get("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("预览签到链接,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("预览签到链接接口失败,返回信息:"+response.asString());
}
return response;
}
//6获取链接接口
public Response getSignActivityUrl() throws Exception {
String url=hdHost+"/signin/getSignActivityUrl";
Map<String,String> map = new HashMap<>();
map.put("appId","19515");
map.put("id","90");
logger.info("请求获取链接接口url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).params(map).get("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("获取链接接口接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("获取链接接口接口失败,返回信息:"+response.asString());
}
return response;
}
//3查询某款签到活动
public Response findConfigById() throws Exception {
String url=hdHost+"/signin/findConfigById";
Map<String,String> map = new HashMap<>();
map.put("appId","19515");
map.put("actId","90");
logger.info("查询某款签到活动url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).params(map).get("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("查询某款签到活动接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("查询某款签到活动接口失败,返回信息:"+response.asString());
}
return response;
}
//4保存某款签到活动配置
public Response configEdit() throws Exception {
String url=hdHost+"/signin/configEdit";
Map<String,String> map = new HashMap<>();
map.put("appId","19515");
map.put("title","Saas开发者后台签到");
map.put("description","<p>Saas开发者后台签到</p>");
map.put("id","90");
map.put("signRule","{\"acValidityType\":\"DAY\",\"cusCirType\":\"MONTH\",\"cusCirStart\":\"2018-06-15\",\"type\":\"CONTINUE\"}");
map.put("reSignRule","{\"open\":true,\"dateUnit\":\"CUSTOM\",\"days\":30,\"conType\":\"NO\",\"credits\":null,\"card\":null,\"awardType\":\"NO\",\"countLimit\":\"30\",\"openAddLimit\":true,\"addLimitCycle\":null,\"addLimitCount\":null}");
map.put("cntReward","{\"rwType\":\"CONTINUE\",\"plActSkinId\":null,\"plActId\":909,\"items\":[{\"days\":null,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}");
map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}");
map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":100,\"activityCount\":100}],\"plSkinOpen2Dev\":true,\"open\":true}");
map.put("firstSignReward","[]");
logger.info("保存某款签到活动配置url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("保存某款签到活动配置接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("保存某款签到活动配置接口失败,返回信息:"+response.asString());
}
return response;
}
//1查询某款签到活动下绑定的皮肤
public Response find() throws Exception {
String url=hdHost+"/signin/activityskin/find";
Map<String,String> map = new HashMap<>();
map.put("appId","19515");
map.put("activityId","90");
map.put("type","2");
logger.info("查询某款签到活动下绑定的皮肤url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).params(map).get("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("查询某款签到活动下绑定的皮肤接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("查询某款签到活动下绑定的皮肤接口失败,返回信息:"+response.asString());
}
return response;
}
//2查询某款签到活动关联的签到皮肤
public Response save() throws Exception {
String url=hdHost+"/signin/save";
Map<String,String> map = new HashMap<>();
map.put("appId","19515");
map.put("activityId","90");
map.put("type","2");
map.put("activitySkinId","51");
logger.info("查询某款签到活动关联的签到皮肤url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("查询某款签到活动关联的签到皮肤接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("查询某款签到活动关联的签到皮肤接口失败,返回信息:"+response.asString());
}
return response;
}
//8删除某款签到活动
public Response deleteSignOperatingById(String id) throws Exception {
String url=hdHost+"/saas/deleteSignOperatingById";
Map<String,String> map = new HashMap<>();
map.put("id",id);
logger.info("删除某款签到活动url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("删除某款签到活动接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("删除某款签到活动接口失败,返回信息:"+response.asString());
}
return response;
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -61,7 +61,7 @@ public class DevFloorIconService {
public Response selectedList(Map cookies, String appId) throws Exception {
JSONObject json = new JSONObject();
json.put("appId","18740");
json.put("appId",appId);
Response response = given().cookies(cookies).contentType(ContentType.JSON).body(json.toJSONString()).post("http://"+hdserverHost+"/devFloorIcon/selectedList");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
......
......@@ -12,6 +12,7 @@ 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;
......@@ -36,11 +37,12 @@ public class HbaseService {
public Response getHBASEKey(String key) {
String url = activtyHost + "/activity/hb/get";
// String url = activtyHost + "/activity/hb/get";
String url = activtyHost + "/aaw/hb/get";
Map<String,Object> parm = new HashMap<>();
parm.put("key",key);
parm.put("code","DuiBaHbase");
// parm.put("code","DuiBaHbase");
Response response = given().cookies(authorization.dafuwengLogin(4309)).params(parm).get(url);
// response.prettyPrint();
......@@ -48,14 +50,27 @@ public class HbaseService {
}
public Response getHBASEKey2(String key) {
String url = activtyHost + "/aaw/hb/get";
Map<String,Object> parm = new HashMap<>();
parm.put("key",key);
Response response = given().params(parm).get(url);
return response;
}
public void deleteHBASEKey(String key) {
String url = activtyHost + "/activity/hb/delete";
// String url = activtyHost + "/activity/hb/delete";
String url = activtyHost + "/aaw/hb/delete";
Map<String,Object> parm = new HashMap<>();
parm.put("key",key);
parm.put("code","DuiBaHbase");
// parm.put("code","DuiBaHbase");
Response response = given().cookies(authorization.dafuwengLogin(4309)).params(parm).get(url);
// response.prettyPrint();
......@@ -63,5 +78,40 @@ public class HbaseService {
}
public Response deleteHBASEKey2(String key) throws Exception {
String url = activtyHost + "/aaw/hb/delete";
Map<String,Object> parm = new HashMap<>();
parm.put("key",key);
Response response = given().params(parm).get(url);
// response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("data"), "删除完毕");
} catch (Exception e) {
throw new Exception("/aaw/hb/delete接口失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("/aaw/hb/delete接口失败,返回信息:" + response.asString());
}
return response;
}
public void updateHBASEKey(String key,String svalue,String lvalue) {
String url = activtyHost + "/aaw/hb/update";
Map<String,Object> parm = new HashMap<>();
parm.put("key",key);
if(!svalue.equals("")) {
parm.put("svalue", svalue);
}
if(!lvalue.equals("")) {
parm.put("lvalue", lvalue);
}
Response response = given().params(parm).get(url);
// response.prettyPrint();
// return response;
}
}
\ No newline at end of file
......@@ -26,7 +26,7 @@ public class Md5SignGen {
public static void genSignUrl(){
Random rand = new Random();
int randNum = rand.nextInt(100000);
CreditTool tool = new CreditTool("jlg88lyxz7siqtmr", "CjexurxQmvyYXt94K9Dqg5292dKMiFUWo22hEkKmu");
CreditTool tool = new CreditTool("jlg88lyxz7siqtmr", "1x0eap95f4xfi77uaptrnwh9ewzvlm");
// String url="https://home.m.duiba.com.cn/autoLogin/autologin?";
// String url="http://activity-pre.m.duiba.com.cn/aaw/api/notify?";
String url="http://activity.m.duibatest.com.cn/aaw/api/notify?";
......
package utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
/**
* Created by zhaoran on 2018/4/10.
......@@ -18,4 +21,48 @@ public class PublicMethod {
String date = df.format(new Date());// new Date()为获取当前系统时间,也可使用当前时间戳
return date;
}
/**
* 将时间转换为时间戳
*/
public static String dateToStamp(String s) throws ParseException {
String res;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = simpleDateFormat.parse(s);
long ts = date.getTime();
res = String.valueOf(ts);
return res;
}
/**
* 将时间戳转换为时间
*/
public static String stampToDate(String s){
String res;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long lt = new Long(s);
Date date = new Date(lt);
res = simpleDateFormat.format(date);
return res;
}
/**
* Date类型向前向后滚动固定时长
*
* @param date
* 调整前的时间对象
* @param i
* 需要滚动哪一个字段,写法: 年->Calendar.YEAR 月->Calendar.MONTH
* 日->Calendar.DATE 时->Calendar.HOUR_OF_DAY(24小时制)
* 分->Calendar.MINUTE 秒->Calendar.SECOND 毫秒->Calendar.MILLISECOND
* @param d
* 滚动多少,向前(以前)就用负数,向后(未来)就用正数
*/
public static Date DateRoll(Date date,int i,int d){
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(i, d);
date = calendar.getTime();
return date;
}
}
......@@ -7,12 +7,15 @@
*/
package utils;
import cn.com.duiba.credits.sdk.CreditTool;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* 〈〉
......@@ -47,4 +50,23 @@ public class TypeChangeUtil {
}
return para;
}
public static void main(String[] args) {
CreditTool tool = new CreditTool("jlg88lyxz7siqtmr", "1x0eap95f4xfi77uaptrnwh9ewzvlm");
String url="http://activity.m.duiba.com.cn/autoLogin/autologin?";
Map<String, String> params=new HashMap<>();
params.put("uid", "1");//中文
params.put("times","6");
params.put("validType","0");
params.put("bizid", UUID.randomUUID().toString().replace("-",""));
//params.put("credits","0");
params.put("redirect","http://activity.m.duiba.com.cn/hdtool/index?id=3212716");
params.put("actid","3212716");
params.put("addType","0");
params.put("timestamp",System.currentTimeMillis()+"");
String autologinUrl= tool.buildUrlWithSign(url,params);
// String result = HttpUtil.sendGet(autologinUrl);
System.out.println(autologinUrl);
}
}
\ No newline at end of file
......@@ -21,11 +21,11 @@ home.host = activity.m.duibatest.com.cn
manager.host = mng.duibatest.com.cn
trade.host = activity.m.duibatest.com.cn
//数据库配置
//\u6570\u636E\u5E93\u914D\u7F6E
db.name = duiba_test
db.password= svbP3KUw2PurAnBb2rbs3vohF
db.url = jdbc:mysql://rdswy2b9wy53044250u1o.mysql.rds.aliyuncs.com:3306/
db.driver= com.mysql.jdbc.Driver
db.driver= com.mysql.cj.jdbc.Driver
db.maxtotal = 6
//钉钉报告配置
......@@ -62,4 +62,9 @@ JenkinsTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess
ExchangeTest.project=普兑业务
ExchangeTest.names=panyuli
ExchangeTest.group=普兑业务-接口自动化
ExchangeTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_Report/suite1_test1_results.html
\ No newline at end of file
ExchangeTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_Report/suite1_test1_results.html
SeckillTest.project=秒杀业务
SeckillTest.names=qianwenjun
SeckillTest.group=秒杀业务-接口自动化
SeckillTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_Report/suite1_test1_results.html
\ No newline at end of file
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