Commit d46e72b7 authored by 胡梦新's avatar 胡梦新

hmx

parent 99220cd4
......@@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
import org.testng.annotations.Test;
import utils.PublicMethod;
@ContextConfiguration(classes = Config.class)
public class 补给站 extends DuibaTestBase {
......@@ -32,22 +31,23 @@ public class 补给站 extends DuibaTestBase {
public void a_添加至尊版实物() throws Exception{
//查询列表,获取ID
Response response =developerBJZ.items("2",appId);
String id= String.valueOf(response.jsonPath().getString("data.list[0].id"));
String title= String.valueOf(response.jsonPath().getString("data.list[0].title"));
String itemId= String.valueOf(response.jsonPath().getString("data.list[0].id"));
String itemIds= String.valueOf(response.jsonPath().getString("data.list[0].id"));
String appItemId=String.valueOf(response.jsonPath().getString("data.list[0].title"));
//添加
developerBJZ.ajaxAddRepo(appId,id);
developerBJZ.ajaxAddRepo(appId,itemId);
//上架
developerBJZ.ajaxDirectUp(appId,id);
developerBJZ.ajaxDirectUp(appId,itemIds);
//查询商品列表,验证商品是否上架成功
Response response2 =developerObjectService.appItems(appId,title);
String appItemId =response2.jsonPath().getString("data.list[0].id");
Response response2 =developerBJZ.appItems(appId,appItemId);
String appItemId2=response2.jsonPath().getString("data.list[0].id");
Assert.assertEquals(response2.jsonPath().getString("data.list[0].title"), "测试至尊享版-实物3", "校验实物标题失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[0].status"), "1", "校验实物状态失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[0].type"), "object", "校验实物类型失败");
logger.info("校验title,status成功");
logger.info("校验id,title,status,type成功");
//删除添加的商品
developerObjectService.ajaxDel(appItemId);
developerBJZ.ajaxDel(appId,appItemId2);
}
//旗舰版app添加、上架至尊版实物:异常场景,提示不能上架
......@@ -79,20 +79,20 @@ public class 补给站 extends DuibaTestBase {
//查询列表,获取ID
Response response =developerBJZ.coupons(appId,"2");
String id= String.valueOf(response.jsonPath().getString("data.list[0].id"));
String title= String.valueOf(response.jsonPath().getString("data.list[0].title"));
String appItemId= String.valueOf(response.jsonPath().getString("data.list[0].title"));
//添加
developerBJZ.ajaxAddRepo(appId,id);
//上架
developerBJZ.ajaxDirectUp(appId,id);
//查询商品列表,验证商品是否上架成功
Response response2 =developerObjectService.appItems(appId,title);
String appItemId = String.valueOf(response2.jsonPath().getString("data.list[0].id"));
Response response2 =developerBJZ.appItems(appId,appItemId);
String appItemId2 = String.valueOf(response2.jsonPath().getString("data.list[0].id"));
Assert.assertEquals(response2.jsonPath().getString("data.list[0].title"), "测试至尊享版-优惠券", "校验优惠券标题名称失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[0].status"), "1", "校验优惠券状态失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[0].type"), "coupon", "校验优惠券类型失败");
logger.info("校验title,status成功");
//删除添加的商品
developerObjectService.ajaxDel(appItemId);
logger.info("校验id,title,status,type成功");
//删除添加的优惠券
developerBJZ.ajaxDel(appId,appItemId2);
}
//旗舰版app添加、上架至尊版优惠券:异常场景,提示不能上架
......@@ -109,21 +109,69 @@ public class 补给站 extends DuibaTestBase {
@Test
public void f_添加直冲类() throws Exception{
String data= PublicMethod.data();
Response response1= developerBJZ.directCharges(appId);
String itemId=String.valueOf(response1.jsonPath().getString("data.list[1].id"));
String appItemId=String.valueOf(response1.jsonPath().getString("data.list[1].title"));
//添加直冲类
developerBJZ.ajaxAddRepo(appId,itemId);
//查询商品列表,验证商品是否添加成功
Response response2 =developerBJZ.appItems(appId);
String appItemId = String.valueOf(response2.jsonPath().getString("data.list[0].id"));
Response response2 =developerBJZ.appItems(appId,appItemId);
String appItemId2 = String.valueOf(response2.jsonPath().getString("data.list[0].id"));
Assert.assertEquals(response2.jsonPath().getString("data.list[0].title"), "Q币充值", "校验标题名称失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[0].status"), "0", "校验状态失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[0].type"), "qb", "校验优惠券类型失败");
logger.info("校验title,status成功");
//删除添加的商品
developerObjectService.ajaxDel(appItemId);
logger.info("校验title,status,type成功");
//删除添加的直冲类
developerBJZ.ajaxDel(appId,appItemId2);
}
//添加活动
@Test
public void g_添加活动() throws Exception{
//查询热门活动-活动列表,获取商品ID
Response response=developerBJZ.saasActivitys("3",appId);
String goodItemId= String.valueOf(response.jsonPath().getString("data.saasActivitys[0].id"));
//获取商品ID,进入商品订购页面,获取SKU
Response response2=developerBJZ.itemOrderDetail(goodItemId,appId);
String skuId= String.valueOf(response2.jsonPath().getString("data.goodsItemSku[0].skuId"));
//点击订购,传入SKU创建订单
logger.info("kuid==="+skuId);
Response response3=developerBJZ.createAutomationOrderNew(skuId,appId);
String orderid= String.valueOf(response3.jsonPath().getString("data"));
logger.info("kuid==="+orderid);
//下单购买
developerBJZ.orderAccountPay(orderid,appId);
//查询是否购买成功
Response response4=developerBJZ.findOrderById(orderid,appId);
Assert.assertEquals(response4.jsonPath().getString("data.vo.funcName"), "自动化测试活动--勿动", "校验名称失败");
Assert.assertEquals(response4.jsonPath().getString("data.vo.limitTime"), "一年", "校验购买期限失败");
logger.info("校验名称,期限成功");
}
//添加签到活动
@Test
public void h_添加签到活动() throws Exception{
//查询热门活动-活动列表,获取商品ID
Response response=developerBJZ.saasActivitys("2",appId);
String goodItemId= String.valueOf(response.jsonPath().getString("data.saasActivitys[1].id"));
//获取商品ID,进入商品订购页面,获取SKU
Response response2=developerBJZ.itemOrderDetail(goodItemId,appId);
String skuId= String.valueOf(response2.jsonPath().getString("data.goodsItemSku[0].skuId"));
//点击订购,传入SKU创建订单
logger.info("kuid==="+skuId);
Response response3=developerBJZ.createAutomationOrderNew(skuId,appId);
String orderid= String.valueOf(response3.jsonPath().getString("data"));
logger.info("kuid==="+orderid);
//下单购买
developerBJZ.orderAccountPay(orderid,appId);
//查询是否购买成功
Response response4=developerBJZ.findOrderById(orderid,appId);
Assert.assertEquals(response4.jsonPath().getString("data.vo.funcName"), "SaaS签到", "校验名称失败");
logger.info("校验名称成功");
}
}
......@@ -27,289 +27,308 @@ public class DeveloperBJZ {
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
//优质好货--查询至尊版特权TAB
public Response items(String type,String appId) throws Exception{
String url="http://"+hdHost+"/saasitem/items";
Map<String,String> map = new HashMap<>();
public Response items(String type, String appId) throws Exception {
String url = "http://" + hdHost + "/saasitem/items";
Map<String, String> map = new HashMap<>();
map.put("type",type);
map.put("rowId","1");
map.put("itemName","");
map.put("max","20");
// logger.info("********"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//搜索具体的实物
public Response items2(String type,String appId) throws Exception{
String url="http://"+hdHost+"/saasitem/items";
public Response items2(String type, String appId) throws Exception {
String url = "http://" + hdHost + "/saasitem/items";
Map<String,String> map = new HashMap<>();
map.put("type",type);
map.put("rowId","1");
map.put("itemName","测试至尊享版-实物3");
map.put("max","20");
// logger.info("********"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//搜索具体的实物,查出无结果
public Response items3(String type,String appId) throws Exception{
String url="http://"+hdHost+"/saasitem/items";
public Response items3(String type,String appId) throws Exception {
String url = "http://" + hdHost + "/saasitem/items";
Map<String,String> map = new HashMap<>();
map.put("type",type);
map.put("rowId","1");
map.put("itemName","测试至尊享版-实物31");
map.put("max","20");
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//至尊特权添加商品
public Response ajaxAddRepo(String appId,String itemId) throws Exception{
String url="http://"+hdHost+"/devRepo/ajaxAddRepo";
Map<String,String> map = new HashMap<>();
public Response ajaxAddRepo(String appId, String itemId) throws Exception {
String url = "http://" + hdHost + "/devRepo/ajaxAddRepo";
Map<String, String> map = new HashMap<>();
map.put("appId",appId);
map.put("itemId",itemId);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).post(url);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).post(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//至尊特权上架商品
public Response ajaxDirectUp(String appId,String itemIds) throws Exception{
String url="http://"+hdHost+"/devRepo/ajaxDirectUp";
Map<String,String> map = new HashMap<>();
public Response ajaxDirectUp(String appId, String itemIds) throws Exception {
String url = "http://" + hdHost + "/devRepo/ajaxDirectUp";
Map<String, String> map = new HashMap<>();
map.put("appId",appId);
map.put("itemIds",itemIds);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).post(url);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).post(url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"直接上架成功");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "直接上架成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//旗舰版app上架:至尊特权商品
public Response ajaxDirectUp2(String appId2,String itemIds) throws Exception{
String url="http://"+hdHost+"/devRepo/ajaxDirectUp";
Map<String,String> map = new HashMap<>();
map.put("appId",appId2);
map.put("itemIds",itemIds);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId2)).params(map).post(url);
public Response ajaxDirectUp2(String appId2, String itemIds) throws Exception {
String url = "http://" + hdHost + "/devRepo/ajaxDirectUp";
Map<String, String> map = new HashMap<>();
map.put("appId", appId2);
map.put("itemIds", itemIds);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId2)).params(map).post(url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"至尊版专享");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "至尊版专享");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//大牌好券--查询至尊版特权TAB
public Response coupons(String appId,String type) throws Exception{
String url="http://"+hdHost+"/saasitem/coupons";
Map<String,String> map = new HashMap<>();
public Response coupons(String appId, String type) throws Exception {
String url = "http://" + hdHost + "/saasitem/coupons";
Map<String, String> map = new HashMap<>();
map.put("appId",appId);
map.put("type",type);
map.put("rowId","1");
map.put("subType","");
map.put("max","12");
// logger.info("********"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//热门活动--查询活动
public Response saasActivitys(String categoryId,String appId) throws Exception{
String url="http://"+hdHost+"/saasitem/saasActivitys";
public Response saasActivitys(String categoryId, String appId) throws Exception {
String url = "http://" + hdHost + "/saasitem/saasActivitys";
Map<String,Object> map = new HashMap<>();
map.put("attrIds","");
map.put("rowId","1");
map.put("max","25");
map.put("categoryId",categoryId);
logger.info("********"+url);
logger.info("********" + url);
//json 格式转成form表单
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
Response response=given().contentType("application/json;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).body(jsonParam).post(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
Response response = given().contentType("application/json;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).body(jsonParam).post(url);
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//选中活动
public Response itemOrderDetail(String goodItemId,String appId) throws Exception{
String url="http://"+hdHost+"/saasitem/itemOrderDetail";
Map<String,String> map = new HashMap<>();
map.put("goodItemId",goodItemId);
public Response itemOrderDetail(String goodItemId, String appId) throws Exception {
String url = "http://" + hdHost + "/saasitem/itemOrderDetail";
Map<String, String> map = new HashMap<>();
map.put("goodItemId", goodItemId);
// logger.info("********"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//订购活动--创建订单
public Response createAutomationOrderNew(String skuId,String appId) throws Exception{
String url="http://"+hdHost+"/saas/createAutomationOrderNew";
Map<String,String> map = new HashMap<>();
map.put("skuId",skuId);
public Response createAutomationOrderNew(String skuId, String appId) throws Exception {
String url = "http://" + hdHost + "/saas/createAutomationOrderNew";
Map<String, String> map = new HashMap<>();
map.put("skuId", skuId);
// logger.info("********"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).post(url);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).post(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//订购--账户余额付款
public Response orderAccountPay(String orderId,String appId) throws Exception{
String url="http://"+hdHost+"/saas/orderAccountPay";
Map<String,String> map = new HashMap<>();
public Response orderAccountPay(String orderId, String appId) throws Exception {
String url = "http://" + hdHost + "/saas/orderAccountPay";
Map<String, String> map = new HashMap<>();
map.put("orderId",orderId);
// logger.info("********"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//查询购买的活动订单信息
public Response findOrderById(String orderId,String appId) throws Exception{
String url="http://"+hdHost+"/saas/findOrderById";
Map<String,String> map = new HashMap<>();
public Response findOrderById(String orderId, String appId) throws Exception {
String url = "http://" + hdHost + "/saas/findOrderById";
Map<String, String> map = new HashMap<>();
map.put("orderId",orderId);
// logger.info("********"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//查看记录是否添加购买成功
public Response selectOrders(String appId) throws Exception{
String url="http://"+hdHost+"/saas/selectOrders";
Map<String,String> map = new HashMap<>();
public Response selectOrders(String appId) throws Exception {
String url = "http://" + hdHost + "/saas/selectOrders";
Map<String, String> map = new HashMap<>();
map.put("orderStatus","2");
map.put("appId",appId);
// logger.info("********"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建接口1失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建接口2失败,返回信息:"+response.asString());
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);response.prettyPrint();
try {
Assert.assertEquals(response.jsonPath().getString("desc"), "成功");
} catch (Exception e) {
throw new Exception("创建接口1失败,返回信息:" + response.asString());
} catch (Error er) {
throw new Exception("创建接口2失败,返回信息:" + response.asString());
}
return response;
}
//查询直冲类商品
public Response directCharges(String appId) throws Exception{
String url="http://"+hdHost+"/saasitem/directCharges";
Map<String,String> map = new HashMap<>();
public Response directCharges(String appId) throws Exception {
String url = "http://" + hdHost + "/saasitem/directCharges";
Map<String, String> map = new HashMap<>();
map.put("rowId","1");
map.put("max","20");
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(url);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).get(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());
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 appItems(String appId) throws Exception{
String url="http://"+hdHost+"/devItem/appItems";
public Response appItems(String appId, String itemName) throws Exception {
String url = "http://" + hdHost + "/devItem/appItems";
Map<String,String> map = new HashMap<>();
map.put("rowId","1");
map.put("itemName","Q币充值");
map.put("appId","19515");
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).post(url);
map.put("rowId", "1");
map.put("itemType", "");
map.put("belong", "");
map.put("status", "");
map.put("priceType", "");
map.put("itemName",itemName);
map.put("appId",appId);
map.put("classifyId", "");
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).post(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());
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 ajaxDel(String appId,String appItemId) throws Exception {
String url = "http://" + hdHost + "/devItem/ajaxDel";
Map<String, String> map = new HashMap<>();
map.put("appId",appId);
map.put("appItemId",appItemId);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas(appId)).params(map).post(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;
}
}
......@@ -276,7 +276,7 @@ public class DeveloperObjectService {
map.put("belong","");
map.put("priceType","");
// logger.info("======="+url);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas("19515")).params(map).post(url);
Response response = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLoginSaas()).params(map).post(url);
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/devItem/appItems接口失败");
......@@ -296,7 +296,7 @@ public class DeveloperObjectService {
map.put("rowId","1");
map.put("appItemId",appItemId);
// logger.info("======="+url);
Response response = given().cookies(authorization.hdLoginSaas("19515")).params(map).post(url);
Response response = given().cookies(authorization.hdLoginSaas()).params(map).post(url);
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true","/devItem/ajaxDel接口失败");
}catch(Exception e){
......
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