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("校验名称成功");
}
}
......@@ -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