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

hmx

parent d46e72b7
package http.cases.SaasDeveloperTest;
import base.Config;
import base.DuibaTestBase;
import http.service.Saas.DeveloperBJZ;
import base.DuibaLog;
import http.service.Saas.DeveloperObjectService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.Assert;
import org.testng.annotations.Test;
@ContextConfiguration(classes = Config.class)
public class 补给站 extends DuibaTestBase {
public class 补给站 extends AbstractTestNGSpringContextTests{
@Autowired
DeveloperBJZ developerBJZ;
@Autowired
DeveloperObjectService developerObjectService;
private DuibaLog logger = DuibaLog.getLogger();
//至尊版app
......@@ -26,44 +23,42 @@ public class 补给站 extends DuibaTestBase {
String appId2="21695";
//至尊版app添加、上架至尊版实物
@Test
@Test(description = "至尊版app添加、上架至尊版实物")
public void a_添加至尊版实物() throws Exception{
//查询列表,获取ID
Response response =developerBJZ.items("2",appId);
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"));
String itemName=String.valueOf(response.jsonPath().getString("data.list[0].title"));
//添加
developerBJZ.ajaxAddRepo(appId,itemId);
//上架
developerBJZ.ajaxDirectUp(appId,itemIds);
//查询商品列表,验证商品是否上架成功
Response response2 =developerBJZ.appItems(appId,appItemId);
Response response2 =developerBJZ.appItems(appId,itemName);
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("校验id,title,status,type成功");
logger.info("校验title,status,type成功");
//删除添加的商品
developerBJZ.ajaxDel(appId,appItemId2);
}
//旗舰版app添加、上架至尊版实物:异常场景,提示不能上架
@Test
@Test(description = "旗舰版app添加、上架至尊版实物:异常场景,提示不能上架")
public void b_旗舰版添加至尊版实物() throws Exception{
//查询列表,获取ID
Response response =developerBJZ.items("2",appId2);
String id= String.valueOf(response.jsonPath().getString("data.list[0].id"));
String id=String.valueOf(response.jsonPath().getString("data.list[0].id"));
//上架
Response response2=developerBJZ.ajaxDirectUp2(appId2,id);
//接口提示,至尊版专享,不能上架
Assert.assertEquals(response2.jsonPath().getString("desc"), "至尊版专享", "校验接口上架失败");
}
//优质好货搜索功能
@Test
@Test(description = "优质好货搜索功能")
public void c_实物搜索() throws Exception{
// 根据具体的名称搜索出实物
developerBJZ.items2("2",appId);
......@@ -73,30 +68,31 @@ public class 补给站 extends DuibaTestBase {
}
//添加、上架优惠券
@Test
@Test(description = "//添加、上架优惠券")
public void d_添加至尊版优惠券() throws Exception{
//查询列表,获取ID
Response response =developerBJZ.coupons(appId,"2");
String id= String.valueOf(response.jsonPath().getString("data.list[0].id"));
String appItemId= 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 itemName= 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 =developerBJZ.appItems(appId,appItemId);
Response response2 =developerBJZ.appItems(appId,itemName);
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("校验id,title,status,type成功");
logger.info("校验title,status,type成功");
//删除添加的优惠券
developerBJZ.ajaxDel(appId,appItemId2);
}
//旗舰版app添加、上架至尊版优惠券:异常场景,提示不能上架
@Test
@Test(description = "//旗舰版app添加、上架至尊版优惠券:异常场景,提示不能上架")
public void e_旗舰版添加至尊版优惠券() throws Exception{
//查询列表,获取ID
Response response =developerBJZ.coupons(appId2,"2");
......@@ -107,27 +103,27 @@ public class 补给站 extends DuibaTestBase {
Assert.assertEquals(response2.jsonPath().getString("desc"), "至尊版专享", "校验接口上架失败");
}
@Test
@Test(description = "//添加直冲类")
public void f_添加直冲类() throws Exception{
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"));
Response response= developerBJZ.directCharges(appId);
String itemId=String.valueOf(response.jsonPath().getString("data.list[1].id"));
String itemName=String.valueOf(response.jsonPath().getString("data.list[1].title"));
//添加直冲类
developerBJZ.ajaxAddRepo(appId,itemId);
//查询商品列表,验证商品是否添加成功
Response response2 =developerBJZ.appItems(appId,appItemId);
Response response2 =developerBJZ.appItems(appId,itemName);
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", "校验优惠券类型失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[0].type"), "qb", "校验类型失败");
logger.info("校验title,status,type成功");
//删除添加的直冲类
developerBJZ.ajaxDel(appId,appItemId2);
}
//添加活动
@Test
@Test(description = "//添加活动")
public void g_添加活动() throws Exception{
//查询热门活动-活动列表,获取商品ID
Response response=developerBJZ.saasActivitys("3",appId);
......@@ -151,8 +147,8 @@ public class 补给站 extends DuibaTestBase {
}
//添加签到活动
@Test
@Test(description = "//添加签到活动")
public void h_添加签到活动() throws Exception{
//查询热门活动-活动列表,获取商品ID
Response response=developerBJZ.saasActivitys("2",appId);
......
......@@ -32,7 +32,7 @@ public class 设置_应用信息_DuibaTest extends AbstractTestNGSpringContextTe
updateAppInfoService.UpdateAppInfo(appId,unitName,earnCreditsUrl,creditsDetailUrl,isDecimalOpen);
Response response2= updateAppInfoService.appInfo(appId);
Assert.assertEquals(response2.jsonPath().getString("data.name"), "(saas)接口自动化应用", "校验应用名称失败");
Assert.assertEquals(response2.jsonPath().getString("data.name"), "(saas自动化)至尊版", "校验应用名称失败");
Assert.assertEquals(response2.jsonPath().getString("data.earnCreditsLetter"), "积分文案&2", "校验积分文案失败");
Assert.assertEquals(response2.jsonPath().getString("data.creditsDetailUrl"), "https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com", "校验积分明细链接失败");
logger.info("保存应用信息成功");
......
......@@ -29,9 +29,9 @@ public class DeveloperBJZ {
private DuibaLog logger = DuibaLog.getLogger();
//优质好货--查询至尊版特权TAB
public Response items(String type, String appId) throws Exception {
public Response items(String type,String appId) throws Exception {
String url = "http://" + hdHost + "/saasitem/items";
Map<String, String> map = new HashMap<>();
Map<String,String> map = new HashMap<>();
map.put("type",type);
map.put("rowId","1");
map.put("itemName","");
......@@ -126,8 +126,8 @@ public class DeveloperBJZ {
//旗舰版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<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();
......
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