Commit 0ae257b2 authored by 赵然's avatar 赵然

Merge branch 'develop'

parents 17932c73 0fcfe151
......@@ -34,6 +34,7 @@ public class 答题_创建答题活动_DuibaTest extends DuibaTestBase {
@Test
public void 创建答题活动() throws Exception{
logger.info("创建答题活动");
CustomHdToolVO customHdToolVO = new CustomHdToolVO();
customHdToolVO.setActId(null);
......
......@@ -17,10 +17,7 @@ import org.testng.annotations.Test;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import static io.restassured.RestAssured.given;
......@@ -776,8 +773,6 @@ public class 优惠券_兑换流程测试_ExchangeTest extends DuibaTestBase {
}
//优惠券兑换接口抽离
public Response 优惠券兑换(String appItemId,String itemId,int uid) throws Exception {
Response response = couponExchangeService.couponExchange(authorization.dafuwengLogin(uid),appItemId,itemId);
......@@ -822,5 +817,4 @@ public class 优惠券_兑换流程测试_ExchangeTest extends DuibaTestBase {
}
package http.cases.ExchangeTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.app.CouponExchangeService;
import http.service.app.CrecordService;
import http.service.app.LogService;
import http.service.app.MobileService;
import http.service.hd.DeveloperAccountService;
import http.service.hd.DsOrderService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import utils.MatcherString;
import utils.RedisUtil;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
/**
* Created by panyuli on 2018/07/06.
*/
public class 优惠券_兑换流程测试pyl_ExchangeTest extends DuibaTestBase {
@Autowired
private MobileService mobileService;
@Autowired
private Authorization authorization;
@Autowired
private CouponExchangeService couponExchangeService;
@Autowired
private DsOrderService dsOrderService;
@Autowired
ManagerService managerService;
@Autowired
DeveloperAccountService developerAccountService;
@Autowired
CrecordService crecordService;
@Autowired
LogService logService;
private DuibaLog logger = DuibaLog.getLogger();
// private MysqlUtils jdbc;
private String url = "http://activity.m.duibatest.com.cn";
//指定用户
private static int uid = 4478;
@Test(description = "自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示")
public void 兑换成功页添加跳转链接开启() throws Exception {
logger.info("自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示");
Response response = mobileService.appItemDetail(authorization.dafuwengLogin(uid), "185439");
// response.prettyPrint();
// logger.info( "response.prettyPrint()"+ response.asString());
Map<String, String> map = authorization.dafuwengLogin(uid,true);
// Iterator it = map.entrySet().iterator();
// while (it.hasNext()) {
// Map.Entry entry = (Map.Entry) it.next();
// Object key = entry.getKey();
// Object value = entry.getValue();
// System.out.println("key=" + key + " value=" + value);
// }
Assert.assertEquals(response.asString().contains("马上兑换"),true,"页面数据返回错误");
logger.info("校验 页面数据文本信息 成功");
response = couponExchangeService.couponExchange(authorization.dafuwengLogin(uid),"185439",null);
String orderId = response.jsonPath().getString("orderId");
logger.info("订单号:" + orderId);
response = mobileService.orderStatusQuery(authorization.dafuwengLogin(uid), orderId);
response.prettyPrint();
String status = response.jsonPath().getString("status");
//异步接口
int i = 10;
while (i > 0 && status.equals("processing")) {
Thread.sleep(1000);
response = mobileService.orderStatusQuery(authorization.dafuwengLogin(uid), orderId);
response.prettyPrint();
status = response.jsonPath().getString("status");
i--;
}
// response.prettyPrint();
Response resultResponse = crecordService.recordDetail(orderId,uid);
//resultResponse.prettyPrint();
String exchangeText = MatcherString.getString(resultResponse.asString(), "\"btnText\":\"(.*?)\",", 1);
logger.info("exchangeText"+exchangeText);
Assert.assertEquals(resultResponse.asString().contains("马上使用"),true,"页面数据返回错误");
Assert.assertEquals(exchangeText,"马上使用","页面数据返回错误");
logger.info("自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示息 成功");
}
@Test(description = "自有优惠券兑换失败兑换条展示错乱 bugid=908131")
public void 优惠券兑换失败兑换条展示错乱() throws Exception {
logger.info("自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示");
Response response = mobileService.appItemDetail(authorization.dafuwengLogin(uid), "185529");
Map<String, String> map = authorization.dafuwengLogin(uid,true);
Assert.assertEquals(response.asString().contains("马上兑换"),true,"页面数据返回错误");
logger.info("校验 页面数据文本信息 成功");
response = couponExchangeService.couponExchange(authorization.dafuwengLogin(uid),"185529",null);
String orderId = response.jsonPath().getString("orderId");
logger.info("订单号:" + orderId);
response = mobileService.orderStatusQuery(authorization.dafuwengLogin(uid), orderId);
response.prettyPrint();
String status = response.jsonPath().getString("status");
//异步接口
int i = 10;
while (i > 0 && status.equals("processing")) {
Thread.sleep(1000);
response = mobileService.orderStatusQuery(authorization.dafuwengLogin(uid), orderId);
response.prettyPrint();
status = response.jsonPath().getString("status");
i--;
}
// response.prettyPrint();
Response resultResponse = crecordService.recordDetailNew(orderId,uid);
resultResponse.prettyPrint();
String exchangeText = MatcherString.getString(resultResponse.asString(), "\"isShowButton\":(.*?),", 1);
logger.info("exchangeText:"+exchangeText);
Assert.assertEquals(exchangeText,"false","页面数据返回错误");
Assert.assertEquals(resultResponse.asString().contains("马上兑换"),false,"页面数据返回错误");
//Assert.assertEquals(resultResponse.asString().contains("审核中"),true,"页面数据返回错误");
logger.info("自有优惠券兑换失败兑换条展示错乱 成功");
}
@Test(description = "自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示")
public void 兑换成功页添加界面按钮显示且可以正常调转() throws Exception {
logger.info("自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示");
Response response = mobileService.appItemDetail(authorization.dafuwengLogin(uid), "185571");
// response.prettyPrint();
// logger.info( "response.prettyPrint()"+ response.asString());
Map<String, String> map = authorization.dafuwengLogin(uid,true);
Assert.assertEquals(response.asString().contains("马上兑换"),true,"页面数据返回错误");
logger.info("校验 页面数据文本信息 成功");
response = couponExchangeService.couponExchange(authorization.dafuwengLogin(uid),"185571",null);
String orderId = response.jsonPath().getString("orderId");
logger.info("订单号:" + orderId);
response = mobileService.orderStatusQuery(authorization.dafuwengLogin(uid), orderId);
response.prettyPrint();
String status = response.jsonPath().getString("status");
//异步接口
int i = 10;
while (i > 0 && status.equals("processing")) {
Thread.sleep(1000);
response = mobileService.orderStatusQuery(authorization.dafuwengLogin(uid), orderId);
response.prettyPrint();
status = response.jsonPath().getString("status");
i--;
}
// response.prettyPrint();
Response resultResponse = crecordService.recordDetail(orderId,uid);
//resultResponse.prettyPrint();
String exchangeText = MatcherString.getString(resultResponse.asString(), "\"btnText\":\"(.*?)\",", 1);
logger.info("exchangeText"+exchangeText);
Assert.assertEquals(resultResponse.asString().contains("马上兑换"),true,"页面数据返回错误");
Assert.assertEquals(exchangeText,"马上兑换","页面数据返回错误");
exchangeText = MatcherString.getString(resultResponse.asString(), "\"androidDownloadUrl\":\"(.*?)\",", 1);
String url=exchangeText;
logger.info("url:"+url);
// resultResponse.prettyPrint();
Assert.assertEquals(resultResponse.asString().contains("www.baidu.com"),true,"按钮对应的连接数据返回错误");
logger.info("自有优惠券商品兑换成功页添加跳转链接开启,界面按钮显示息 成功");
}
}
package http.cases.ExchangeTest;
import base.DuibaTestBase;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.app.MobileService;
import http.service.app.VirtualExchangeService;
import base.DuibaLog;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.Map;
/**
* Created by yeqinqin on 2018/6/11.
*/
public class 虚拟商品_兑换异常测试 extends DuibaTestBase {
@Autowired
private MobileService mobileService;
@Autowired
private Authorization authorization;
@Autowired
ManagerService managerService;
@Autowired
VirtualExchangeService virtualExchangeService;
private DuibaLog logger = DuibaLog.getLogger();
//指定用户
private static int uid = 0;
//实物兑换积分不足
@Test(description = "自有虚拟商品积分不足")
public void 积分不足() throws Exception {
//活动详情页
Response response = mobileService.appItemDetail(authorization.dafuwengLogin(uid), "181159");
Map<String, String> map = authorization.dafuwengLogin(uid,true);
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "商品详情页面");
response.prettyPrint();
System.out.println(response.asString());
System.out.println("女汉子");
//自有虚拟商品兑换
response = virtualExchangeService.exchange(authorization.dafuwengLogin(uid), "181159", "123");
//获取orderId
String orderId = response.jsonPath().getString("orderId");
response = mobileService.orderAmbStatusQuery(uid,orderId);
response.prettyPrint();
String message = response.jsonPath().getString("data.message");
//异步接口,直到兑换成功
int i=10;
//异步接口,直到兑换成功
while(i>0&&"兑换正在处理中...".equals(message)){
Thread.sleep(1000);
response = mobileService.orderAmbStatusQuery(uid,orderId);
response.prettyPrint();
message = response.jsonPath().getString("data.message");
i--;
}
Assert.assertEquals(message.trim(),"兑换失败,用户积分余额不足","校验自有虚拟商品积分不足");
}
}
......@@ -188,9 +188,9 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
logger.info("-------------------------------------"+data.get("casename")+"-------------------------------------");
//获取管理员后台活动信息
Response ManagerResponse = managerService.edit(data.get("actId"));
Response ManagerResponse = managerService.getDataEditConfig(data.get("actId"));
//获取奖品剩余库存
String appItemId = String.valueOf(ManagerResponse.jsonPath().getString("data.awards[1].appItemId"));
String appItemId = String.valueOf(ManagerResponse.jsonPath().getString("awards[1].appItemId"));
String Objremaind = this.getremind(appItemId);
logger.info("预设必中奖品类型为:"+ManagerResponse.jsonPath().getString("data.awards[1].type"));
logger.info("预设中奖几率为:"+ManagerResponse.jsonPath().getString("data.awards[1].probability")+"%");
......@@ -198,7 +198,7 @@ public class 抽奖异常测试_DuibaTest extends DuibaTestBase {
logger.info("预设剩余奖品数:"+ManagerResponse.jsonPath().getString("data.awards[1].remaind")+"个");
logger.info("预设奖品库存:"+Objremaind+"个");
if (Objremaind.equals("0")){
Assert.assertEquals(ManagerResponse.jsonPath().getString("data.awards[1].valid"),"false","校验奖品是否有效失败");
Assert.assertEquals(ManagerResponse.jsonPath().getString("awards[1].valid"),"false","校验奖品是否有效失败");
}
//进行接口测试传参
......
......@@ -15,7 +15,7 @@ import org.testng.annotations.Test;
/**
* Created by humengxin on 2018/11/02.
* Created by humengxin on 2018/11/08.
*/
@ContextConfiguration(classes = Config.class)
......@@ -82,10 +82,44 @@ public class 商品管理操作_DuibaTest extends AbstractTestNGSpringContextTes
logger.info("校验title,belong成功");
// 查看完存在后,再删除复制的app数据
String ids3 = response2.jsonPath().getString("data.list[0].id");
logger.info(ids3);
String ids4 = response2.jsonPath().getString("data.list[1].id");
logger.info(ids4);
//先删除20979 app数据
czService.doBatchDel2(ids3,ids4);
}
@Test(description = "批量复制-兑吧定向商品")
public void c_批量复制兑吧定向商品() throws Exception {
String data = PublicMethod.data();
//查询实物商品集合
Response response= czService.appItems3();
// 获取到兑吧定向商品id
String ids = response.jsonPath().getString("data.list[0].id");
String ids2 = response.jsonPath().getString("data.list[1].id");
//复制到另一个app
Response response2= czService.batchCopy(ids,ids2);
//提示兑吧商品不支持复制
Assert.assertEquals(response2.jsonPath().getString("data.errorList[0].message"), "定向商品不支持复制", "校验异常场景失败");
Assert.assertEquals(response2.jsonPath().getString("data.errorList[0].title"), "【SaaS-自动化测试】实物勿动", "校验title失败");
logger.info("校验message,title成功");
}
@Test(description = "批量删除")
public void c_批量删除() throws Exception {
public void d_批量删除() throws Exception {
String data = PublicMethod.data();
......@@ -94,11 +128,83 @@ public class 商品管理操作_DuibaTest extends AbstractTestNGSpringContextTes
// 获取到上架商品id
String ids = response.jsonPath().getString("data.list[0].id");
String ids2 = response.jsonPath().getString("data.list[1].id");
//先删除19515 app数据
czService.doBatchDel(ids,ids2);
}
@Test(description = "添加商品分组并把2个商品加入分组")
public void e_添加分组() throws Exception {
String data=PublicMethod.data();
//添加商品分组
czService.editClassify();
// 查询商品分组是否添加成功
czService.classify();
//先添加2个商品,加入到商品分组中
developerVirtualService.doUpdateVirtual("【自动化】加钱购自有虚拟商品"+data,"标识符100=10+1");
developerVirtualService.doUpdateVirtual("【自动化】加钱购自有虚拟商品"+data,"标识符100=10+1");
//查询实物商品集合
Response response= czService.appItems();
// 获取到上架商品id
String s1 = response.jsonPath().getString("data.list[0].id");
String s2 = response.jsonPath().getString("data.list[1].id");
Response response2= czService.classify();
String classifyId = response2.jsonPath().getString("data.list[0].id");
czService.saveToClassify(classifyId,s1,s2);
//查询商品分组集合,确认2个商品是否添加到分组中
Response response3=czService.classify();
//查看商品列表确认是否上架成功
Assert.assertEquals(response3.jsonPath().getString("data.list[0].appItemNum"),"2", "校验商品加入分组成功");
Assert.assertEquals(response3.jsonPath().getString("data.list[0].name"),"【自动化】商品分组1", "校验商品分组名称失败");
logger.info("校验商品分组成功");
}
@Test(description = "移除分组")
public void f_移除分组() throws Exception {
String data=PublicMethod.data();
Response response=czService.classify();
String classifyId = response.jsonPath().getString("data.list[0].id");
Response response2=czService.appItems4(classifyId);
String appItemId=response2.jsonPath().getString("data.list[0].id");
String appItemId2=response2.jsonPath().getString("data.list[1].id");
//移除分组
czService.removeClassifyAppItem(appItemId,classifyId);
czService.removeClassifyAppItem(appItemId2,classifyId);
Assert.assertEquals(czService.removeClassifyAppItem(appItemId,classifyId).jsonPath().getString("data.message"),"移除成功", "校验移除商品接口成功");
logger.info("校验移除商品分组成功");
}
@Test(description = "删除分组")
public void g_删除分组() throws Exception {
String data=PublicMethod.data();
String classifyId = czService.classify().jsonPath().getString("data.list[0].id");
czService.deleteClassify(classifyId);
// 查询商品分组列表
Response response=czService.classify();
Assert.assertEquals(response.jsonPath().getString("data.totalCount"),"0", "校验商品分组删除接口失败");
logger.info("校验商品分组删除接口成功");
}
}
......@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import utils.HbaseService;
import utils.PublicMethod;
......@@ -24,7 +25,7 @@ import static io.restassured.RestAssured.given;
/**
* Created by 赵然 on 2018/11/06
*/
public class 账户余额清零 extends DuibaTestBase {
public class 账户余额清零_AccessTest extends DuibaTestBase {
@Value("${activity.host}")
String activityHost;
@Autowired
......@@ -39,25 +40,29 @@ public class 账户余额清零 extends DuibaTestBase {
//指定用户
private static int uid = 4486;
private static String consumerId = "100098059";
private static int uid2 = 4660;
private static String consumerId2 = "100104140";
@AfterClass
public void afterclass() {
@BeforeClass
public void beforeclass() {
try {
//修改账户过期时间,确保账户始终处于过期状态
jdbc.update("update consumer_account_log.tb_expire_consumer_account set gmt_modified ='" + getTime(-1) + "' where account_id = '" + consumerId + "_6_0'");
//删除过期记录
jdbc.update("delete from consumer_account_log.tb_consumer_accounts_log where account_id = '"+consumerId+"_6_0' and biz_type=10");
//重置账户金额10000
jdbc.update("update consumer_accounts.tb_consumer_account_0011 set balance_amount ='10000' where account_id = '" + consumerId + "_6_0'");
} catch (Exception e) {
walletAccountService.updateConsumerAccount(consumerId,"6","10000");
} catch (Exception e) {
logger.info("数据后面置操作异常");
}
}
@Test
@Test(description = "过期日前账户余额>0")
public void a_账户过期余额清零() throws Exception {
//修改账户过期时间,确保账户始终处于过期状态
jdbc.update("update consumer_account_log.tb_expire_consumer_account set gmt_modified ='" + getTime(-1) + "' where account_id = '"+consumerId+"_6_0'");
//删除过期记录
jdbc.update("delete from consumer_account_log.tb_consumer_accounts_log where account_id = '"+consumerId+"_6_0' and biz_type='10'");
//删除自动化充值记录
jdbc.update("delete from consumer_account_log.tb_consumer_accounts_log where account_id = '"+consumerId+"_6_0' and biz_type='19'");
Map<String, Object> sqlResult = jdbc.findSimpleResult("select * from consumer_account_log.tb_expire_consumer_account where account_id = '"+consumerId+"_6_0' ");
String gmt_modified1 = String.valueOf(sqlResult.get("gmt_modified"));
logger.info("账户第一次登录时间为" + gmt_modified1);
......@@ -86,39 +91,67 @@ public class 账户余额清零 extends DuibaTestBase {
}
@Test
@Test(description = "过期日前账户余额>0")
public void b_扣款明细校验() throws Exception {
//获取数据库扣款记录
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_account_log.tb_consumer_accounts_log where account_id = '"+consumerId+"_6_0' and biz_type=10");
if(!selectResult.isEmpty() ||selectResult.equals("")||selectResult.equals(null) ) {
String change_money = String.valueOf(selectResult.get("change_money"));
String action_type = String.valueOf(selectResult.get("action_type"));
String sub_type = String.valueOf(selectResult.get("sub_type"));
String biz_description = String.valueOf(selectResult.get("biz_description"));
Assert.assertEquals(change_money, "10000", "数据库扣款金额校验失败");
Assert.assertEquals(action_type, "0", "数据库账户动作校验失败");
Assert.assertEquals(sub_type, "0", "数据库日志类型校验失败");
Assert.assertEquals(biz_description.contains("红包过期"), true, "数据库业务描述校验失败");
logger.info("数据库账户过期清零记录校验成功");
//获取最新的提现记录
Map cookies = authorization.dafuwengLogin(uid);
Response response = walletAccountService.walletDetail(cookies);
String money = response.jsonPath().getString("data[1].money");
String subType = response.jsonPath().getString("data[1].subType");
String description = response.jsonPath().getString("data[1].description");
Assert.assertTrue(new BigDecimal(money).compareTo(new BigDecimal("100"))==0,"扣款金额校验失败");
Assert.assertEquals(subType, "0", "日志类型校验失败");
Assert.assertEquals(description.contains("红包过期"),true, "日志类型校验失败");
logger.info("订单列表过期记录校验成功");
}else{
logger.info("数据库未生成扣款记录,有可能是用例距离上一次执行时间过短");
}
String change_money = String.valueOf(selectResult.get("change_money"));
String action_type = String.valueOf(selectResult.get("action_type"));
String sub_type = String.valueOf(selectResult.get("sub_type"));
String biz_description = String.valueOf(selectResult.get("biz_description"));
Assert.assertEquals(change_money, "10000", "数据库扣款金额校验失败");
Assert.assertEquals(action_type, "0", "数据库账户动作校验失败");
Assert.assertEquals(sub_type, "0", "数据库日志类型校验失败");
Assert.assertEquals(biz_description.contains("红包过期"), true, "数据库业务描述校验失败");
logger.info("数据库账户过期清零记录校验成功");
//获取最新的提现记录
Map cookies = authorization.dafuwengLogin(uid);
Response response = walletAccountService.walletDetail(cookies);
String money = response.jsonPath().getString("data[1].money");
String subType = response.jsonPath().getString("data[1].subType");
String description = response.jsonPath().getString("data[1].description");
Assert.assertTrue(new BigDecimal(money).compareTo(new BigDecimal("100"))==0,"扣款金额校验失败");
Assert.assertEquals(subType, "0", "日志类型校验失败");
Assert.assertEquals(description.contains("红包过期"),true, "日志类型校验失败");
logger.info("订单列表过期记录校验成功");
}
@Test(description = "过期日前账户余额=0")
public void c_账户过期余额清零2() throws Exception {
//修改账户过期时间,确保账户始终处于过期状态
jdbc.update("update consumer_account_log.tb_expire_consumer_account set gmt_modified ='" + getTime(-1) + "' where account_id = '"+consumerId2+"_6_0'");
Map<String, Object> sqlResult = jdbc.findSimpleResult("select * from consumer_account_log.tb_expire_consumer_account where account_id = '"+consumerId2+"_6_0' ");
String gmt_modified1 = String.valueOf(sqlResult.get("gmt_modified"));
logger.info("账户第一次登录时间为" + gmt_modified1);
//获取原账户余额
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0972 where account_id = '"+consumerId2+"_6_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
Assert.assertEquals(balance,0,"查询账户余额失败");
logger.info("账户原有余额为" + balance);
//dafuweng登陆获取cookies
Map cookies = authorization.dafuwengLogin(uid2);
//调用获取getWalletAccount,获取账户金额
Response response = walletAccountService.getWalletAccount(cookies);
String balanceAmount = response.jsonPath().getString("balanceAmount");
//校验,与数据对比
Assert.assertTrue(new BigDecimal(balanceAmount).compareTo(new BigDecimal("0"))==0,"钱包账户未清零");
logger.info("账户过期清零成功");
sqlResult = jdbc.findSimpleResult("select * from consumer_account_log.tb_expire_consumer_account where account_id = '"+consumerId2+"_6_0' ");
String gmt_modified2 = String.valueOf(sqlResult.get("gmt_modified"));
logger.info("账户第二次登录时间为" + gmt_modified2);
Assert.assertEquals(gmt_modified1.equals(gmt_modified2)==false,true);
}
public String getTime(int amount){
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd", Locale.ENGLISH);
......
......@@ -135,4 +135,32 @@ public class WalletAccountService {
return response;
}
/**
* 红包账户修改钱包账户余额后门
* @param consumerId
* @param accountType
* @param balanceAmount
* @return
* @throws Exception
*/
public void updateConsumerAccount(String consumerId,String accountType,String balanceAmount) throws Exception {
logger.info("请求修改钱包账户余额后门:updateConsumerAccount");
Map<String,String> map = new HashMap<>();
map.put("consumerId",consumerId);
map.put("accountType",accountType);
map.put("balanceAmount",balanceAmount);
Response response = given().params(map).get(activityHost+"/aaw/automated/updateConsumerAccount");
// try{
// Assert.assertEquals(response.jsonPath().getString("success"),"true","/walletAccount/walletDetail接口失败");
//
// }catch(Exception e){
// throw new Exception("/aaw/automated/updateConsumerAccount接口失败,返回信息:"+response.asString());
// }catch(Error er){
// throw new Exception("/aaw/automated/updateConsumerAccount接口失败,返回信息:"+response.asString());
//
// }
//return response;
}
}
......@@ -56,4 +56,5 @@ public class CrecordService {
return response;
}
}
package http.service.app;
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 java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
@Service
public class LogService {
@Value("${trade.host}")
private String tradeHost;
@Autowired
Authorization authorization;
//优惠券使用按钮
public Response redirect(String url,int uid){
Map<String,String> map = new HashMap<>();
map.put("url",url);
map.put("dpm","2239.25.1.0");
map.put("dcm","102.185571.0.0");
map.put("couponcode","10000106");
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).get("http://"+tradeHost+"/log/redirect");
return response;
}
}
......@@ -32,7 +32,7 @@ public class MobileService {
}
public Response appItemDetail(Map cookies,String itemId){
/* public Response appItemDetail(Map cookies,String itemId){
Map<String,String> map = new HashMap<>();
map.put("itemId",itemId);
map.put("dpm","1.5.183.5");
......@@ -41,8 +41,27 @@ public class MobileService {
response.prettyPrint();
return response;
}
}*/
public Response appItemDetail(Map cookies,String appItemId) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("appItemId",appItemId);
map.put("dpm","1.5.183.5");
map.put ("dcm","102.181159.0.0");
logger.info("请求商品详情页面");
Response response = given().cookies(cookies).params(map).get("http://"+goodsHost+"/mobile/appItemDetail");
try {
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "/mobile/appItemDetail接口失败");
} catch (Exception e) {
throw new Exception("/mobile/appItemDetail接口失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("/mobile/appItemDetail接口失败,返回信息:" + response.asString());
}
return response;
}
// public Response orderStatusQuery(Cookies cookies,String orderId){
//
......
......@@ -29,12 +29,10 @@ public class VirtualExchangeService {
logger.info("请求/virtualExchange/exchange接口");
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(cookies).params(map).post("http://"+goodsHost+"/virtualExchange/exchange");//couponExchange
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
System.out.println("");
response.prettyPrint();
}catch(Exception e){
throw new Exception("/objectExchange/exchange接口返回异常,返回信息:"+response.asString());
}catch(Error er){
......
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