Commit dfe59279 authored by qwj-github's avatar qwj-github

add

parent 943ef4b0
......@@ -332,7 +332,6 @@ public class pk_押注测试_AccessTest extends DuibaTestBase {
}
// @AfterMethod
@AfterClass
public void tearDown() {
......
......@@ -35,7 +35,8 @@ public class 插件_抽奖扣积分测试_pluginTest extends DuibaTestBase {
private int uid = 3982;
private String consumerId = "100092192";
private Integer user01 = 5193;//appid=21833
private String consumerId01 = "100114050";
private static DuibaLog logger = DuibaLog.getLogger();
......@@ -67,10 +68,31 @@ public class 插件_抽奖扣积分测试_pluginTest extends DuibaTestBase {
logger.info("校验积分消耗成功,原积分值="+userCredit+",消耗后积分值为"+userCredit1);
}
@Test
public void 插件_实物有奖项库存无兑换项库存测试() throws Exception{
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where id=?\n",uid);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where id=?\n",consumerId);
Long userCredit = Long.parseLong(user.get("credits").toString());
Long consumerCredit = Long.parseLong(consumer.get("credits").toString());
}
Response playResponse = this.playPlugin(uid,"3355");
Assert.assertEquals(playResponse.jsonPath().getString("lottery.type"),"thanks","插件抽奖的奖品类型校验失败");
logger.info("插件奖品的兑换项库存不足,降级谢谢参与成功");
Map<String,Object> user1 = jdbc.findSimpleResult("select * from dafuweng.user where id=?\n",uid);
Map<String,Object> consumer1 = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where id=?\n",consumerId);
String userCredit1 = user1.get("credits").toString();
String consumerCredit1 = consumer1.get("credits").toString();
Assert.assertEquals(userCredit1,String.valueOf(userCredit-44),"user积分扣除校验失败");
Assert.assertEquals(consumerCredit1,String.valueOf(consumerCredit-44),"consumer积分扣除校验失败");
logger.info("校验积分消耗成功,原积分值="+userCredit+",消耗后积分值为"+userCredit1);
}
......
/**
* Copyright (C), 2015-2018
* FileName: 插件_插件信息获取测试
* Author: qianwenjun
* Date: 2018/12/20 09:48
* Description:
*/
package http.cases.PluginActivityTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.ActivityPlugDrawInfoService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.Test;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/12/20
* @since 1.0.0
*/
public class 插件_插件信息获取测试 extends DuibaTestBase {
@Autowired
ActivityPlugDrawInfoService activityPlugDrawInfoService;
private static DuibaLog logger = DuibaLog.getLogger();
private Integer user01 = 5416;//appid=21945
private Integer user02 = 5193;//appid=21833
@Test
public void 插件_人民币展示() throws Exception{
Response response = activityPlugDrawInfoService.getPrizeInfo(user01,"3354");
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("needMonery"),"0.88","校验插件价值人民币展示错误");
Assert.assertEquals(response.jsonPath().getString("pluginLimitCount"),"2","校验插件限制次数错误");
Assert.assertEquals(response.jsonPath().getString("limitCount"),"1","校验插件免费次数错误");
Assert.assertEquals(response.jsonPath().getString("creditsPrice"),"88","校验插件限制次数错误");
Assert.assertEquals(response.jsonPath().getString("limitScope"),"1","校验插件次数维度错误");
}
@Test
public void 插件_50汇率展示展示() throws Exception{
Response response = activityPlugDrawInfoService.getPrizeInfo(user02,"3354");
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("needMonery"),null,"校验插件价值人民币展示错误");
Assert.assertEquals(response.jsonPath().getString("pluginLimitCount"),"2","校验插件限制次数错误");
Assert.assertEquals(response.jsonPath().getString("limitCount"),"1","校验插件免费次数错误");
Assert.assertEquals(response.jsonPath().getString("creditsPrice"),"44","校验插件限制次数错误");
Assert.assertEquals(response.jsonPath().getString("limitScope"),"1","校验插件次数维度错误");
}
}
\ No newline at end of file
......@@ -142,4 +142,24 @@ public class ActivityPlugDrawInfoService {
return response;
}
public Response getPrizeInfo(int uid,String activityId) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("activityId",activityId);
logger.info("请求getPrizeInfo接口,orderId="+activityId);
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).post(activityHost+"/plugin/getPrizeInfo");
Assert.assertEquals(response.jsonPath().getString("success"),"true");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/activityPlugDrawInfo/getOrderStatusPlugdraw接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/activityPlugDrawInfo/getOrderStatusPlugdraw接口失败,返回信息:"+response.asString());
}
return response;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment