Commit 0a0bf666 authored by chenjianfang's avatar chenjianfang

Merge branch 'develop' into hmx

parents 16d5128d efb8a4b4
...@@ -141,6 +141,9 @@ public class DingdingResult { ...@@ -141,6 +141,9 @@ public class DingdingResult {
return result; return result;
} }
public String getJob() throws UnsupportedEncodingException {
return getByRun(run,"job");
}
public String getByRun(String run,String type) throws UnsupportedEncodingException { public String getByRun(String run,String type) throws UnsupportedEncodingException {
run = run.substring(run.indexOf("_")+1, run.indexOf(".")); run = run.substring(run.indexOf("_")+1, run.indexOf("."));
run =this.env.getProperty(run+"."+type); run =this.env.getProperty(run+"."+type);
......
...@@ -22,7 +22,7 @@ public class DuibaBase extends AbstractTestNGSpringContextTestsDuiba { ...@@ -22,7 +22,7 @@ public class DuibaBase extends AbstractTestNGSpringContextTestsDuiba {
// @PostConstruct // @PostConstruct
@BeforeSuite @BeforeSuite
public final void setUp() { public final void setUp() {
logger.info("--------------------DuibaBase.setUp()"); logger.info("--------------------DuibaBase.setUp() Tests");
//只初始化一次 //只初始化一次
jdbc.initDataSource(); jdbc.initDataSource();
......
...@@ -15,8 +15,8 @@ public class DuibaBases extends AbstractTestNGSpringContextTestsDuiba { ...@@ -15,8 +15,8 @@ public class DuibaBases extends AbstractTestNGSpringContextTestsDuiba {
// @PostConstruct // @PostConstruct
@BeforeSuite @BeforeSuite
public void setUp() { public final void setUp() {
logger.info("--------------------DuibaBase.setUp()"); logger.info("--------------------DuibaBases.setUp() Test");
//只初始化一次 //只初始化一次
jdbc.initDataSource(); jdbc.initDataSource();
......
...@@ -8,9 +8,11 @@ import org.apache.http.client.params.ClientPNames; ...@@ -8,9 +8,11 @@ import org.apache.http.client.params.ClientPNames;
import org.apache.http.params.CoreConnectionPNames; import org.apache.http.params.CoreConnectionPNames;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.testng.annotations.Test;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
...@@ -19,8 +21,11 @@ import static io.restassured.RestAssured.given; ...@@ -19,8 +21,11 @@ import static io.restassured.RestAssured.given;
* Created by hanzhanli on 2017/11/9. * Created by hanzhanli on 2017/11/9.
*/ */
public class Postman { public class Postman {
static String dingdingUrl="https://shark.dui88.com/test/integration"; final static String dingdingUrl="https://shark.dui88.com/test/integration";
static String testPlatformUrl = "http://101.37.27.82:8080/insert"; final static String testPlatformUrl = "http://101.37.27.82:8080/insert";
final static String miriaUrl = "http://miria-aliyun.duibatest.com.cn/autoTest/finish";
final static String miriaUrlTesting = "http://miria-aliyun.duibatest.com.cn/autoTest/testing";
//dingdingUrl="http://www.json.cn/"; //dingdingUrl="http://www.json.cn/";
private static Logger logger = LogManager.getLogger(Postman.class); private static Logger logger = LogManager.getLogger(Postman.class);
public static void send2Dingding(Map result){ public static void send2Dingding(Map result){
...@@ -48,6 +53,20 @@ public class Postman { ...@@ -48,6 +53,20 @@ public class Postman {
Response response=given().contentType(ContentType.JSON).body(result).post(testPlatformUrl); Response response=given().contentType(ContentType.JSON).body(result).post(testPlatformUrl);
System.out.println("自动化数据收集平台响应数据:"+response.asString()); System.out.println("自动化数据收集平台响应数据:"+response.asString());
} }
public static void sendFinish(Map result){
Response response=given().params(result).get(miriaUrl);
System.out.println("jobName:"+result.get("jobName"));
System.out.println("miriaUrl:"+miriaUrl);
System.out.println("miria响应结果:"+response.asString());
}
public static void sendTesting(Map result){
Response response=given().params(result).get(miriaUrlTesting);
System.out.println("jobName:"+result.get("jobName"));
System.out.println("miriaUrl:"+miriaUrlTesting);
System.out.println("miria响应结果:"+response.asString());
}
public static Boolean getName(){ public static Boolean getName(){
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
Date date = new Date(); Date date = new Date();
...@@ -58,4 +77,10 @@ public class Postman { ...@@ -58,4 +77,10 @@ public class Postman {
if(week_num%2==0)return true; if(week_num%2==0)return true;
else return false; else return false;
} }
public static void main(String[] args) {
Map<String,String> map = new HashMap<>();
map.put("jobName","duibaSign_interface");
sendFinish(map);
}
} }
package base; package base;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.Environment;
import org.testng.*; import org.testng.*;
/** /**
...@@ -12,6 +18,12 @@ import org.testng.*; ...@@ -12,6 +18,12 @@ import org.testng.*;
public class TestListener implements ITestListener { public class TestListener implements ITestListener {
public DuibaLog logger = DuibaLog.getLogger(); public DuibaLog logger = DuibaLog.getLogger();
String run = System.getProperty("run");
ApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
Environment env=context.getBean(Environment.class);
public TestListener() throws UnsupportedEncodingException {
}
public void onFinish(ITestContext context) { public void onFinish(ITestContext context) {
Iterator<ITestResult> listOfFailedTests = context.getFailedTests().getAllResults().iterator(); Iterator<ITestResult> listOfFailedTests = context.getFailedTests().getAllResults().iterator();
while (listOfFailedTests.hasNext()) { while (listOfFailedTests.hasNext()) {
...@@ -65,16 +77,26 @@ public class TestListener implements ITestListener { ...@@ -65,16 +77,26 @@ public class TestListener implements ITestListener {
// TODO Auto-generated method stub // TODO Auto-generated method stub
logger.info("onStart~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); logger.info("onStart~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
//服务检查
boolean ServiceDoctor=Boolean.parseBoolean(System.getProperty("ServiceDoctor")); boolean ServiceDoctor=Boolean.parseBoolean(System.getProperty("ServiceDoctor"));
if(ServiceDoctor){ if(ServiceDoctor){
try{ try{
serviceDoctor(); serviceDoctor();
}catch (SkipException e){ }catch (SkipException e){
SFExpress.skip = context.getAllTestMethods().length; SFExpress.skip = context.getAllTestMethods().length;
// throw e;
} }
} }
//运行开始,触发互斥功能,用于定时任务
Map<String,String> mapJob = new HashMap<>();
try {
mapJob.put("jobName",getJob());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Postman.sendTesting(mapJob);
} }
public void serviceDoctor(){ public void serviceDoctor(){
logger.info("duiba-server开始检测"); logger.info("duiba-server开始检测");
...@@ -107,4 +129,13 @@ public class TestListener implements ITestListener { ...@@ -107,4 +129,13 @@ public class TestListener implements ITestListener {
res = simpleDateFormat.format(date); res = simpleDateFormat.format(date);
return res; return res;
} }
public String getJob() throws UnsupportedEncodingException {
return getByRun(run,"job");
}
public String getByRun(String run,String type) throws UnsupportedEncodingException {
run = run.substring(run.indexOf("_")+1, run.indexOf("."));
run =this.env.getProperty(run+"."+type);
return new String(run.getBytes("ISO-8859-1"), "UTF-8");//ISO-8859-1
}
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import org.testng.xml.XmlSuite; ...@@ -7,6 +7,7 @@ import org.testng.xml.XmlSuite;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -74,8 +75,16 @@ public class TestReport implements IReporter{ ...@@ -74,8 +75,16 @@ public class TestReport implements IReporter{
e.printStackTrace(); e.printStackTrace();
} }
map.put("failCase",failCase); map.put("failCase",failCase);
// logger.in fo("gson.toJson(ddResult)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
System.out.println("测试结果通知信息:"+gson.toJson(map)); System.out.println("测试结果通知信息:"+gson.toJson(map));
//触发回调结束服务构建互斥
Map<String,String> mapJob = new HashMap<>();
try {
mapJob.put("jobName",ddResult.getJob());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Postman.sendFinish(mapJob);
//发送运行结果到自动化数据收集平台 //发送运行结果到自动化数据收集平台
if(sendPlatform) if(sendPlatform)
Postman.sendTestPlatform(map); Postman.sendTestPlatform(map);
...@@ -84,9 +93,9 @@ public class TestReport implements IReporter{ ...@@ -84,9 +93,9 @@ public class TestReport implements IReporter{
if(!noticePerson){ if(!noticePerson){
map.put("names",new ArrayList<>()); map.put("names",new ArrayList<>());
} }
// logger.info("noticeDD:"+noticeDD);
Postman.send2Dingding(map); Postman.send2Dingding(map);
} }
} }
} }
...@@ -168,7 +168,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase { ...@@ -168,7 +168,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase {
String orderId = openResponse.jsonPath().getString("orderId"); String orderId = openResponse.jsonPath().getString("orderId");
Response statusResponse = newActivityService.getOrderStatus31(orderId,uid); Response statusResponse = newActivityService.getOrderStatus31(orderId,uid);
// logger.info("开奖结果如下1:"); // logger.info("开奖结果如下1:");
// statusResponse.prettyPrint(); statusResponse.prettyPrint();
String playResult = String.valueOf(statusResponse.jsonPath().getString("result")); String playResult = String.valueOf(statusResponse.jsonPath().getString("result"));
int i = 8; int i = 8;
while (i > 0 && (playResult.equals("0"))) { while (i > 0 && (playResult.equals("0"))) {
...@@ -177,7 +177,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase { ...@@ -177,7 +177,7 @@ public class 集卡_出奖方式测试_DuibaTest extends DuibaTestBase {
playResult = String.valueOf(statusResponse.jsonPath().getString("result")); playResult = String.valueOf(statusResponse.jsonPath().getString("result"));
i--; i--;
// logger.info("开奖结果如下2:"); // logger.info("开奖结果如下2:");
// statusResponse.prettyPrint(); statusResponse.prettyPrint();
} }
return statusResponse; return statusResponse;
......
...@@ -122,7 +122,7 @@ public class 集卡规则_中奖属性配置_DuibaTest extends DuibaTestBase { ...@@ -122,7 +122,7 @@ public class 集卡规则_中奖属性配置_DuibaTest extends DuibaTestBase {
//校验修改内容 //校验修改内容
Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config where id =?",newId); Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config where id =?",newId);
Assert.assertEquals(selectResult.get("deleted").toString(),"true","删除中奖条件失败"); Assert.assertEquals(selectResult.get("deleted").toString(),"1","删除中奖条件失败");
logger.info("校验删除属性配置成功"); logger.info("校验删除属性配置成功");
} }
......
...@@ -299,7 +299,7 @@ public class 集卡规则_中奖配置测试_DuibaTest extends DuibaTestBase { ...@@ -299,7 +299,7 @@ public class 集卡规则_中奖配置测试_DuibaTest extends DuibaTestBase {
//校验修改内容 //校验修改内容
Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config where id =?",newId); Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config where id =?",newId);
Assert.assertEquals(selectResult.get("deleted").toString(),"true","删除中奖条件失败"); Assert.assertEquals(selectResult.get("deleted").toString(),"1","删除中奖条件失败");
} }
......
...@@ -158,7 +158,7 @@ public class 集卡规则_助力规则配置测试_DuibaTest extends DuibaTestBa ...@@ -158,7 +158,7 @@ public class 集卡规则_助力规则配置测试_DuibaTest extends DuibaTestBa
//校验修改内容 //校验修改内容
Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config_goods_rules where id =?",newGoodsRuleId); Map<String,Object> selectResult = jdbc.findSimpleResult("select * from act_com_conf.tb_clcard_config_goods_rules where id =?",newGoodsRuleId);
Assert.assertEquals(selectResult.get("deleted").toString(),"true","删除中奖条件失败"); Assert.assertEquals(selectResult.get("deleted").toString(),"1","删除中奖条件失败");
logger.info("删除集卡助力规则成功"); logger.info("删除集卡助力规则成功");
} }
......
...@@ -267,7 +267,6 @@ public class 创建自有活动_DuibaTest extends DuibaTestBase { ...@@ -267,7 +267,6 @@ public class 创建自有活动_DuibaTest extends DuibaTestBase {
} }
//删除自有活动 //删除自有活动
public void 删除自有活动(String title) throws Exception{ public void 删除自有活动(String title) throws Exception{
//开发者删除自有活动 //开发者删除自有活动
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases; import base.DuibaBases;
import http.service.app.SupplierExchangeTemplateService; import http.service.app.SupplierExchangeTemplateService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -11,7 +12,7 @@ import java.util.Map; ...@@ -11,7 +12,7 @@ import java.util.Map;
* Created by zhaoran on 2018/11/15 * Created by zhaoran on 2018/11/15
* Remark: 校验Q币、虚拟商品兑换模板 * Remark: 校验Q币、虚拟商品兑换模板
*/ */
public class CheckTemplet extends DuibaBases { public class CheckTemplet extends DuibaBase {
@Autowired @Autowired
SupplierExchangeTemplateService supplierExchangeTemplateService ; SupplierExchangeTemplateService supplierExchangeTemplateService ;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
import http.service.app.CouponExchangeService; import http.service.app.CouponExchangeService;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
import http.service.app.*; import http.service.app.*;
...@@ -45,9 +47,9 @@ public class ObjectExchange_ExchangeTest extends CheckTemplet { ...@@ -45,9 +47,9 @@ public class ObjectExchange_ExchangeTest extends CheckTemplet {
@BeforeClass @BeforeClass
public void before() { public void before() {
managerService.update(uid,"5555555");
// jdbc = MysqlUtils.mysqlDuiba("orders_consumer"); // jdbc = MysqlUtils.mysqlDuiba("orders_consumer");
try { try {
managerService.update(uid,"5555555");
jdbc.update("delete from orders_consumer.orders_0614 where consumer_id = 100011622 and biz_params = 'DUIBA_SELF'", null); jdbc.update("delete from orders_consumer.orders_0614 where consumer_id = 100011622 and biz_params = 'DUIBA_SELF'", null);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
import http.service.app.*; import http.service.app.*;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import base.DuibaLog; import base.DuibaLog;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import utils.RedisUtil; import utils.RedisUtil;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
import http.service.app.AlipayExchangeService; import http.service.app.AlipayExchangeService;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
import http.service.app.CouponExchangeService; import http.service.app.CouponExchangeService;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Authorization; import http.service.Authorization;
import http.service.app.AppPlatformCouponService; import http.service.app.AppPlatformCouponService;
import http.service.app.CrecordService; import http.service.app.CrecordService;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import base.DuibaLog; import base.DuibaLog;
import http.service.Activity.ManagerService; import http.service.Activity.ManagerService;
import http.service.Authorization; import http.service.Authorization;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Authorization; import http.service.Authorization;
import http.service.Manager.ADeveloperService; import http.service.Manager.ADeveloperService;
import http.service.app.AlipayExchangeService; import http.service.app.AlipayExchangeService;
......
package http.cases.ExchangeTest; package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import base.DuibaLog; import base.DuibaLog;
import base.DuibaTestBase; import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
......
...@@ -139,8 +139,9 @@ public class 游戏_开大奖测试_AccessTest extends DuibaTestBase { ...@@ -139,8 +139,9 @@ public class 游戏_开大奖测试_AccessTest extends DuibaTestBase {
Response openWinnResponse = newGameService.openWinning(gameId); Response openWinnResponse = newGameService.openWinning(gameId);
openWinnResponse.prettyPrint(); openWinnResponse.prettyPrint();
Thread.sleep(3000); Thread.sleep(8000);
List<Map<String,Object>> orders = jdbc.findModeResult("select * from ngame.ngame_orders where duiba_ngame_id = ?\n",gameId); List<Map<String,Object>> orders = jdbc.findModeResult("select * from ngame.ngame_orders where duiba_ngame_id = ?\n",gameId);
logger.info("orders信息为"+JSONObject.toJSONString(orders));
for(int i=0;i<orders.size();i++){ for(int i=0;i<orders.size();i++){
if (orders.get(i).get("consumer_id").toString().equals(user1.getConsumerId())){ if (orders.get(i).get("consumer_id").toString().equals(user1.getConsumerId())){
Assert.assertEquals(orders.get(i).get("prize_id").toString(),optionId1,"第一名发奖奖项id校验失败"); Assert.assertEquals(orders.get(i).get("prize_id").toString(),optionId1,"第一名发奖奖项id校验失败");
......
...@@ -99,7 +99,7 @@ public class 游戏_新建无大奖游戏_AccessTest extends DuibaTestBase { ...@@ -99,7 +99,7 @@ public class 游戏_新建无大奖游戏_AccessTest extends DuibaTestBase {
"[{\"type\":\"phonebill\",\"title\":\"小奖1\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/shake/phone.png\",\"show\":true,\"description\":\"\",\"guarantee\":true,\"scoreArea\":\"0,100\",\"optionLimitCount\":\"\",\"limitDays\":\"\",\"limitTimeType\":\"\",\"rate\":5000,\"appItemId\":1,\"value\":\"1\",\"limit\":null,\"low\":null,\"remaind\":\"10000\",\"oldRemaind\":null,\"isMutliPrizeLimit\":false,\"autoOpen\":true}," + "[{\"type\":\"phonebill\",\"title\":\"小奖1\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/shake/phone.png\",\"show\":true,\"description\":\"\",\"guarantee\":true,\"scoreArea\":\"0,100\",\"optionLimitCount\":\"\",\"limitDays\":\"\",\"limitTimeType\":\"\",\"rate\":5000,\"appItemId\":1,\"value\":\"1\",\"limit\":null,\"low\":null,\"remaind\":\"10000\",\"oldRemaind\":null,\"isMutliPrizeLimit\":false,\"autoOpen\":true}," +
"{\"type\":\"phonebill\",\"title\":\"小奖2\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/shake/phone.png\",\"show\":true,\"description\":\"\",\"guarantee\":true,\"scoreArea\":\"101,200\",\"optionLimitCount\":\"\",\"limitDays\":\"\",\"limitTimeType\":\"\",\"rate\":8000,\"appItemId\":1,\"value\":\"2\",\"limit\":null,\"low\":null,\"remaind\":\"1000\",\"oldRemaind\":null,\"isMutliPrizeLimit\":false,\"autoOpen\":true}]"); "{\"type\":\"phonebill\",\"title\":\"小奖2\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/shake/phone.png\",\"show\":true,\"description\":\"\",\"guarantee\":true,\"scoreArea\":\"101,200\",\"optionLimitCount\":\"\",\"limitDays\":\"\",\"limitTimeType\":\"\",\"rate\":8000,\"appItemId\":1,\"value\":\"2\",\"limit\":null,\"low\":null,\"remaind\":\"1000\",\"oldRemaind\":null,\"isMutliPrizeLimit\":false,\"autoOpen\":true}]");
Response response = given().contentType("application/x-www-form-urlencoded; charset=UTF-8").cookies(authorization.ssoLogin()).params(params).post("https://"+ url); Response response = given().contentType("application/x-www-form-urlencoded; charset=UTF-8").cookies(authorization.ssoLogin()).params(params).post("http://"+ url);
response.prettyPrint(); response.prettyPrint();
Thread.sleep(3000); Thread.sleep(3000);
...@@ -133,7 +133,7 @@ public class 游戏_新建无大奖游戏_AccessTest extends DuibaTestBase { ...@@ -133,7 +133,7 @@ public class 游戏_新建无大奖游戏_AccessTest extends DuibaTestBase {
map1.put("id",gameIds.get(z)); map1.put("id",gameIds.get(z));
map1.put("status","1"); map1.put("status","1");
Response response1 = given().cookies(authorization.ssoLogin()).contentType("application/x-www-form-urlencoded; charset=UTF-8").params(map1).post("https://"+url); Response response1 = given().cookies(authorization.ssoLogin()).contentType("application/x-www-form-urlencoded; charset=UTF-8").params(map1).post("http://"+url);
Map<String,Object> result = jdbc.findSimpleResult("select * from ngame.duiba_ngame where id = ?\n",gameIds.get(z)); Map<String,Object> result = jdbc.findSimpleResult("select * from ngame.duiba_ngame where id = ?\n",gameIds.get(z));
Assert.assertEquals(result.get("game_status").toString(),"1","校验状态修改失败"); Assert.assertEquals(result.get("game_status").toString(),"1","校验状态修改失败");
}else if (z==1){ }else if (z==1){
......
package http.cases.SaasDeveloperTest; package http.cases.GoodsAndTradeTest;
import base.Config; import base.Config;
import base.DuibaTestBase; import base.DuibaTestBase;
...@@ -15,7 +15,7 @@ import org.testng.annotations.Test; ...@@ -15,7 +15,7 @@ import org.testng.annotations.Test;
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 修改兑吧商品 extends DuibaTestBase { public class 修改兑吧商品_ExchangeTest extends DuibaTestBase {
@Autowired @Autowired
DoUpdateAppItemService doUpdateAppItemService; DoUpdateAppItemService doUpdateAppItemService;
......
package http.cases.SaasDeveloperTest; package http.cases.GoodsAndTradeTest;
import base.Config; import base.Config;
import utils.PublicMethod; import utils.PublicMethod;
...@@ -19,7 +19,7 @@ import org.testng.annotations.Test; ...@@ -19,7 +19,7 @@ import org.testng.annotations.Test;
*/ */
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 商品管理操作_DuibaTest extends AbstractTestNGSpringContextTests { public class 商品管理操作_ExchangeTest extends AbstractTestNGSpringContextTests {
@Autowired @Autowired
SpglczService czService; SpglczService czService;
@Autowired @Autowired
......
package http.cases.SaasDeveloperTest; package http.cases.GoodsAndTradeTest;
import base.Config; import base.Config;
import base.DuibaTestBase; import base.DuibaTestBase;
...@@ -21,7 +21,7 @@ import java.util.Map; ...@@ -21,7 +21,7 @@ import java.util.Map;
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 异常订单测试 extends DuibaTestBase { public class 异常订单测试_ExchangeTest extends DuibaTestBase {
@Autowired @Autowired
private MobileService mobileService; private MobileService mobileService;
...@@ -66,9 +66,9 @@ public class 异常订单测试 extends DuibaTestBase { ...@@ -66,9 +66,9 @@ public class 异常订单测试 extends DuibaTestBase {
@Test(description = "实物兑换无库存") @Test(description = "实物兑换无库存")
public void 无库存() throws Exception { public void 无库存() throws Exception {
Response response = mobileService.detail(authorization.dafuwengLogin(3661), "31051");//uid3661 Response response = mobileService.detail(authorization.dafuwengLogin(4819), "31051");//uid3661
// response.prettyPrint(); // response.prettyPrint();
Map<String, String> map = authorization.dafuwengLogin(3661, true); Map<String, String> map = authorization.dafuwengLogin(4819);
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "活动详情页请求异常"); Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "活动详情页请求异常");
//实物兑换 //实物兑换
Response response2 = couponExchangeService.objectExchange2(map, "179139", "null", "null", "z9sydmcs", "null"); Response response2 = couponExchangeService.objectExchange2(map, "179139", "null", "null", "z9sydmcs", "null");
......
package http.cases.SaasDeveloperTest; package http.cases.GoodsAndTradeTest;
import base.Config; import base.Config;
...@@ -16,7 +16,7 @@ import org.testng.annotations.Test; ...@@ -16,7 +16,7 @@ import org.testng.annotations.Test;
* 自有优惠券添加、修改、删除、上架或下架、查询操作 * 自有优惠券添加、修改、删除、上架或下架、查询操作
*/ */
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 自有优惠券测试_DuibaTest extends AbstractTestNGSpringContextTests { public class 自有优惠券测试_ExchangeTest extends AbstractTestNGSpringContextTests {
@Autowired @Autowired
DeveloperObjectService developerObjectService; DeveloperObjectService developerObjectService;
@Autowired @Autowired
......
package http.cases.SaasDeveloperTest; package http.cases.GoodsAndTradeTest;
import base.Config; import base.Config;
import utils.PublicMethod; import utils.PublicMethod;
...@@ -17,7 +17,7 @@ import org.testng.annotations.Test; ...@@ -17,7 +17,7 @@ import org.testng.annotations.Test;
* @author wangxiaoshuang * @author wangxiaoshuang
*/ */
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 自有实物测试_DuibaTest extends AbstractTestNGSpringContextTests { public class 自有实物测试_ExchangeTest extends AbstractTestNGSpringContextTests {
@Autowired @Autowired
DeveloperObjectService objectService; DeveloperObjectService objectService;
......
package http.cases.SaasDeveloperTest; package http.cases.GoodsAndTradeTest;
import base.Config; import base.Config;
import utils.PublicMethod; import utils.PublicMethod;
...@@ -15,7 +15,7 @@ import org.testng.annotations.Test; ...@@ -15,7 +15,7 @@ import org.testng.annotations.Test;
* 自有虚拟商品添加、修改、删除、上架或下架、查询操作 * 自有虚拟商品添加、修改、删除、上架或下架、查询操作
*/ */
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 自有虚拟商品测试_DuibaTest extends AbstractTestNGSpringContextTests { public class 自有虚拟商品测试_ExchangeTest extends AbstractTestNGSpringContextTests {
@Autowired @Autowired
DeveloperVirtualService developerVirtualService; DeveloperVirtualService developerVirtualService;
@Autowired @Autowired
......
...@@ -152,7 +152,11 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase { ...@@ -152,7 +152,11 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
//获取未登录场景cookie //获取未登录场景cookie
Response responses = authorization.autoLogin(); Response responses = authorization.autoLogin();
//进行接口测试传参 //进行接口测试传参
Response response = newActivityService.doJoin(responses.getDetailedCookies(),data.get("token"),data.get("activityId")); Map<String,String> map = responses.getCookies();
logger.info("cookies:"+map.toString());
if(responses.getDetailedCookies()==null)logger.info("cookies = = null");
Response response = newActivityService.doJoinMap(map,data.get("token"),data.get("activityId"));
// Response response = newActivityService.doJoin(responses.getDetailedCookies(),data.get("token"),data.get("activityId"));
response.prettyPrint(); response.prettyPrint();
String success = String.valueOf(response.jsonPath().getString("success")); String success = String.valueOf(response.jsonPath().getString("success"));
//根据case选择校验项 //根据case选择校验项
...@@ -180,6 +184,10 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase { ...@@ -180,6 +184,10 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
Assert.assertTrue(response.jsonPath().getString("lottery.link").contains("/activity/takePrizeNew?recordId=")); Assert.assertTrue(response.jsonPath().getString("lottery.link").contains("/activity/takePrizeNew?recordId="));
Assert.assertEquals(response.jsonPath().getString("lottery.id"), "11628", "校验id失败"); Assert.assertEquals(response.jsonPath().getString("lottery.id"), "11628", "校验id失败");
logger.info("未登录状态下有免费次数抽奖校验:title,link,id成功"); logger.info("未登录状态下有免费次数抽奖校验:title,link,id成功");
response = newActivityService.login(map,"2239.3.3.0");
Assert.assertEquals(response.jsonPath().getString("success"),"true","登录跳转接口访问失败!");
} }
} }
......
...@@ -11,6 +11,7 @@ import base.DuibaLog; ...@@ -11,6 +11,7 @@ import base.DuibaLog;
import base.DuibaTestBase; import base.DuibaTestBase;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.model.CollectGoodsInfo; import http.model.CollectGoodsInfo;
import http.service.Activity.NewCollectActivityService; import http.service.Activity.NewCollectActivityService;
import http.service.Manager.EditManagerInfoService; import http.service.Manager.EditManagerInfoService;
...@@ -18,6 +19,7 @@ import io.restassured.response.Response; ...@@ -18,6 +19,7 @@ import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import utils.GetCookieUtil;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -32,6 +34,7 @@ import static io.restassured.RestAssured.given; ...@@ -32,6 +34,7 @@ import static io.restassured.RestAssured.given;
* @create 2018/10/27 * @create 2018/10/27
* @since 1.0.0 * @since 1.0.0
*/ */
//3个case
public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase { public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase {
...@@ -46,7 +49,7 @@ public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase { ...@@ -46,7 +49,7 @@ public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase {
@Test @Test
public void 助力_发集卡() throws Exception{ public void 助力_发集卡() throws Exception{
//助力规则 //助力规则git
int userId = 3934; int userId = 3934;
String consumerId = "100092114"; String consumerId = "100092114";
String collectRuleId = "4795"; String collectRuleId = "4795";
...@@ -241,15 +244,11 @@ public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase { ...@@ -241,15 +244,11 @@ public class 新集卡_助力发集卡_DuibaTest extends DuibaTestBase {
Response response = editManagerInfoService.createUser("新用户助力",appId); Response response = editManagerInfoService.createUser("新用户助力",appId);
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '新用户助力' and app_id = ?\n",appId); Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '新用户助力' and app_id = ?\n",appId);
String uid = user.get("id").toString(); String uid = user.get("id").toString();
String url = "http://47.97.214.108/user/loginDuiba?uid=" + uid; String url = GetCookieUtil.genUrl(uid,"2wGQc3MZaQsqYFWcX4gguya5PnnS");
Response login = given().get(url); JSONObject cookie = GetCookieUtil.getConsumerIdFromCookie(url);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = ?\n",uid,app_id);
String consumerId = consumer.get("id").toString();
Boolean res = jdbc.update("UPDATE new_consumer.consumer_0010 set addr_name = 'qwj' , addr_phone = '18143476563' ,addr_province = '浙江省' ,addr_city = '杭州市' " +
", addr_area = '西湖区' , addr_detail = '奖池花印' where partner_user_id = ? and app_id = ?\n",uid,app_id);
map.put("uid",uid); map.put("uid",uid);
map.put("consumerId",consumerId); map.put("consumerId",cookie.get("cid").toString());
logger.info("用户信息为,uid="+uid+"consumerId="+consumerId); logger.info("用户信息为,uid="+uid+"consumerId="+cookie.get("cid").toString());
return map; return map;
} }
......
...@@ -30,6 +30,7 @@ import java.util.Map; ...@@ -30,6 +30,7 @@ import java.util.Map;
* @create 2018/10/17 * @create 2018/10/17
* @since 1.0.0 * @since 1.0.0
*/ */
//5个case
public class 新集卡_开奖异常_DuibaTest extends DuibaTestBase { public class 新集卡_开奖异常_DuibaTest extends DuibaTestBase {
......
...@@ -35,6 +35,7 @@ import java.util.Map; ...@@ -35,6 +35,7 @@ import java.util.Map;
* @create 2018/10/15 * @create 2018/10/15
* @since 1.0.0 * @since 1.0.0
*/ */
//16个case
public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase { public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
@Autowired @Autowired
......
...@@ -11,6 +11,7 @@ package http.cases.PkTest; ...@@ -11,6 +11,7 @@ package http.cases.PkTest;
import base.DuibaLog; import base.DuibaLog;
import base.DuibaTestBase; import base.DuibaTestBase;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.model.BetMobileVo; import http.model.BetMobileVo;
import http.service.Activity.PkService; import http.service.Activity.PkService;
import io.restassured.response.Response; import io.restassured.response.Response;
...@@ -61,8 +62,11 @@ public class pk_列表测试_AccessTest extends DuibaTestBase { ...@@ -61,8 +62,11 @@ public class pk_列表测试_AccessTest extends DuibaTestBase {
logger.info("未参加过押注用户的列表数据校验成功,unbetList的信息为"+ JSON.toJSONString(unbetList)); logger.info("未参加过押注用户的列表数据校验成功,unbetList的信息为"+ JSON.toJSONString(unbetList));
Response response_uid_18816 = pkService.getBetList(uid_18816); Response response_uid_18816 = pkService.getBetList(uid_18816);
logger.info("response_uid_18816"+ JSONObject.toJSONString(response_uid_18816.prettyPrint()));
List<BetMobileVo> betedList_uid_18816 = response_uid_18816.jsonPath().getList("data.betedList",BetMobileVo.class); List<BetMobileVo> betedList_uid_18816 = response_uid_18816.jsonPath().getList("data.betedList",BetMobileVo.class);
logger.info("betedList_uid_18816的信息为"+ JSONObject.toJSONString(betedList_uid_18816));
List<BetMobileVo> unbetList_uid_18816 = response_uid_18816.jsonPath().getList("data.unbetList",BetMobileVo.class); List<BetMobileVo> unbetList_uid_18816 = response_uid_18816.jsonPath().getList("data.unbetList",BetMobileVo.class);
logger.info("unbetList_uid_188166的信息为"+ JSONObject.toJSONString(unbetList_uid_18816));
Assert.assertEquals(String.valueOf(unbetList_uid_18816.size()),"0","已投注的活动为0校验失败"); Assert.assertEquals(String.valueOf(unbetList_uid_18816.size()),"0","已投注的活动为0校验失败");
Assert.assertEquals(String.valueOf(betedList_uid_18816.size()),"0","未投注的活动为0校验失败"); Assert.assertEquals(String.valueOf(betedList_uid_18816.size()),"0","未投注的活动为0校验失败");
logger.info("没有添加pk楼层,用户的列表数据校验成功,均为空,betedList_uid_18816="+ JSON.toJSONString(betedList_uid_18816)+"\nunbetList_uid_18816="+ JSON.toJSONString(unbetList_uid_18816)); logger.info("没有添加pk楼层,用户的列表数据校验成功,均为空,betedList_uid_18816="+ JSON.toJSONString(betedList_uid_18816)+"\nunbetList_uid_18816="+ JSON.toJSONString(unbetList_uid_18816));
......
/**
* Copyright (C), 2015-2018
* FileName: pk_开奖_瓜分红包测试
* Author: qianwenjun
* Date: 2018/8/9 20:13
* Description:
*/
package http.cases.PkTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.model.BetMobileVo;
import http.service.Activity.PkService;
import http.service.Manager.PkActivityService;
import io.restassured.response.Response;
import org.joda.time.format.DateTimeFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import utils.MatcherString;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.DateTime;
import java.util.ArrayList;
import java.util.List;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_开奖_瓜分红包测试 extends DuibaTestBase {
@Autowired
PkService pkService;
@Autowired
PkActivityService pkActivityService;
private static DuibaLog logger = DuibaLog.getLogger();
private String groupId = "7";
private Integer user01 = 3445;
private Integer user02 = 3446;
private Integer user03 = 3447;
private Integer user04 = 3448;
private String newBetId = "";
private List<String> optionsIds = new ArrayList<>();
@BeforeMethod
public void beforeMethod() {
try {
createPk("2","2020-08-12 00:00:00",groupId);
}catch (Exception e){
e.printStackTrace();
}
}
@Test
public void 瓜分红包_两个选项_押注人数相同_开奖测试() throws Exception{
Response betList = pkService.getBetList(3445);
List<BetMobileVo> betMobileVoList = betList.jsonPath().getList("data.unbetList",BetMobileVo.class);
for (BetMobileVo bet:betMobileVoList){
if (bet.getBetConfig().getId().equals(newBetId)){
for (int i=0;i<bet.getOptions().size();i++){
optionsIds.add(bet.getOptions().get(i).getOptionId());
}
}
}
//押注第一个选项:user01,user02
//押注第二个选项:user03,user04
Response res1 = pkService.doJoin(user01,newBetId,optionsIds.get(0));
Response res2 = pkService.doJoin(user02,newBetId,optionsIds.get(0));
Response res3 = pkService.doJoin(user03,newBetId,optionsIds.get(1));
Response res4 = pkService.doJoin(user04,newBetId,optionsIds.get(1));
//修改开奖时间
this.modifyOpenPrizeTime();
int i=8;
}
public void createPk(String bounsType,String endTime,String groupId) throws Exception {
Response betResponse = pkActivityService.bet(bounsType,endTime);
String betId = MatcherString.getString(betResponse.asString(),"\"data\": (\\w*)",1);
newBetId = betId;
logger.info("newBetId的信息为"+newBetId);
Response betRelation = pkActivityService.betGroupRelation(betId,endTime,groupId);
Response modifyStatusResponse = pkActivityService.modifySatus(betId);
}
public String modifyOpenPrizeTime() throws Exception{
DateTime time1 = new DateTime();
DateTime endTime = time1.minusMillis(10);
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
String endTimeStr = format.print(endTime.getMillis()).toString();
logger.info("\ntime1="+ format.print(time1.getMillis())+"\n设置的开奖时间endTime="+ endTimeStr);
Boolean result1 = jdbc.update("update act_com_conf.tb_bet_config set end_time = ? where id = \"229\"\n",endTimeStr);
Boolean result2 = jdbc.update("update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = \"229\"\n",endTimeStr);
return endTimeStr;
}
public static void main(String[] args) {
DateTime time1 = DateTime.now();
DateTime time2 = time1.plusMinutes(1);
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
logger.info("\ntime1="+ format.print(time1.getMillis())+"\ntime2="+ format.print(time2.getMillis()));
logger.info("\nendTimeStr="+format.print(time1.getMillis()).toString());
}
}
\ No newline at end of file
...@@ -124,6 +124,44 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase { ...@@ -124,6 +124,44 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
} }
@Test
public void 创建pk活动_瓜分优惠券测试() {
try {
Response oldBetList = pkActivityService.getMngBetList();
String oldTotal = oldBetList.jsonPath().getString("data.params.total");
logger.info("创建之前的列表中条数为:"+oldTotal);
createPk("3");
Response newBetList = pkActivityService.getMngBetList();
String newTotal = newBetList.jsonPath().getString("data.params.total");
logger.info("创建之前的列表中条数为:"+oldTotal+"创建之后的列表中条数为:"+newTotal);
Assert.assertEquals(String.valueOf(Long.valueOf(newTotal)-1L),oldTotal,"新建之后列表获取数据校验失败");
List<BetMngVo> betList = newBetList.jsonPath().getList("data.page",BetMngVo.class);
logger.info("betIds"+JSON.toJSONString(betIds));
for (BetMngVo bet:betList){
if (bet.getId().equals(betIds.get("3"))){
logger.info("bet的信息为="+JSON.toJSONString(bet));
Assert.assertEquals(bet.getBetType(),"1","校验pk活动单选单次类型失败");
Assert.assertEquals(bet.getBonusType(),"3","校验pk活动瓜分类型失败");
Assert.assertEquals(bet.getBonusAmount(),"0.00","校验pk活动瓜分类型失败");
Assert.assertEquals(bet.getTitle(),"【自动化】新建pk活动-瓜分优惠券","校验pk活动名称失败");
Assert.assertEquals(bet.getConfigStatus(),"3","校验pk活动状态失败");
Assert.assertEquals(bet.getEndTime(),"2021-12-31 23:55","校验pk活动结束时间失败");
Assert.assertEquals(bet.getPluginId(),"12","校验插件id失败");
Assert.assertEquals(bet.getPrizeLimit(),"1000","校验奖品发放上限失败");
}else{
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Test @Test
public void 创建pk活动组_无投放渠道(){ public void 创建pk活动组_无投放渠道(){
...@@ -211,8 +249,8 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase { ...@@ -211,8 +249,8 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
public void tearDown() { public void tearDown() {
try { try {
Boolean result = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\")\n"); Boolean result = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\" OR title = \"【自动化】新建pk活动-瓜分红包\")\n");
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\"\n"); Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_config where title = \"【自动化】新建pk活动-瓜分经验\" OR title = \"【自动化】新建pk活动-瓜分红包\" OR title = \"【自动化】新建pk活动-瓜分优惠券\"\n");
Boolean result2 = jdbc.update("delete from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组')"); Boolean result2 = jdbc.update("delete from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组')");
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组'"); Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_act_group where title = '【勿动】新增pk组'");
...@@ -220,6 +258,10 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase { ...@@ -220,6 +258,10 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
Boolean result4 = jdbc.update("delete from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放')"); Boolean result4 = jdbc.update("delete from act_com_conf.tb_app_group_relation where group_id in (select id from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放')");
Boolean result5 = jdbc.update("delete from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放'"); Boolean result5 = jdbc.update("delete from act_com_conf.tb_bet_act_group where title = '【勿动】增pk组投放'");
Boolean result6 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title = '【自动化】新建pk活动-瓜分红包')");
Boolean result7 = jdbc.update("delete from act_com_conf.tb_bet_config where title = '【自动化】新建pk活动-瓜分红包'");
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -11,6 +11,7 @@ import base.DuibaLog; ...@@ -11,6 +11,7 @@ import base.DuibaLog;
import base.DuibaTestBase; import base.DuibaTestBase;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.service.Authorization; import http.service.Authorization;
import http.service.Manager.EditManagerInfoService; import http.service.Manager.EditManagerInfoService;
import http.service.app.SeckillService; import http.service.app.SeckillService;
...@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import utils.GetCookieUtil;
import utils.MatcherString; import utils.MatcherString;
import java.util.HashMap; import java.util.HashMap;
...@@ -178,12 +180,13 @@ public class 天天秒杀_秒杀活动兑换测试_SeckillTest extends DuibaTest ...@@ -178,12 +180,13 @@ public class 天天秒杀_秒杀活动兑换测试_SeckillTest extends DuibaTest
Map<String,String> map = new HashMap<>(); Map<String,String> map = new HashMap<>();
Response response = editManagerInfoService.createUser("qwj测试秒杀用户"); Response response = editManagerInfoService.createUser("qwj测试秒杀用户");
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = 'qwj测试秒杀用户' and app_id = '67'\n"); Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = 'qwj测试秒杀用户' and app_id = '67'\n");
String uid = user.get("id").toString(); String uid = user.get("id").toString();
String url = "http://47.97.214.108/user/loginDuiba?uid=" + uid; String url = GetCookieUtil.genUrl(uid,"3erv8LvBxKBSyuGK5i8FSGyYoFD1");
Response login = given().get(url); JSONObject cookie = GetCookieUtil.getConsumerIdFromCookie(url);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = '18816'\n",uid); String consumerId = cookie.get("cid").toString();
String consumerId = consumer.get("id").toString();
Boolean res = jdbc.update("UPDATE new_consumer.consumer_0010 set addr_name = 'qwj' , addr_phone = '18143476563' ,addr_province = '浙江省' ,addr_city = '杭州市' " + Boolean res = jdbc.update("UPDATE new_consumer.consumer_0010 set addr_name = 'qwj' , addr_phone = '18143476563' ,addr_province = '浙江省' ,addr_city = '杭州市' " +
", addr_area = '西湖区' , addr_detail = '奖池花印' where partner_user_id = ? and app_id = '18816'\n",uid); ", addr_area = '西湖区' , addr_detail = '奖池花印' where partner_user_id = ? and app_id = '18816'\n",uid);
map.put("uid",uid); map.put("uid",uid);
......
This diff is collapsed.
...@@ -61,13 +61,15 @@ public class 周期签到测试_signTest extends DuibaTestBase { ...@@ -61,13 +61,15 @@ public class 周期签到测试_signTest extends DuibaTestBase {
// } // }
@Test(description = "活动id:79,规则:周期2天,签到第3天循环第一天奖励,加一次抽奖机会,加10积分") //@Test(description = "活动id:79,规则:周期2天,签到第3天循环第一天奖励,加一次抽奖机会,加10积分")
public void 周期签到测试() throws Exception { public void 周期签到测试() throws Exception {
logger.info("Current Thread Id: " + Thread.currentThread().getId()); logger.info("Current Thread Id: " + Thread.currentThread().getId());
//补签前天,凑足连续签到2天 //补签前天,凑足连续签到2天
Response response_1 = this.resign("79",-2); Response response_1 = this.resign("79",-2);
Thread.sleep(1000);
Response response_2 = this.resign("79",-1); Response response_2 = this.resign("79",-1);
// response_2.prettyPrint(); response_1.prettyPrint();
response_2.prettyPrint();
//当日签到之前插件信息查询 //当日签到之前插件信息查询
Response response_plug = activityPlugDrawInfoService.getPrizeInfo(map,"1179"); Response response_plug = activityPlugDrawInfoService.getPrizeInfo(map,"1179");
...@@ -97,6 +99,7 @@ public class 周期签到测试_signTest extends DuibaTestBase { ...@@ -97,6 +99,7 @@ public class 周期签到测试_signTest extends DuibaTestBase {
String lastDays = response.jsonPath().getString("signInfoVO.lastDays");//连续签到天数 String lastDays = response.jsonPath().getString("signInfoVO.lastDays");//连续签到天数
String todaySigned = response.jsonPath().getString("signInfoVO.todaySigned"); //今日是否签到 String todaySigned = response.jsonPath().getString("signInfoVO.todaySigned"); //今日是否签到
response.prettyPrint();
Assert.assertEquals(acmDay,"2","历史累积签到次数不正确"); Assert.assertEquals(acmDay,"2","历史累积签到次数不正确");
Assert.assertEquals(acmDays,"2","周期内累计签到天数不正确"); Assert.assertEquals(acmDays,"2","周期内累计签到天数不正确");
Assert.assertEquals(activityCount,"1","今日奖励抽奖次数不正确"); Assert.assertEquals(activityCount,"1","今日奖励抽奖次数不正确");
......
package http.cases.SaasDeveloperTest; package http.cases.SignTest;
import base.Config; import base.Config;
import http.service.Saas.SignService; import http.service.Saas.SignService;
...@@ -16,7 +16,7 @@ import org.testng.annotations.Test; ...@@ -16,7 +16,7 @@ import org.testng.annotations.Test;
@ContextConfiguration(classes = Config.class) @ContextConfiguration(classes = Config.class)
public class 签到管理_DuibaTest extends AbstractTestNGSpringContextTests { public class 开发者签到管理_signTest extends AbstractTestNGSpringContextTests {
@Autowired @Autowired
SignService signService; SignService signService;
......
...@@ -265,6 +265,7 @@ public class 补签测试_signTest extends DuibaTestBase { ...@@ -265,6 +265,7 @@ public class 补签测试_signTest extends DuibaTestBase {
map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}"); map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}");
map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("fullSignReward", "{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("fullSignReward", "{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("operatingPositions","[]"); map.put("operatingPositions","[]");
logger.info("请求configEdit接口"); logger.info("请求configEdit接口");
...@@ -318,6 +319,7 @@ public class 补签测试_signTest extends DuibaTestBase { ...@@ -318,6 +319,7 @@ public class 补签测试_signTest extends DuibaTestBase {
map.put("cirReward", "{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}"); map.put("cirReward", "{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}");
map.put("acmReward", "{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("acmReward", "{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("firstSignReward", "{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("firstSignReward", "{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("operatingPositions","[]"); map.put("operatingPositions","[]");
logger.info("请求configEdit接口"); logger.info("请求configEdit接口");
...@@ -366,6 +368,7 @@ public class 补签测试_signTest extends DuibaTestBase { ...@@ -366,6 +368,7 @@ public class 补签测试_signTest extends DuibaTestBase {
map.put("cirReward", "{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}"); map.put("cirReward", "{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}");
map.put("acmReward", "{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("acmReward", "{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("firstSignReward", "{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("firstSignReward", "{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("operatingPositions","[]"); map.put("operatingPositions","[]");
logger.info("请求configEdit接口"); logger.info("请求configEdit接口");
......
...@@ -142,7 +142,7 @@ public class 种红包新用户_AccessTest extends DuibaTestBase{ ...@@ -142,7 +142,7 @@ public class 种红包新用户_AccessTest extends DuibaTestBase{
Response response = editManagerInfoService.createUser("种红包新用户","68"); Response response = editManagerInfoService.createUser("种红包新用户","68");
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '种红包新用户' and app_id = '68'"); Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '种红包新用户' and app_id = '68'");
uid = Integer.valueOf(user.get("id").toString()); uid = Integer.valueOf(user.get("id").toString());
String url = "http://47.97.214.108/user/loginDuiba?uid=" + uid; String url = "http://dafuweng.duibatest.com.cn/user/loginDuiba?uid=" + uid;
Response login = given().get(url); Response login = given().get(url);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = '19380'",uid); Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = '19380'",uid);
consumerId = consumer.get("id").toString(); consumerId = consumer.get("id").toString();
......
...@@ -30,7 +30,7 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{ ...@@ -30,7 +30,7 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
//指定用户 //指定用户
private static int uid = 4689; private static int uid = 4689;
private static int uid2 = 4552; private static int uid2 = 4552;
private static int uid3 = 3590; private static int uid3 = 4793;
private static int uid4 = 4386; private static int uid4 = 4386;
@Test @Test
public void 出券衰减开关校验_() throws Exception { public void 出券衰减开关校验_() throws Exception {
...@@ -103,18 +103,16 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{ ...@@ -103,18 +103,16 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
logger.info("种红包的红包配置接口校验正确"); logger.info("种红包的红包配置接口校验正确");
} }
@Test //@Test
public void 衰减红包校验() throws Exception { public void 衰减红包校验() throws Exception {
//dafuweng登陆获取cookies //dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid4); Map cookies = authorization.dafuwengLogin(uid4);
//调用种植seed //调用种植seed
Response response = seedRedPacketService.seed(cookies,"1","424","1"); Response response = seedRedPacketService.seed(cookies,"6","424","1");
//种子号 //种子号
String orderId = response.jsonPath().getString("data.orderNum"); String orderId = response.jsonPath().getString("data.orderNum");
Assert.assertNotNull(orderId,"订单号为空"); Assert.assertNotNull(orderId,"订单号为空");
logger.info("红包订单为:"+orderId); logger.info("红包订单为:"+orderId);
//红包衰减
Thread.sleep(65000);
//获取种植结果状态getOrderStatus,异步接口,while循环,status为2处理完成,1处理中 //获取种植结果状态getOrderStatus,异步接口,while循环,status为2处理完成,1处理中
response = seedRedPacketService.getOrderStatus(cookies,orderId); response = seedRedPacketService.getOrderStatus(cookies,orderId);
String status = response.jsonPath().getString("data"); String status = response.jsonPath().getString("data");
...@@ -125,7 +123,9 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{ ...@@ -125,7 +123,9 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
i--; i--;
} }
//获取种植获得金额 //获取种植获得金额
response = seedRedPacketService.reap(cookies,"1",orderId); //红包衰减
Thread.sleep(70000);
response = seedRedPacketService.reap(cookies,"6",orderId);
response.prettyPrint(); response.prettyPrint();
String isDecr = response.jsonPath().getString("data.isDecr"); String isDecr = response.jsonPath().getString("data.isDecr");
Assert.assertEquals(isDecr,"true","红包衰减标识校验失败"); Assert.assertEquals(isDecr,"true","红包衰减标识校验失败");
......
...@@ -108,11 +108,12 @@ public class 账户余额清零_AccessTest extends DuibaTestBase { ...@@ -108,11 +108,12 @@ public class 账户余额清零_AccessTest extends DuibaTestBase {
//获取最新的提现记录 //获取最新的提现记录
Thread.sleep(3000);
Map cookies = authorization.dafuwengLogin(uid); Map cookies = authorization.dafuwengLogin(uid);
Response response = walletAccountService.walletDetail(cookies); Response response = walletAccountService.walletDetail(cookies);
String money = response.jsonPath().getString("data[1].money"); String money = response.jsonPath().getString("data[0].money");
String subType = response.jsonPath().getString("data[1].subType"); String subType = response.jsonPath().getString("data[0].subType");
String description = response.jsonPath().getString("data[1].description"); String description = response.jsonPath().getString("data[0].description");
Assert.assertTrue(new BigDecimal(money).compareTo(new BigDecimal("100"))==0,"扣款金额校验失败"); Assert.assertTrue(new BigDecimal(money).compareTo(new BigDecimal("100"))==0,"扣款金额校验失败");
Assert.assertEquals(subType, "0", "日志类型校验失败"); Assert.assertEquals(subType, "0", "日志类型校验失败");
......
...@@ -42,10 +42,10 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -42,10 +42,10 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
//指定用户 //指定用户
private static int uid = 4459; private static int uid = 4459;
private static String consumerId = "100098000"; private static String consumerId = "100098000";
private static int uid2 = 4460; private static int uid2 = 4822;
private static String consumerId2 = "100098001"; private static String consumerId2 = "100108125";
private static int uid3 = 4461; private static int uid3 = 4793;
private static String consumerId3 = "100098002"; private static String consumerId3 = "100108076";
private static int uid4 = 4474; private static int uid4 = 4474;
private static String consumerId4 = "100098031"; private static String consumerId4 = "100098031";
@AfterClass @AfterClass
...@@ -103,9 +103,11 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -103,9 +103,11 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
@Test @Test
public void 提现账号已使用() throws Exception { public void 提现账号已使用() throws Exception {
//修改账户过期时间,确保账户余额不会过期清零
jdbc.update("update consumer_account_log.tb_expire_consumer_account set gmt_modified ='"+getTime(1)+"' where account_id = '"+consumerId2+"_6_0'");
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0977 where account_id = '"+consumerId2+"_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0861 where account_id = '"+consumerId2+"_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
...@@ -119,7 +121,7 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -119,7 +121,7 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
Assert.assertEquals(response.jsonPath().getString("message"),"一个支付宝账户仅允许一个账户提现","/walletAccount/doTakePrize接口失败"); Assert.assertEquals(response.jsonPath().getString("message"),"一个支付宝账户仅允许一个账户提现","/walletAccount/doTakePrize接口失败");
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0977 where account_id = '"+consumerId2+"_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0861 where account_id = '"+consumerId2+"_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
...@@ -128,11 +130,11 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -128,11 +130,11 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
} }
@Test //@Test
public void 开发者账户余额不足() throws Exception { public void 开发者账户余额不足() throws Exception {
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0978 where account_id = '"+consumerId3+"_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0812 where account_id = '"+consumerId3+"_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
...@@ -147,14 +149,14 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -147,14 +149,14 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
Assert.assertEquals(response.jsonPath().getString("message"),"扣app余额失败","/walletAccount/doTakePrize接口失败"); Assert.assertEquals(response.jsonPath().getString("message"),"扣app余额失败","/walletAccount/doTakePrize接口失败");
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0978 where account_id = '"+consumerId3+"_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0812 where account_id = '"+consumerId3+"_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败"); Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败");
logger.info("用户账户余额校验成功"); logger.info("用户账户余额校验成功");
this.checkRecord(uid3,"0.01"); this.checkRecord(uid3,"100");
} }
@Test @Test
...@@ -239,12 +241,21 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{ ...@@ -239,12 +241,21 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
String description1 = response.jsonPath().getString("data[1].description"); String description1 = response.jsonPath().getString("data[1].description");
String subType1 = response.jsonPath().getString("data[1].subType"); String subType1 = response.jsonPath().getString("data[1].subType");
Assert.assertEquals(money,Exmoney,"扣款金额校验失败"); if(subType.equals("0")){
Assert.assertEquals(description,"提现","明细描述失败"); Assert.assertEquals(money,Exmoney,"扣款金额校验失败");
Assert.assertEquals(subType,"0","日志类型校验失败"); Assert.assertEquals(description,"提现","明细描述失败");
Assert.assertEquals(money1,Exmoney,"扣款金额校验失败"); }else{
Assert.assertEquals(description1,"提现 - 返还","明细描述失败"); Assert.assertEquals(money,Exmoney,"扣款金额校验失败");
Assert.assertEquals(subType1,"1","日志类型校验失败"); Assert.assertEquals(description,"提现 - 返还","明细描述失败");
}
if(subType1.equals("0")){
Assert.assertEquals(money1,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description1,"提现","明细描述失败");
}else{
Assert.assertEquals(money1,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description1,"提现 - 返还","明细描述失败");
}
logger.info("账户余额明细校验成功"); logger.info("账户余额明细校验成功");
} }
......
...@@ -38,8 +38,8 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -38,8 +38,8 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
HbaseService hbaseService; HbaseService hbaseService;
private DuibaLog logger = DuibaLog.getLogger(); private DuibaLog logger = DuibaLog.getLogger();
//指定用户 //指定用户
private static int uid = 4244; private static int uid = 4823;
private static String consumerId = "100092758"; private static String consumerId = "100108126";
private static String orderId; private static String orderId;
@AfterClass @AfterClass
public void afterclass() { public void afterclass() {
...@@ -77,7 +77,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -77,7 +77,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
public void a_提现失败_账户错误(int caseNum,String alipay,String realname) throws Exception { public void a_提现失败_账户错误(int caseNum,String alipay,String realname) throws Exception {
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
...@@ -101,7 +101,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -101,7 +101,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
} }
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
...@@ -113,7 +113,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -113,7 +113,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
public void b_正常提现() throws Exception { public void b_正常提现() throws Exception {
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
balance = balance - 1; balance = balance - 1;
...@@ -123,7 +123,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -123,7 +123,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
this.账户提现(cookies,"peeulk6392@sandbox.com","沙箱环境"); this.账户提现(cookies,"peeulk6392@sandbox.com","沙箱环境");
Thread.sleep(2000); Thread.sleep(2000);
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败"); Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败");
...@@ -169,7 +169,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -169,7 +169,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
public void d_提现失败_登录次数不足() throws Exception { public void d_提现失败_登录次数不足() throws Exception {
//获取原账户余额 //获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance); logger.info("账户原有余额为"+balance);
...@@ -183,7 +183,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{ ...@@ -183,7 +183,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
Assert.assertEquals(response.jsonPath().getString("message"),"连续登录天数不足","/walletAccount/doTakePrize接口失败"); Assert.assertEquals(response.jsonPath().getString("message"),"连续登录天数不足","/walletAccount/doTakePrize接口失败");
//获取新账户余额 //获取新账户余额
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0854 where account_id = '100092758_6_0' "); selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0862 where account_id = '100108126_6_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount"))); int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户新余额为"+balanceNew); logger.info("账户新余额为"+balanceNew);
......
...@@ -68,6 +68,7 @@ public class NewActivityService { ...@@ -68,6 +68,7 @@ public class NewActivityService {
map.put("oaId",activityId); map.put("oaId",activityId);
logger.info("请求/hdtool/doJoin接口,activityId="+activityId); logger.info("请求/hdtool/doJoin接口,activityId="+activityId);
logger.info("url:"+url+"/hdtool/doJoin");
Response response = given().cookies(cookies).params(map).post(url+"/hdtool/doJoin"); Response response = given().cookies(cookies).params(map).post(url+"/hdtool/doJoin");
try{ try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200"); Assert.assertEquals(String.valueOf(response.getStatusCode()),"200");
...@@ -79,6 +80,43 @@ public class NewActivityService { ...@@ -79,6 +80,43 @@ public class NewActivityService {
} }
return response; return response;
} }
public Response doJoinMap(Map cookies, String token,String activityId) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("token",token);
map.put("activityId",activityId);
map.put("oaId",activityId);
logger.info("请求/hdtool/doJoin接口,activityId="+activityId);
logger.info("url:"+url+"/hdtool/doJoin");
Response response = given().cookies(cookies).params(map).post(url+"/hdtool/doJoin");
try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200");
logger.info("/hdtool/doJoin接口成功,返回信息:"+response.asString());
}catch(Exception e){
throw new Exception("/hdtool/doJoin接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/hdtool/doJoin接口失败,返回信息:"+response.asString());
}
return response;
}
public Response login(Map cookies, String dpm) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("dpm",dpm);
logger.info("请求/hdtool/login接口");
logger.info("url:"+url+"/hdtool/login");
Response response = given().cookies(cookies).params(map).post(url+"/hdtool/login");
try{
Assert.assertEquals(String.valueOf(response.getStatusCode()),"200");
logger.info("/hdtool/login接口成功,返回信息:"+response.asString());
}catch(Exception e){
throw new Exception("/hdtool/login接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/hdtool/login接口失败,返回信息:"+response.asString());
}
return response;
}
public Response doJoin2( String activityId,String token) throws Exception{ public Response doJoin2( String activityId,String token) throws Exception{
Map<String,String> map = new HashMap<>(); Map<String,String> map = new HashMap<>();
......
...@@ -164,6 +164,7 @@ public class SignactivityService { ...@@ -164,6 +164,7 @@ public class SignactivityService {
map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":1154,\"items\":[{\"days\":2,\"credits\":10,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}"); map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":1154,\"items\":[{\"days\":2,\"credits\":10,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":true}");
map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}"); map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("operatingPositions","[]"); map.put("operatingPositions","[]");
logger.info("请求configEdit接口"); logger.info("请求configEdit接口");
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+hdHost+"/signin/configEdit"); Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+hdHost+"/signin/configEdit");
......
...@@ -164,9 +164,12 @@ public class Authorization { ...@@ -164,9 +164,12 @@ public class Authorization {
Map params=new HashMap(); Map params=new HashMap();
params.put("uid","not_login"); params.put("uid","not_login");
params.put("credits","0"); params.put("credits","0");
String url=tool.buildUrlWithSign("http://home.m.duibatest.com.cn/autoLogin/autologin?",params); String url=tool.buildUrlWithSign("http://activity.m.duibatest.com.cn/autoLogin/autologin?",params);
logger.info("dafuweng免登陆url为:"+url); logger.info("dafuweng免登陆url为:"+url);
Response response=given().redirects().follow(false).get(url); Response response=given().redirects().follow(false).get(url);
logger.info("dafuweng免登陆,响应数据:"+response.asString());
logger.info("dafuweng免登陆,响应状态码:"+response.getStatusCode());
return response; return response;
} }
public Map generateSignAutoLogin(String appKey, int uid){ public Map generateSignAutoLogin(String appKey, int uid){
......
...@@ -448,8 +448,7 @@ public class EditManagerInfoService { ...@@ -448,8 +448,7 @@ public class EditManagerInfoService {
public Response createUser(String name){ public Response createUser(String name){
String url = "http://dafuweng.duibatest.com.cn" + "/user/create";
String url = "http://47.97.214.108" + "/user/create";
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("appId","67"); map.put("appId","67");
map.put("name",name); map.put("name",name);
...@@ -464,7 +463,7 @@ public class EditManagerInfoService { ...@@ -464,7 +463,7 @@ public class EditManagerInfoService {
public Response createUser(String name,String appId){ public Response createUser(String name,String appId){
String url = "http://47.97.214.108" + "/user/create"; String url = "http://dafuweng.duibatest.com.cn" + "/user/create";
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("appId",appId); map.put("appId",appId);
map.put("name",name); map.put("name",name);
......
...@@ -13,6 +13,9 @@ import com.alibaba.fastjson.JSONObject; ...@@ -13,6 +13,9 @@ import com.alibaba.fastjson.JSONObject;
import http.model.BetOptionVo; import http.model.BetOptionVo;
import http.service.Authorization; import http.service.Authorization;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -46,6 +49,7 @@ public class PkActivityService { ...@@ -46,6 +49,7 @@ public class PkActivityService {
public Response bet(String bonusType,String endTime) throws Exception{ public Response bet(String bonusType,String endTime) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/bet"; String url = "http://" + ManagerHost + "/newmanager/bet";
List<BetOptionVo> betOptionVoList = new ArrayList<>(); List<BetOptionVo> betOptionVoList = new ArrayList<>();
BetOptionVo betOptionVo1 = new BetOptionVo(); BetOptionVo betOptionVo1 = new BetOptionVo();
BetOptionVo betOptionVo2 = new BetOptionVo(); BetOptionVo betOptionVo2 = new BetOptionVo();
...@@ -58,12 +62,18 @@ public class PkActivityService { ...@@ -58,12 +62,18 @@ public class PkActivityService {
Map<String,Object> para = new HashMap<>(); Map<String,Object> para = new HashMap<>();
para.put("betOptionDtoList",betOptionVoList); para.put("betOptionDtoList",betOptionVoList);
para.put("betType","1");//1-单选单次; para.put("betType","1");//1-单选单次;
para.put("bonusType",bonusType);//1-经验;2-红包 para.put("bonusType",bonusType);//1-经验;2-红包;3-优惠券
if (bonusType.equals("2")){ if (bonusType.equals("2")){
para.put("bonusAmount","0.1");//实际瓜分红包金额 para.put("bonusAmount","0.1");//实际瓜分红包金额
para.put("title","【自动化】新建pk活动-瓜分红包"); para.put("title","【自动化】新建pk活动-瓜分红包");
}else { }else if (bonusType.equals("1")){
para.put("title","【自动化】新建pk活动-瓜分经验"); para.put("title","【自动化】新建pk活动-瓜分经验");
}else {
para.put("title","【自动化】新建pk活动-瓜分优惠券");
para.put("bonusAmount","");
para.put("pluginId","12");//插件id
para.put("prizeLimit","1000");//发放上限
} }
para.put("configStatus","1"); para.put("configStatus","1");
para.put("creditsValue","1"); para.put("creditsValue","1");
...@@ -87,6 +97,52 @@ public class PkActivityService { ...@@ -87,6 +97,52 @@ public class PkActivityService {
} }
public Response betForSetUp(String bonusType,String endTime) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/bet";
DateTime date = new DateTime();
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
String time = formatter.print(date.getMillis()).toString();
List<BetOptionVo> betOptionVoList = new ArrayList<>();
BetOptionVo betOptionVo1 = new BetOptionVo();
BetOptionVo betOptionVo2 = new BetOptionVo();
betOptionVo1.setOptionImg("//yun.dui88.com/images/201807/6pyca34t5e.jpeg");
betOptionVo1.setOptionName("【自动化】选项A1");
betOptionVo2.setOptionImg("//yun.dui88.com/images/201807/kcrl1q7hkt.jpeg");
betOptionVo2.setOptionName("【自动化】选项A2");
betOptionVoList.add(betOptionVo1);
betOptionVoList.add(betOptionVo2);
Map<String,Object> para = new HashMap<>();
para.put("betOptionDtoList",betOptionVoList);
para.put("betType","1");//1-单选单次;
para.put("bonusType",bonusType);//1-经验;2-红包
if (bonusType.equals("2")){
para.put("bonusAmount","0.1");//实际瓜分红包金额
para.put("title","【自动化】瓜分红包"+time);
}else {
para.put("title","【自动化】瓜分经验"+time);
}
para.put("configStatus","1");
para.put("creditsValue","1");
para.put("endTime",endTime);
para.put("shareExp","13");
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(para));
Response betResponse = given().contentType("application/json;charset=UTF-8").cookies(authorization.ssoLogin()).body(jsonParam).post(url);
betResponse.prettyPrint();
try{
Assert.assertEquals(betResponse.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("创建pk活动接口失败,返回信息:"+betResponse.asString());
}catch(Error er){
throw new Exception("创建pk活动接口失败,返回信息:"+betResponse.asString());
}
return betResponse;
}
public Response betGroupRelation(String betId,String endTime,String groupId) throws Exception{ public Response betGroupRelation(String betId,String endTime,String groupId) throws Exception{
String url = "http://" + ManagerHost + "/newmanager/betGroupRelation"; String url = "http://" + ManagerHost + "/newmanager/betGroupRelation";
...@@ -225,9 +281,28 @@ public class PkActivityService { ...@@ -225,9 +281,28 @@ public class PkActivityService {
return groupListResponse; return groupListResponse;
}
public Response doDraw() throws Exception{
String url = "http://" + ManagerHost + "/newmanager/betOpenPrize/doDraw";
Map<String,Object> para = new HashMap<>();
// para.put("pageNo","1");
// para.put("pageSize","20");
Response doDrawResponse = given().cookies(authorization.ssoLogin()).params(para).get(url);
try{
Assert.assertEquals(doDrawResponse.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("pk活动开奖接口失败,返回信息:"+doDrawResponse.asString());
}catch(Error er){
throw new Exception("pk活动开奖接口失败,返回信息:"+doDrawResponse.asString());
}
return doDrawResponse;
} }
// public static void main(String[] args) throws Exception{ // public static void main(String[] args) throws Exception{
// String endTime = "2021-12-31 23:55:00"; // String endTime = "2021-12-31 23:55:00";
// PkActivityService pkActivityService = new PkActivityService(); // PkActivityService pkActivityService = new PkActivityService();
......
...@@ -142,6 +142,7 @@ public class SignService { ...@@ -142,6 +142,7 @@ public class SignService {
map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}"); map.put("cirReward","{\"rwType\":\"CIRCLE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":null,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}");
map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}"); map.put("acmReward","{\"rwType\":\"ACCUMULATE\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":1,\"activityCount\":1}],\"plSkinOpen2Dev\":true,\"open\":true}");
map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}"); map.put("firstSignReward","{\"rwType\":\"FIRST_SIGN\",\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":false,\"open\":false}");
map.put("cntOnceReward", "{\"rwType\":null,\"plActSkinId\":null,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":0,\"activityCount\":1}],\"plSkinOpen2Dev\":null,\"open\":false}");
map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":100,\"activityCount\":100}],\"plSkinOpen2Dev\":true,\"open\":true}"); map.put("fullSignReward","{\"rwType\":\"FULL_SIGN\",\"plActSkinId\":100,\"plActId\":null,\"items\":[{\"days\":1,\"credits\":100,\"activityCount\":100}],\"plSkinOpen2Dev\":true,\"open\":true}");
map.put("firstSignReward","[]"); map.put("firstSignReward","[]");
......
package http.service.hd; package http.service.hd;
import cn.com.duiba.activity.center.api.params.MainmeetActivityParams;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import http.service.Authorization; import http.service.Authorization;
import base.DuibaLog; import base.DuibaLog;
...@@ -15,6 +16,7 @@ import java.util.List; ...@@ -15,6 +16,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.post;
@Service @Service
public class DeveloperService { public class DeveloperService {
...@@ -912,4 +914,200 @@ public class DeveloperService { ...@@ -912,4 +914,200 @@ public class DeveloperService {
return response; return response;
} }
//保存自有活动工具-所有字段
public Response saveHdAll(String id,String creditsType,String title,String limitCount,String limitScope,String freeLimit,String freeScope,String awards,String bannerImgNew) throws Exception {
String url=hdHost+"/launch/save";
Map<String,String> map = new HashMap<>();
map.put("id",id);
map.put("subType","turntable_circle");
map.put("creditsType",creditsType);
map.put("title",title);
map.put("credits","10");
map.put("limitCount",limitCount);
map.put("limitScope",limitScope);
map.put("freeLimit",freeLimit);
map.put("freeScope",freeScope);
map.put("optionNum","");
map.put("anticheatExchangeLimit","true");
map.put("autoOffDate","2030-12-01 00:00");
map.put("banner","//yun.duiba.com.cn/upload/r1u3O1460639179556.png");
map.put("thumbnail","//yun.duiba.com.cn/upload/R8Hac1467009242903.png");
map.put("questionRecord","[]");
map.put("awards",awards);
map.put("appId","2239");
map.put("bannerImgNew",bannerImgNew);
logger.info("请求创建自有活动工具url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建自有活动接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建自有活动接口失败,返回信息:"+response.asString());
}
return response;
}
//开发者后台编辑自有活动
public Response editData(String actId,String type,String appId) throws Exception {
String url=hdHost+"/launch/editData";
Map<String,String> map = new HashMap<>();
map.put("actId",actId);
map.put("type",type);
map.put("appId",appId);
logger.info("请求编辑自有活动url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("编辑自有活动接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("编辑自有活动接口失败,返回信息:"+response.asString());
}
return response;
}
//保存自有单品抽奖--所有字段
public Response saveDpAll(String id,String title,String mainAppItemId,String appItemTitle,String appItemType, String mainAppItemRemaining,String freeDrawLimit,String freeDrawLimitScope,String bannerImgNew,String vipLimitType,String vipLimits,String exchangeLimit) throws Exception {
String url=hdHost+"/appSingleLottery/saveOrUpdate";
Map<String,String> map = new HashMap<>();
map.put("appId","2239");
map.put("id",id);
map.put("appItemTitle",appItemTitle);
map.put("title",title);
map.put("mainAppItemRemaining",mainAppItemRemaining);
map.put("preMainAppItemRemaining","0");
map.put("credits","50");
map.put("mainAppItemRate","66.66");
map.put("minComein","100");
map.put("autoOffDate","2020-11-01 00:00");
map.put("introduction","自动化测试单品抽奖 奖品说明");
map.put("vipLimitType",vipLimitType);
map.put("vipLimits",vipLimits);
map.put("moreExchangeLimit","true");
map.put("freeDrawLimit",freeDrawLimit);
map.put("freeDrawLimitScope",freeDrawLimitScope);
map.put("consumerDrawLimit","2");
map.put("consumerDrawLimitScope","everyday");
map.put("consumerWinLimit","1");
map.put("everydayWinLimit","10");
map.put("startDay","2018-11-26");
map.put("endDay","2020-02-01");
map.put("startHours","6");
map.put("startTminute","0");
map.put("endThours","22");
map.put("endTminute","0");
map.put("exchangeLimit",exchangeLimit);
map.put("appItemType",appItemType);
map.put("mainAppItemId",mainAppItemId);
map.put("mainAppItemDegree","");
map.put("appItemId",mainAppItemId);
map.put("logo","//yun.dui88.com/images/201610/dczuwpckbw.png");
map.put("smallImage","//yun.dui88.com/images/201610/2tvxvbhj3x.jpg");
map.put("image","//yun.dui88.com/images/201610/sk21di3uia.jpg");
map.put("bannerImgNew",bannerImgNew);
logger.info("请求创建单品抽奖url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建自有单品抽奖接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建自有单品抽奖接口失败,返回信息:"+response.asString());
}
return response;
}
//开发者后台编辑自有单品抽奖活动
public Response editDetail(String appId,String singleLotteryId) throws Exception {
String url=hdHost+"/appSingleLottery/editDetail";
Map<String,String> map = new HashMap<>();
map.put("appId",appId);
map.put("singleLotteryId",singleLotteryId);
logger.info("请求编辑自有单品抽奖活动url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).get("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("编辑自有单品抽奖活动接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("编辑自有单品抽奖活动接口失败,返回信息:"+response.asString());
}
return response;
}
//保存自有手动开奖--所有字段
public Response saveManualLottery(String title,String consumerDrawLimit,String consumerDrawLimitScope,String freeLimit,String freeLimitScope,String bannerImgNew) throws Exception {
String url=hdHost+"/appManualLottery/create";
Map<String,String> map = new HashMap<>();
map.put("title",title);
map.put("credits","50");
map.put("bannerImage","//yun.duiba.com.cn/upload/buctmou88a.png");
map.put("smallImage","//yun.duiba.com.cn/upload/wf0u6dtq7e.png");
map.put("image","//yun.duiba.com.cn/upload/nwmcomavqu.png");
map.put("bannerImgNew",bannerImgNew);
map.put("appId","2239");
map.put("marketPrice","10");
map.put("introduction","测试奖品说明");
map.put("consumerDrawLimit",consumerDrawLimit);
map.put("consumerDrawLimitScope",consumerDrawLimitScope);
map.put("freeLimit",freeLimit);
map.put("freeLimitScope",freeLimitScope);
map.put("overDate","2020-11-01");
logger.info("请求创建自有手动开奖url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建自有手动开奖接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建自有手动开奖接口失败,返回信息:"+response.asString());
}
return response;
}
//编辑自有手动开奖
public Response editManualLottery(String manualLotteryId) throws Exception {
String url=hdHost+"/appManualLottery/edit";
Map<String,String> map = new HashMap<>();
map.put("appId","2239");
map.put("manualLotteryId",manualLotteryId);
logger.info("请求编辑自有手动开奖url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).get("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("编辑自有手动开奖接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("编辑自有手动开奖接口失败,返回信息:"+response.asString());
}
return response;
}
} }
...@@ -13,7 +13,7 @@ import static com.codeborne.selenide.Selenide.open; ...@@ -13,7 +13,7 @@ import static com.codeborne.selenide.Selenide.open;
public class 优惠券_ExchangeTest_ui extends DuibaBaseUi{ public class 优惠券_ExchangeTest_ui extends DuibaBaseUi{
@Test @Test
public void 优惠券兑换_正常流程() throws Exception { public void 优惠券兑换_正常流程() throws Exception {
open("http://47.97.214.108/user/index"); open("http://dafuweng.duibatest.com.cn/user/index");
clickByTextEqual("4762"); clickByTextEqual("4762");
switchWindow(); switchWindow();
sleep(2); sleep(2);
......
...@@ -22,8 +22,10 @@ import ui.common.WebDriverType; ...@@ -22,8 +22,10 @@ import ui.common.WebDriverType;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Map;
import static com.codeborne.selenide.Condition.text; import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.$;
...@@ -62,13 +64,9 @@ public class test extends DuibaBaseUi { ...@@ -62,13 +64,9 @@ public class test extends DuibaBaseUi {
} }
@Test @Test
public void test1(){ public void test1() throws SQLException {
open("https://www.biying.com"); Map<String,Object> map = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_group_relation where bet_id = 1232");
Reporter.log("rererfddfdfdfdfdfdf");
Reporter.log("rererfddfdfdfdfdfdf");
Reporter.log("rererfddfdfdfdfdfdf");
Reporter.log("rererfddfdfdfdfdfdf");
Reporter.log("rererfddfdfdfdfdfdf");
} }
@Test @Test
......
/**
* Copyright (C), 2015-2018
* FileName: BASE64
* Author: qianwenjun
* Date: 2018/9/11 10:02
* Description:
*/
package utils;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/9/11
* @since 1.0.0
*/
public class BASE64 {
/**
* BASE64解密
*
* @param key
* @return
* @throws Exception
*/
public static byte[] decryptBASE64(String key) throws Exception {
return (new BASE64Decoder()).decodeBuffer(key);
}
/**
* BASE64加密
*
* @param key
* @return
* @throws Exception
*/
public static String encryptBASE64(byte[] key) throws Exception {
return (new BASE64Encoder()).encodeBuffer(key);
}
}
\ No newline at end of file
/**
* Copyright (C), 2015-2018
* FileName: GetCookieUtil
* Author: qianwenjun
* Date: 2018/11/28 13:34
* Description:
*/
package utils;
import base.DuibaLog;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.restassured.response.Response;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/11/28
* @since 1.0.0
*/
public class GetCookieUtil {
private static DuibaLog logger = DuibaLog.getLogger();
public static JSONObject getConsumerIdFromCookie(String url) throws Exception{
// Response response = given().get(url);
Response response=given().redirects().follow(false).get(url);
response.prettyPrint();
Map<String,String> cookies = response.getCookies();
String cookieValue = response.getCookie("_ac");
byte[] bytes = BASE64.decryptBASE64(cookieValue);
JSONObject userCookie = JSON.parseObject(new String(bytes,"utf-8"));
// Headers allHeaders = response.getHeaders();
// String headerName = response.getHeader("Set-Cookie");
logger.info("userCookie="+JSONObject.toJSONString(userCookie));
logger.info("aid="+userCookie.get("aid")+",cid="+userCookie.get("cid"));
return userCookie;
}
public static String genUrl(String uid,String appkey) throws Exception{
String res = null;
String url = "http://home.m.duibatest.com.cn/test/generateSign";
Map<String,String> para = new HashMap<>();
para.put("appKey",appkey);
para.put("uid",uid);
Response response = given().params(para).get(url);
response.prettyPrint();
res = response.jsonPath().getString("url").toString();
return res;
}
}
\ No newline at end of file
...@@ -4,8 +4,8 @@ proxyserver.ip=172.16.80.203 ...@@ -4,8 +4,8 @@ proxyserver.ip=172.16.80.203
proxyserver.port=22 proxyserver.port=22
proxyserver.user=dev proxyserver.user=dev
proxyserver.prvkey=key/hzlId_rsa proxyserver.prvkey=key/hzlId_rsa
dafuweng.host=47.97.214.108 dafuweng.host=dafuweng.duibatest.com.cn
dafuweng.port=9002 dafuweng.port=80
uid=2707 uid=2707
appId=2239 appId=2239
hdserver.host=hd.dlp.duibatest.com.cn hdserver.host=hd.dlp.duibatest.com.cn
...@@ -24,7 +24,7 @@ trade.host = activity.m.duibatest.com.cn ...@@ -24,7 +24,7 @@ trade.host = activity.m.duibatest.com.cn
//\u6570\u636E\u5E93\u914D\u7F6E //\u6570\u636E\u5E93\u914D\u7F6E
db.name = duiba_test db.name = duiba_test
db.password= svbP3KUw2PurAnBb2rbs3vohF db.password= svbP3KUw2PurAnBb2rbs3vohF
db.url = jdbc:mysql://rdswy2b9wy53044250u1o.mysql.rds.aliyuncs.com:3306/ db.url = jdbc:mysql://47.97.127.67:13001/?tinyInt1isBit=false
db.driver= com.mysql.cj.jdbc.Driver db.driver= com.mysql.cj.jdbc.Driver
db.maxtotal = 6 db.maxtotal = 6
...@@ -32,39 +32,46 @@ db.maxtotal = 6 ...@@ -32,39 +32,46 @@ db.maxtotal = 6
pluginTest.project=插件 pluginTest.project=插件
pluginTest.names=zhaoran,qianwenjun pluginTest.names=zhaoran,qianwenjun
pluginTest.group=插件-接口自动化 pluginTest.group=插件-接口自动化
pluginTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaPlugin_interface/HTML_Report/suite1_test1_results.html pluginTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaPlugin_interface/HTML_20Report/suite1_test1_results.html
pluginTest.job=duibaPlugin_interface
signTest.project=签到 signTest.project=签到
signTest.names=zhousongbo signTest.names=zhousongbo
signTest.group=签到-接口自动化 signTest.group=签到-接口自动化
signTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaSign_interface/HTML_Report/suite1_test1_results.html signTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaSign_interface/HTML_20Report/suite1_test1_results.html
signTest.job=duibaSign_interface
FloorTest.project=楼层 FloorTest.project=楼层
FloorTest.names=zhaoran,qianwenjun FloorTest.names=zhaoran,qianwenjun
FloorTest.group=楼层-接口自动化 FloorTest.group=楼层-接口自动化
FloorTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaFloor_interface/HTML_Report/suite1_test1_results.html FloorTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaFloor_interface/HTML_20Report/suite1_test1_results.html
FloorTest.job=duibaFloor_interface
DuibaTest.project=活动工具 DuibaTest.project=活动工具
DuibaTest.names=zhaoran,qianwenjun DuibaTest.names=zhaoran,qianwenjun
DuibaTest.group=活动工具-接口自动化 DuibaTest.group=活动工具-接口自动化
DuibaTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duiba_interface/HTML_Report/suite1_test1_results.html DuibaTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duiba_interface/HTML_20Report/suite1_test1_results.html
DuibaTest.job=duiba_interface
AccessTest.project=综合业务(单品抽奖/秒杀/游戏) AccessTest.project=综合业务(单品抽奖/秒杀/游戏)
AccessTest.names=zhaoran,qianwenjun AccessTest.names=zhaoran,qianwenjun
AccessTest.group=综合业务-接口自动化 AccessTest.group=综合业务-接口自动化
AccessTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_Report/suite1_test1_results.html AccessTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_20Report/suite1_test1_results.html
AccessTest.job=duibaAccess_interface
JenkinsTest.project=综合业务(单品抽奖/秒杀/游戏) JenkinsTest.project=综合业务(单品抽奖/秒杀/游戏)
JenkinsTest.names=zhaoran,qianwenjun JenkinsTest.names=zhaoran,qianwenjun
JenkinsTest.group=综合业务-接口自动化 JenkinsTest.group=综合业务-接口自动化
JenkinsTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_Report/suite1_test1_results.html JenkinsTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_20Report/suite1_test1_results.html
ExchangeTest.project=普兑业务 ExchangeTest.project=普兑业务
ExchangeTest.names=panyuli ExchangeTest.names=panyuli
ExchangeTest.group=普兑业务-接口自动化 ExchangeTest.group=普兑业务-接口自动化
ExchangeTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_Report/suite1_test1_results.html ExchangeTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_20Report/suite1_test1_results.html
ExchangeTest.job=duibaExchange_interface
SeckillTest.project=秒杀业务 SeckillTest.project=秒杀业务
SeckillTest.names=qianwenjun SeckillTest.names=qianwenjun
SeckillTest.group=秒杀业务-接口自动化 SeckillTest.group=秒杀业务-接口自动化
SeckillTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_Report/suite1_test1_results.html SeckillTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_20Report/suite1_test1_results.html
\ No newline at end of file SeckillTest.job=Seckill_interface
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment