Commit 44ee0265 authored by 赵然's avatar 赵然

zr

parents a3b57c44 344a25f3
......@@ -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("校验商品分组删除接口成功");
}
}
......@@ -32,7 +32,7 @@ public class VirtualExchangeService {
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
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