Commit efb8a4b4 authored by 赵然's avatar 赵然

Merge branch 'mabo'

parents bbce3a1d 0509cd12
......@@ -141,6 +141,9 @@ public class DingdingResult {
return result;
}
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);
......
......@@ -22,7 +22,7 @@ public class DuibaBase extends AbstractTestNGSpringContextTestsDuiba {
// @PostConstruct
@BeforeSuite
public final void setUp() {
logger.info("--------------------DuibaBase.setUp()");
logger.info("--------------------DuibaBase.setUp() Tests");
//只初始化一次
jdbc.initDataSource();
......
......@@ -15,8 +15,8 @@ public class DuibaBases extends AbstractTestNGSpringContextTestsDuiba {
// @PostConstruct
@BeforeSuite
public void setUp() {
logger.info("--------------------DuibaBase.setUp()");
public final void setUp() {
logger.info("--------------------DuibaBases.setUp() Test");
//只初始化一次
jdbc.initDataSource();
......
......@@ -21,9 +21,11 @@ import static io.restassured.RestAssured.given;
* Created by hanzhanli on 2017/11/9.
*/
public class Postman {
static String dingdingUrl="https://shark.dui88.com/test/integration";
static String testPlatformUrl = "http://101.37.27.82:8080/insert";
static String miriaUrl = "http://miria-aliyun.duibatest.com.cn/autoTest/finish";
final static String dingdingUrl="https://shark.dui88.com/test/integration";
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/";
private static Logger logger = LogManager.getLogger(Postman.class);
public static void send2Dingding(Map result){
......@@ -54,6 +56,15 @@ public class Postman {
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(){
......
package base;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
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.*;
/**
......@@ -12,6 +18,12 @@ import org.testng.*;
public class TestListener implements ITestListener {
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) {
Iterator<ITestResult> listOfFailedTests = context.getFailedTests().getAllResults().iterator();
while (listOfFailedTests.hasNext()) {
......@@ -65,16 +77,26 @@ public class TestListener implements ITestListener {
// TODO Auto-generated method stub
logger.info("onStart~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
//服务检查
boolean ServiceDoctor=Boolean.parseBoolean(System.getProperty("ServiceDoctor"));
if(ServiceDoctor){
try{
serviceDoctor();
}catch (SkipException e){
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(){
logger.info("duiba-server开始检测");
......@@ -107,4 +129,13 @@ public class TestListener implements ITestListener {
res = simpleDateFormat.format(date);
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;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -75,6 +76,15 @@ public class TestReport implements IReporter{
}
map.put("failCase",failCase);
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)
Postman.sendTestPlatform(map);
......@@ -86,5 +96,6 @@ public class TestReport implements IReporter{
Postman.send2Dingding(map);
}
}
}
package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.app.CouponExchangeService;
......
package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.app.*;
......
package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.app.*;
......
package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import base.DuibaLog;
import http.service.Activity.ManagerService;
import http.service.Authorization;
......
package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import utils.RedisUtil;
import http.service.Activity.ManagerService;
import http.service.Authorization;
......
package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.app.AlipayExchangeService;
......
package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.app.CouponExchangeService;
......
package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Authorization;
import http.service.app.AppPlatformCouponService;
import http.service.app.CrecordService;
......
package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import base.DuibaLog;
import http.service.Activity.ManagerService;
import http.service.Authorization;
......
package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import http.service.Authorization;
import http.service.Manager.ADeveloperService;
import http.service.app.AlipayExchangeService;
......
package http.cases.ExchangeTest;
import base.DuibaBase;
import base.DuibaBases;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject;
......
......@@ -139,8 +139,9 @@ public class 游戏_开大奖测试_AccessTest extends DuibaTestBase {
Response openWinnResponse = newGameService.openWinning(gameId);
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);
logger.info("orders信息为"+JSONObject.toJSONString(orders));
for(int i=0;i<orders.size();i++){
if (orders.get(i).get("consumer_id").toString().equals(user1.getConsumerId())){
Assert.assertEquals(orders.get(i).get("prize_id").toString(),optionId1,"第一名发奖奖项id校验失败");
......
......@@ -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\":\"小奖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();
Thread.sleep(3000);
......@@ -133,7 +133,7 @@ public class 游戏_新建无大奖游戏_AccessTest extends DuibaTestBase {
map1.put("id",gameIds.get(z));
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));
Assert.assertEquals(result.get("game_status").toString(),"1","校验状态修改失败");
}else if (z==1){
......
......@@ -66,9 +66,9 @@ public class 异常订单测试_ExchangeTest extends DuibaTestBase {
@Test(description = "实物兑换无库存")
public void 无库存() throws Exception {
Response response = mobileService.detail(authorization.dafuwengLogin(3661), "31051");//uid3661
Response response = mobileService.detail(authorization.dafuwengLogin(4819), "31051");//uid3661
// response.prettyPrint();
Map<String, String> map = authorization.dafuwengLogin(3661, true);
Map<String, String> map = authorization.dafuwengLogin(4819);
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "活动详情页请求异常");
//实物兑换
Response response2 = couponExchangeService.objectExchange2(map, "179139", "null", "null", "z9sydmcs", "null");
......
......@@ -152,7 +152,11 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
//获取未登录场景cookie
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();
String success = String.valueOf(response.jsonPath().getString("success"));
//根据case选择校验项
......@@ -180,6 +184,10 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
Assert.assertTrue(response.jsonPath().getString("lottery.link").contains("/activity/takePrizeNew?recordId="));
Assert.assertEquals(response.jsonPath().getString("lottery.id"), "11628", "校验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 @@ package http.cases.PkTest;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.model.BetMobileVo;
import http.service.Activity.PkService;
import io.restassured.response.Response;
......@@ -61,8 +62,11 @@ public class pk_列表测试_AccessTest extends DuibaTestBase {
logger.info("未参加过押注用户的列表数据校验成功,unbetList的信息为"+ JSON.toJSONString(unbetList));
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);
logger.info("betedList_uid_18816的信息为"+ JSONObject.toJSONString(betedList_uid_18816));
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(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));
......
......@@ -85,8 +85,8 @@ public class pk_开奖_瓜分红包_押注人数不同测试_AccessTest extends
@Test
public void 瓜分红包_两个选项_押注人数不同_开奖测试(){
try {
public void 瓜分红包_两个选项_押注人数不同_开奖测试() throws Exception{
List<Map<String,Object>> pks = jdbc.findModeResult("select * from act_com_conf.tb_bet_option where bet_id = ?",newBetId);
logger.info("pk活动信息为"+JSONObject.toJSONString(pks));
......@@ -171,11 +171,6 @@ public class pk_开奖_瓜分红包_押注人数不同测试_AccessTest extends
Assert.assertEquals(use4_Acc2.toString(),String.valueOf(use4_Acc1+10),"用户4入账校验失败");
}catch (Exception e){
e.printStackTrace();
}
}
......
......@@ -50,10 +50,10 @@ public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends
private String groupId = "7";
private Integer user01 = 4782;
private String consumerId01 = "100107000";//activity_order_con.tb_trade_center_activity_order_0760
private Integer user02 = 4783;
private String consumerId02 = "100107001";//activity_order_con.tb_trade_center_activity_order_0761
private Integer user01 = 4784;
private String consumerId01 = "100108068";//activity_order_con.tb_trade_center_activity_order_0804
private Integer user02 = 4785;
private String consumerId02 = "100108069";//activity_order_con.tb_trade_center_activity_order_0805
private String newBetId = "";
......@@ -84,9 +84,9 @@ public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends
}
logger.info("pk活动id为:"+newBetId+",选项id为:"+ optionsIds.toString());
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0760 where consumer_id = '100107000' and account_type = '6'\n");
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0804 where consumer_id = '100108068' and account_type = '6'\n");
Long use1_Acc1 = Long.valueOf(user01_account1.get("balance_amount").toString());
Map<String,Object> user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0761 where consumer_id = '100107001' and account_type = '6'\n");
Map<String,Object> user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0805 where consumer_id = '100108069' and account_type = '6'\n");
Long use2_Acc1 = Long.valueOf(user02_account1.get("balance_amount").toString());
......@@ -121,9 +121,9 @@ public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends
}
}
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0760 where consumer_id = '100107000' and duiba_activity_id = ?\n",newBetId);
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0804 where consumer_id = '100108068' and duiba_activity_id = ?\n",newBetId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"10","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0761 where consumer_id = '100107001' and duiba_activity_id = ?\n",newBetId);
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0805 where consumer_id = '100108069' and duiba_activity_id = ?\n",newBetId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
logger.info("用户01获取的红包值为:"+user01_order.get("add_credits").toString()+",用户02获取的红包值为:"+user02_order.get("add_credits").toString());
......@@ -136,10 +136,10 @@ public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends
Assert.assertTrue(bet1Times>bet2Times,"活动获胜人数比失败人数多校验失败");
logger.info("选项1的押注人数为:"+bet1Result.get("bet_times").toString()+",选项2的押注人数为:"+bet2Result.get("bet_times").toString());
Map<String,Object> user01_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0760 where consumer_id = '100107000' and account_type = '6'\n");
Map<String,Object> user01_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0804 where consumer_id = '100108068' and account_type = '6'\n");
Long use1_Acc2 = Long.valueOf(user01_account2.get("balance_amount").toString());
Assert.assertEquals(use1_Acc2.toString(),String.valueOf(use1_Acc1+10),"用户2入账校验失败");
Map<String,Object> user02_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0761 where consumer_id = '100107001' and account_type = '6'\n");
Map<String,Object> user02_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0805 where consumer_id = '100108069' and account_type = '6'\n");
Long use2_Acc2 = Long.valueOf(user02_account2.get("balance_amount").toString());
Assert.assertEquals(use2_Acc2,use2_Acc1,"用户2入账校验失败");
......
......@@ -11,6 +11,7 @@ import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.service.Authorization;
import http.service.Manager.EditManagerInfoService;
import http.service.app.SeckillService;
......@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
import org.testng.annotations.Test;
import utils.GetCookieUtil;
import utils.MatcherString;
import java.util.HashMap;
......@@ -178,12 +180,13 @@ public class 天天秒杀_秒杀活动兑换测试_SeckillTest extends DuibaTest
Map<String,String> map = new HashMap<>();
Response response = editManagerInfoService.createUser("qwj测试秒杀用户");
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 url = "http://47.97.214.108/user/loginDuiba?uid=" + uid;
Response login = given().get(url);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = '18816'\n",uid);
String consumerId = consumer.get("id").toString();
String url = GetCookieUtil.genUrl(uid,"3erv8LvBxKBSyuGK5i8FSGyYoFD1");
JSONObject cookie = GetCookieUtil.getConsumerIdFromCookie(url);
String consumerId = cookie.get("cid").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 = '18816'\n",uid);
map.put("uid",uid);
......
......@@ -142,7 +142,7 @@ public class 种红包新用户_AccessTest extends DuibaTestBase{
Response response = editManagerInfoService.createUser("种红包新用户","68");
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where name = '种红包新用户' and app_id = '68'");
uid = Integer.valueOf(user.get("id").toString());
String url = "http://47.97.214.108/user/loginDuiba?uid=" + uid;
String url = "http://dafuweng.duibatest.com.cn/user/loginDuiba?uid=" + uid;
Response login = given().get(url);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where partner_user_id =? and app_id = '19380'",uid);
consumerId = consumer.get("id").toString();
......
......@@ -30,7 +30,7 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
//指定用户
private static int uid = 4689;
private static int uid2 = 4552;
private static int uid3 = 3590;
private static int uid3 = 4793;
private static int uid4 = 4386;
@Test
public void 出券衰减开关校验_() throws Exception {
......
......@@ -108,11 +108,12 @@ public class 账户余额清零_AccessTest extends DuibaTestBase {
//获取最新的提现记录
Thread.sleep(3000);
Map cookies = authorization.dafuwengLogin(uid);
Response response = walletAccountService.walletDetail(cookies);
String money = response.jsonPath().getString("data[1].money");
String subType = response.jsonPath().getString("data[1].subType");
String description = response.jsonPath().getString("data[1].description");
String money = response.jsonPath().getString("data[0].money");
String subType = response.jsonPath().getString("data[0].subType");
String description = response.jsonPath().getString("data[0].description");
Assert.assertTrue(new BigDecimal(money).compareTo(new BigDecimal("100"))==0,"扣款金额校验失败");
Assert.assertEquals(subType, "0", "日志类型校验失败");
......
......@@ -42,10 +42,10 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
//指定用户
private static int uid = 4459;
private static String consumerId = "100098000";
private static int uid2 = 4460;
private static String consumerId2 = "100098001";
private static int uid3 = 4461;
private static String consumerId3 = "100098002";
private static int uid2 = 4822;
private static String consumerId2 = "100108125";
private static int uid3 = 4793;
private static String consumerId3 = "100108076";
private static int uid4 = 4474;
private static String consumerId4 = "100098031";
@AfterClass
......@@ -103,9 +103,11 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
@Test
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")));
logger.info("账户原有余额为"+balance);
......@@ -119,7 +121,7 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
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")));
logger.info("账户新余额为"+balanceNew);
......@@ -132,7 +134,7 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
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")));
logger.info("账户原有余额为"+balance);
......@@ -147,14 +149,14 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
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")));
logger.info("账户新余额为"+balanceNew);
Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败");
logger.info("用户账户余额校验成功");
this.checkRecord(uid3,"0.01");
this.checkRecord(uid3,"100");
}
@Test
......@@ -239,12 +241,21 @@ public class 账户异常提现_AccessTest extends DuibaTestBase{
String description1 = response.jsonPath().getString("data[1].description");
String subType1 = response.jsonPath().getString("data[1].subType");
Assert.assertEquals(money,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description,"提现","明细描述失败");
Assert.assertEquals(subType,"0","日志类型校验失败");
Assert.assertEquals(money1,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description1,"提现 - 返还","明细描述失败");
Assert.assertEquals(subType1,"1","日志类型校验失败");
if(subType.equals("0")){
Assert.assertEquals(money,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description,"提现","明细描述失败");
}else{
Assert.assertEquals(money,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description,"提现 - 返还","明细描述失败");
}
if(subType1.equals("0")){
Assert.assertEquals(money1,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description1,"提现","明细描述失败");
}else{
Assert.assertEquals(money1,Exmoney,"扣款金额校验失败");
Assert.assertEquals(description1,"提现 - 返还","明细描述失败");
}
logger.info("账户余额明细校验成功");
}
......
......@@ -38,8 +38,8 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
HbaseService hbaseService;
private DuibaLog logger = DuibaLog.getLogger();
//指定用户
private static int uid = 4244;
private static String consumerId = "100092758";
private static int uid = 4823;
private static String consumerId = "100108126";
private static String orderId;
@AfterClass
public void afterclass() {
......@@ -77,7 +77,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
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")));
logger.info("账户原有余额为"+balance);
......@@ -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")));
logger.info("账户新余额为"+balanceNew);
......@@ -113,7 +113,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
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")));
logger.info("账户原有余额为"+balance);
balance = balance - 1;
......@@ -123,7 +123,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
this.账户提现(cookies,"peeulk6392@sandbox.com","沙箱环境");
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")));
logger.info("账户新余额为"+balanceNew);
Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败");
......@@ -169,7 +169,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
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")));
logger.info("账户原有余额为"+balance);
......@@ -183,7 +183,7 @@ public class 账户正常提现_AccessTest extends DuibaTestBase{
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")));
logger.info("账户新余额为"+balanceNew);
......
......@@ -68,6 +68,7 @@ public class NewActivityService {
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");
......@@ -79,6 +80,43 @@ public class NewActivityService {
}
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{
Map<String,String> map = new HashMap<>();
......
......@@ -164,9 +164,12 @@ public class Authorization {
Map params=new HashMap();
params.put("uid","not_login");
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);
Response response=given().redirects().follow(false).get(url);
logger.info("dafuweng免登陆,响应数据:"+response.asString());
logger.info("dafuweng免登陆,响应状态码:"+response.getStatusCode());
return response;
}
public Map generateSignAutoLogin(String appKey, int uid){
......
......@@ -448,8 +448,7 @@ public class EditManagerInfoService {
public Response createUser(String name){
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.put("appId","67");
map.put("name",name);
......@@ -464,7 +463,7 @@ public class EditManagerInfoService {
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.put("appId",appId);
map.put("name",name);
......
......@@ -13,7 +13,7 @@ import static com.codeborne.selenide.Selenide.open;
public class 优惠券_ExchangeTest_ui extends DuibaBaseUi{
@Test
public void 优惠券兑换_正常流程() throws Exception {
open("http://47.97.214.108/user/index");
open("http://dafuweng.duibatest.com.cn/user/index");
clickByTextEqual("4762");
switchWindow();
sleep(2);
......
......@@ -4,8 +4,8 @@ proxyserver.ip=172.16.80.203
proxyserver.port=22
proxyserver.user=dev
proxyserver.prvkey=key/hzlId_rsa
dafuweng.host=47.97.214.108
dafuweng.port=9002
dafuweng.host=dafuweng.duibatest.com.cn
dafuweng.port=80
uid=2707
appId=2239
hdserver.host=hd.dlp.duibatest.com.cn
......@@ -24,47 +24,54 @@ trade.host = activity.m.duibatest.com.cn
//\u6570\u636E\u5E93\u914D\u7F6E
db.name = duiba_test
db.password= svbP3KUw2PurAnBb2rbs3vohF
db.url = jdbc:mysql://rdswy2b9wy53044250u1o.mysql.rds.aliyuncs.com:3306/?tinyInt1isBit=false
db.url = jdbc:mysql://47.97.127.67:13001/?tinyInt1isBit=false
db.driver= com.mysql.cj.jdbc.Driver
db.maxtotal = 6
//\u9489\u9489\u62A5\u544A\u914D\u7F6E
pluginTest.project=\u63D2\u4EF6
//钉钉报告配置
pluginTest.project=插件
pluginTest.names=zhaoran,qianwenjun
pluginTest.group=\u63D2\u4EF6-\u63A5\u53E3\u81EA\u52A8\u5316
pluginTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaPlugin_interface/HTML_Report/suite1_test1_results.html
pluginTest.group=插件-接口自动化
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=\u7B7E\u5230
signTest.project=签到
signTest.names=zhousongbo
signTest.group=\u7B7E\u5230-\u63A5\u53E3\u81EA\u52A8\u5316
signTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaSign_interface/HTML_Report/suite1_test1_results.html
signTest.group=签到-接口自动化
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=\u697C\u5C42
FloorTest.project=楼层
FloorTest.names=zhaoran,qianwenjun
FloorTest.group=\u697C\u5C42-\u63A5\u53E3\u81EA\u52A8\u5316
FloorTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaFloor_interface/HTML_Report/suite1_test1_results.html
FloorTest.group=楼层-接口自动化
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=\u6D3B\u52A8\u5DE5\u5177
DuibaTest.project=活动工具
DuibaTest.names=zhaoran,qianwenjun
DuibaTest.group=\u6D3B\u52A8\u5DE5\u5177-\u63A5\u53E3\u81EA\u52A8\u5316
DuibaTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duiba_interface/HTML_Report/suite1_test1_results.html
DuibaTest.group=活动工具-接口自动化
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=\u7EFC\u5408\u4E1A\u52A1(\u5355\u54C1\u62BD\u5956/\u79D2\u6740/\u6E38\u620F)
AccessTest.project=综合业务(单品抽奖/秒杀/游戏)
AccessTest.names=zhaoran,qianwenjun
AccessTest.group=\u7EFC\u5408\u4E1A\u52A1-\u63A5\u53E3\u81EA\u52A8\u5316
AccessTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_Report/suite1_test1_results.html
AccessTest.group=综合业务-接口自动化
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=\u7EFC\u5408\u4E1A\u52A1(\u5355\u54C1\u62BD\u5956/\u79D2\u6740/\u6E38\u620F)
JenkinsTest.project=综合业务(单品抽奖/秒杀/游戏)
JenkinsTest.names=zhaoran,qianwenjun
JenkinsTest.group=\u7EFC\u5408\u4E1A\u52A1-\u63A5\u53E3\u81EA\u52A8\u5316
JenkinsTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_Report/suite1_test1_results.html
JenkinsTest.group=综合业务-接口自动化
JenkinsTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/duibaAccess_interface/HTML_20Report/suite1_test1_results.html
ExchangeTest.project=\u666E\u5151\u4E1A\u52A1
ExchangeTest.project=普兑业务
ExchangeTest.names=panyuli
ExchangeTest.group=\u666E\u5151\u4E1A\u52A1-\u63A5\u53E3\u81EA\u52A8\u5316
ExchangeTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/duibaExchange_interface/HTML_Report/suite1_test1_results.html
ExchangeTest.group=普兑业务-接口自动化
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=\u79D2\u6740\u4E1A\u52A1
SeckillTest.project=秒杀业务
SeckillTest.names=qianwenjun
SeckillTest.group=\u79D2\u6740\u4E1A\u52A1-\u63A5\u53E3\u81EA\u52A8\u5316
SeckillTest.resultUrl=http://tst.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_Report/suite1_test1_results.html
\ No newline at end of file
SeckillTest.group=秒杀业务-接口自动化
SeckillTest.resultUrl=http://tst-idc.deploy.dui88.com/view/duibaTest/job/Seckill_interface/HTML_20Report/suite1_test1_results.html
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