Commit af1990f8 authored by 赵然's avatar 赵然

zr

parent 136d5cab
/**
* Copyright (C), 2015-2018
* FileName: 配置测试_AccessTest
* Author: zhaoran
* Date: 2018/12/10 19:45
* Description:
*/
package http.cases.PkMoudleTest;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.model.BetMobileVo;
import http.service.Activity.PkMoudleService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class 配置测试_AccessTest extends DuibaTestBase {
@Autowired
PkMoudleService pkMoudleService;
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid = 5028;//
@Test
public void 配置测试() throws Exception{
Response response = pkMoudleService.getBetList(uid);
response.print();
//分积分配置获取
String betType1 = response.jsonPath().getString("data.unbetList[0].betConfig.betType");
String bonusType1 = response.jsonPath().getString("data.unbetList[0].betConfig.bonusType");
String configStatus1 = response.jsonPath().getString("data.unbetList[0].betConfig.configStatus");
String creditsValue1 = response.jsonPath().getString("data.unbetList[0].betConfig.creditsValue");
String id1 = response.jsonPath().getString("data.unbetList[0].betConfig.id");
String shareExp1 = response.jsonPath().getString("data.unbetList[0].betConfig.shareExp");
String title1 = response.jsonPath().getString("data.unbetList[0].betConfig.title");
String unitName1 = response.jsonPath().getString("data.unbetList[0].betConfig.unitName");
//分积分选项获取
String optionId1 = response.jsonPath().getString("data.unbetList[0].options[0].optionId");
String optionImg1 = response.jsonPath().getString("data.unbetList[0].options[0].optionImg");
String optionName1 = response.jsonPath().getString("data.unbetList[0].options[0].optionName");
String optionId2 = response.jsonPath().getString("data.unbetList[0].options[1].optionId");
String optionImg2 = response.jsonPath().getString("data.unbetList[0].options[1].optionImg");
String optionName2 = response.jsonPath().getString("data.unbetList[0].options[1].optionName");
Assert.assertEquals(betType1,"1","校验押注类型失败"); //'押注类型 1-单选单次,2-多选无限制'
Assert.assertEquals(bonusType1,"4","校验瓜分类型失败");//'瓜分类型1瓜分经验2瓜分红包3发奖品4瓜分积分'
Assert.assertEquals(configStatus1,"3","校验投注活动的状态失败");//'投注活动的状态:1关闭不可见2关闭可见3开启4结束'
Assert.assertEquals(creditsValue1,"2.00","校验积分价值失败");//积分价值
Assert.assertEquals(id1,"1354","校验pk id失败");
Assert.assertTrue(new BigDecimal(shareExp1).compareTo(new BigDecimal("99"))==0,"校验瓜分的经验池失败");//瓜分的经验池
Assert.assertEquals(title1,"瓜分积分","校验投注活动标题失败");//投注活动标题
Assert.assertEquals(unitName1,"元宝","校验消耗类型失败");
Assert.assertEquals(optionId1,"2867","校验选项1 id失败");
Assert.assertEquals(optionImg1,"//yun.dui88.com/images/201812/c5vo081h6h.jpg","校验选项1 图片失败");
Assert.assertEquals(optionName1,"分积分1","校验选项1 title失败");
Assert.assertEquals(optionId2,"2868","校验选项2 id失败");
Assert.assertEquals(optionImg2,"//yun.dui88.com/images/201812/5ib6ews6bw.png","校验选项2 图片失败");
Assert.assertEquals(optionName2,"分积分2","校验选项2 title失败");
//分红包配置获取
String betType2 = response.jsonPath().getString("data.unbetList[1].betConfig.betType");
String bonusType2 = response.jsonPath().getString("data.unbetList[1].betConfig.bonusType");
String configStatus2 = response.jsonPath().getString("data.unbetList[1].betConfig.configStatus");
String creditsValue2 = response.jsonPath().getString("data.unbetList[1].betConfig.creditsValue");
String id2 = response.jsonPath().getString("data.unbetList[1].betConfig.id");
String shareExp2 = response.jsonPath().getString("data.unbetList[1].betConfig.shareExp");
String title2 = response.jsonPath().getString("data.unbetList[1].betConfig.title");
String unitName2 = response.jsonPath().getString("data.unbetList[1].betConfig.unitName");
//分红包选项获取
String optionId3 = response.jsonPath().getString("data.unbetList[1].options[0].optionId");
String optionImg3 = response.jsonPath().getString("data.unbetList[1].options[0].optionImg");
String optionName3 = response.jsonPath().getString("data.unbetList[1].options[0].optionName");
String optionId4 = response.jsonPath().getString("data.unbetList[1].options[1].optionId");
String optionImg4 = response.jsonPath().getString("data.unbetList[1].options[1].optionImg");
String optionName4 = response.jsonPath().getString("data.unbetList[1].options[1].optionName");
Assert.assertEquals(betType2,"1","校验押注类型失败"); //'押注类型 1-单选单次,2-多选无限制'
Assert.assertEquals(bonusType2,"2","校验瓜分类型失败");//'瓜分类型1瓜分经验2瓜分红包3发奖品4瓜分积分'
Assert.assertEquals(configStatus2,"3","校验投注活动的状态失败");//'投注活动的状态:1关闭不可见2关闭可见3开启4结束'
Assert.assertEquals(creditsValue2,"3.00","校验积分价值失败");//积分价值
Assert.assertEquals(id2,"1355","校验pk id失败");
Assert.assertTrue(new BigDecimal(shareExp2).compareTo(new BigDecimal("199"))==0,"校验瓜分的经验池失败");//瓜分的经验池
Assert.assertEquals(title2,"瓜分红包","校验投注活动标题失败");//投注活动标题
Assert.assertEquals(unitName2,"元宝","校验消耗类型失败");
Assert.assertEquals(optionId3,"2869","校验选项1 id失败");
Assert.assertEquals(optionImg3,"//yun.dui88.com/images/201812/wfvn1m8wm0.jpg","校验选项1 图片失败");
Assert.assertEquals(optionName3,"分红包选项一","校验选项1 title失败");
Assert.assertEquals(optionId4,"2870","校验选项2 id失败");
Assert.assertEquals(optionImg4,"//yun.dui88.com/images/201812/ifh1kvaq9m.jpg","校验选项2 图片失败");
Assert.assertEquals(optionName4,"分红包选项二","校验选项2 title失败");
logger.info("pk组件分红包、分积分配置校验正确!");
}
}
\ No newline at end of file
/**
* Copyright (C), 2015-2018
* FileName: PkService
* Author: qianwenjun
* Date: 2018/8/5 11:37
* Description:
*/
package http.service.Activity;
import base.DuibaLog;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.testng.Assert;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
/**
* @author zhaoran
* @create 2018/12/10
* @since 1.0.0
*/
@Service
public class PkMoudleService {
@Autowired
Authorization authorization;
@Value("${activity.host}")
String activityHost;
private DuibaLog logger = DuibaLog.getLogger();
public Response getBetList(Integer uid) throws Exception{
String url = activityHost + "/betActivity2/list";
Map<String,Object> map = new HashMap<>();
map.put("pageNo","1");
map.put("pageSize","6");
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).get(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("手机端获取pk列表接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("手机端获取pk列表接口失败,返回信息:"+response.asString());
}
return response;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment