Commit 628a9bfb authored by Su-Yi's avatar Su-Yi

修改接口地址写法

parent 78e8c0bb
......@@ -16,7 +16,12 @@ import static com.kjj.qa.config.BasicConfig.*;
public class GreetingCard {
private static final NetworkUtil network = NetworkUtil.getInstance();
int tagId = 0;
String greetingName = "";
String contentId = "";
String scid = "";
String shareId = "";
String confId = "";
@BeforeClass
public void setUp() {
......@@ -52,7 +57,7 @@ public class GreetingCard {
}
// 获取539的贺卡列表
@Test(description="生日tab贺卡列表",priority = 3)
@Test(description="生日tab贺卡列表",priority = 4)
public void 生日tab贺卡列表() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageIndex", 1);
......@@ -62,11 +67,46 @@ public class GreetingCard {
Response response = network.getResponse(params,GREETING_PAGELIST);
boolean hasList = response.jsonPath().getInt("data.list.size()") > 0;
contentId = response.jsonPath().getString("data.list[0].id");
greetingName = response.jsonPath().getString("data.list[0].title");
Assert.assertTrue(hasList,network.message(params,GREETING_PAGELIST,"获取贺卡tab失败"));
}
// 贺卡详情页
@Test(description="贺卡详情页",priority = 5)
public void 贺卡详情页() throws IOException {
// 获取scId
Map<String, Object> params = new HashMap<String, Object>();
params.put("contentId", contentId);
Response response = network.getResponse(params,GETSCID);
scid = response.jsonPath().getString("data");
// 获取贺卡信息
Map<String, Object> infoParams = new HashMap<String, Object>();
infoParams.put("scid",scid);
response = network.getResponse(infoParams,GREETING_H5INFO);
String name = response.jsonPath().getString("data.title");
Assert.assertEquals(name,greetingName, network.message(infoParams,GREETING_H5INFO,"获取贺卡信息失败"));
}
// 获取H5分享信息
@Test(description="获取H5分享信息",priority = 7)
public void 获取H5分享信息() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("scid", scid);
params.put("createSource",1);
Response response = network.postResponse(params,GREETING_SAVEDEFAULT);
confId = response.jsonPath().getString("data");
Map<String, Object> shareParams = new HashMap<String, Object>();
shareParams.put("confId", confId);
response = network.getResponse(shareParams,GREETING_H5SHARE);
shareId = response.jsonPath().getString("data.id");
String title = response.jsonPath().getString("data.title");
Assert.assertEquals(title,greetingName,network.message(shareParams,GREETING_H5SHARE,"获取H5分享信息失败"));
}
// 我送出的贺卡列表
@Test(description="我送出的贺卡列表",priority = 3)
@Test(description="我送出的贺卡列表",priority = 8)
public void 我送出的贺卡列表() throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put("pageIndex", 1);
......@@ -76,8 +116,9 @@ public class GreetingCard {
Assert.assertFalse(hasList,network.message(params,GREETING_CONFLIST,"获取我的贺卡初始列表数量有误"));
}
@AfterClass
public static void tearDown(){
apiCount += 5;
apiCount += 8;
}
}
......@@ -72,7 +72,7 @@ public class Pay {
Response orderAppId = network.postResponse(payParams,PAY_ORDERCREATE);
String appId = orderAppId.jsonPath().getString("data.appId");
Assert.assertEquals(appId,"wxcb8c36279dd7dff2",network.message(payParams, PAY_ORDERCREATE,"拉起支付:拉起微信支付失败")); //判断返回的微信调起参数中appId是否正确
orderAppId.body().prettyPrint();
}
@Test (description = "默认付费_取消支付",priority = 3)
......@@ -101,7 +101,7 @@ public class Pay {
// }
@Test (description = "默认付费_切换会员类型为保险版",priority = 5)
public void 默认付费_切换为保险版会员类型并成功付款() throws IOException {
public void 默认付费_切换为保险版会员类型() throws IOException {
//会员类型版本判断
Map<String, Object> params = new HashMap<String, Object>();
params.put("t",System.currentTimeMillis());
......@@ -124,6 +124,12 @@ public class Pay {
Assert.assertEquals(userVersion,changeVersion,network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为尊享版"));
}
// 支付成功回调
@Test (description = "默认付费_支付成功回调",priority = 6)
public void 默认付费_支付成功回调() throws IOException {
}
@AfterClass
public static void tearDown() throws IOException, InterruptedException {
apiCount += 6;
......
......@@ -12,8 +12,7 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import static com.kjj.qa.config.BasicConfig.SSO_DOLOGIN;
import static com.kjj.qa.config.BasicConfig.SSO_HOST;
import static com.kjj.qa.config.BasicConfig.*;
import static io.restassured.RestAssured.given;
public class ManagerUtil {
......@@ -23,7 +22,6 @@ public class ManagerUtil {
public static void ssoLogin(){
// 请求下后台的管理员信息接口
network.host = MANAGER_HOST;
Response response = network.getResponse(MANAGER_ADMININFO);
String actualType = "application/json;charset=UTF-8";
String exceptType = response.headers().getValue("Content-Type");
......@@ -34,7 +32,6 @@ public class ManagerUtil {
}
// 1.先进入SSO登录框 登入管理后台
network.host = SSO_HOST;
Map<String, Object> loginParams = new HashMap<String, Object>();
loginParams.put("email","lihaohong");
loginParams.put("password","duiba123456");
......@@ -52,13 +49,10 @@ public class ManagerUtil {
ssoCookies = response.getCookies();
network.agentCookies.putAll(ssoCookies);
network.agentHeaders.put("X-Csrf-Token",ssoCookies.get("csrf_token"));
network.host = MANAGER_HOST;
}
// 拿到sellerId
public static String getSellerId (){
network.host = HOST;
Response response = network.getResponse(USER_INFO);
return response.jsonPath().getString("data.sellerId");
}
......@@ -93,7 +87,6 @@ public class ManagerUtil {
network.agentCookies.remove("sso_ticket");
network.agentCookies.remove("device_no");
network.agentCookies.remove("csrf_token");
network.host = HOST;
}
// 切换为内部人员 isInternalSeller 传1代表内部人员 传0代表非内部人员
......@@ -111,7 +104,6 @@ public class ManagerUtil {
network.agentCookies.remove("sso_ticket");
network.agentCookies.remove("device_no");
network.agentCookies.remove("csrf_token");
network.host = HOST;
}
......
......@@ -27,10 +27,6 @@ public class NetworkUtil {
public Map<String, Object> getFileHeaders() { return fileHeaders; }
public void setFileHeadersHeaders(Map<String, Object> fileHeaders) { this.fileHeaders = fileHeaders; }
public String host = "";
public String getHost() {return host;}
public void setHost(String host) {this.host = host;}
// 钉钉的 headers
public Map<String, Object> dingTalkHeaders = new HashMap<String, Object>();
public Map<String, Object> getDingTalkHeaders() { return dingTalkHeaders; }
......@@ -40,8 +36,6 @@ public class NetworkUtil {
// 构造函数 初始化tku、content-type
private NetworkUtil (){
//配置地址
host = HOST;
//cookies中的tku
agentCookies.put("tku",AGENT_TKU);
//json类型的headers
......@@ -73,7 +67,7 @@ public class NetworkUtil {
return given()
.cookies(agentCookies)
.headers(agentHeaders)
.get(host + path);
.get(path);
}
// get 带参请求
......@@ -82,7 +76,7 @@ public class NetworkUtil {
.cookies(agentCookies)
.headers(agentHeaders)
.params(params)
.get(host + path);
.get(path);
}
// post 不帶参请求
......@@ -90,7 +84,7 @@ public class NetworkUtil {
return given()
.cookies(agentCookies)
.headers(agentHeaders)
.post(host + path);
.post(path);
}
// post 带参请求
......@@ -100,7 +94,7 @@ public class NetworkUtil {
.cookies(agentCookies)
.headers(agentHeaders)
.body(jsonStr)
.post(host + path);
.post(path);
}
// post 文件上传
......@@ -109,7 +103,7 @@ public class NetworkUtil {
.cookies(agentCookies)
.headers(fileHeaders)
.multiPart("file",new File(filePath))
.post(host + path);
.post(path);
}
// 管理后台
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="客集集-测试结果" verbose="1" thread-count="3">
<suite name="客集集" verbose="1" thread-count="3">
<!-- <test preserve-order="true" name="首页" >-->
<!-- <classes>-->
<!-- <class name="com.kjj.qa.cases.Home"/>-->
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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