Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
马博
test-platform
Commits
0fc90c7a
Commit
0fc90c7a
authored
Nov 01, 2018
by
赵然
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zr' into develop
parents
c5ac9209
a78a1cd1
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
995 additions
and
0 deletions
+995
-0
异常订单测试.java
src/test/java/http/cases/SaasDeveloperTest/异常订单测试.java
+120
-0
自定义分类.java
src/test/java/http/cases/SaasDeveloperTest/自定义分类.java
+233
-0
自有优惠券测试_DuibaTest.java
.../java/http/cases/SaasDeveloperTest/自有优惠券测试_DuibaTest.java
+157
-0
自有实物测试_DuibaTest.java
...t/java/http/cases/SaasDeveloperTest/自有实物测试_DuibaTest.java
+115
-0
自有虚拟商品测试_DuibaTest.java
...java/http/cases/SaasDeveloperTest/自有虚拟商品测试_DuibaTest.java
+88
-0
计划任务_DuibaTest.java
...est/java/http/cases/SaasDeveloperTest/计划任务_DuibaTest.java
+158
-0
设置_应用信息_DuibaTest.java
.../java/http/cases/SaasDeveloperTest/设置_应用信息_DuibaTest.java
+40
-0
设置运费模板_DuibaTest.java
...t/java/http/cases/SaasDeveloperTest/设置运费模板_DuibaTest.java
+84
-0
No files found.
src/test/java/http/cases/SaasDeveloperTest/异常订单测试.java
0 → 100644
View file @
0fc90c7a
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
base.DuibaTestBase
;
import
http.service.Activity.ManagerService
;
import
http.service.Authorization
;
import
http.service.app.CouponExchangeService
;
import
http.service.app.CrecordService
;
import
http.service.app.MobileService
;
import
http.service.app.VirtualExchangeService
;
import
base.DuibaLog
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
import
java.util.HashMap
;
import
java.util.Map
;
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
异常订单测试
extends
DuibaTestBase
{
@Autowired
private
MobileService
mobileService
;
@Autowired
private
Authorization
authorization
;
@Autowired
private
CouponExchangeService
couponExchangeService
;
@Autowired
private
CrecordService
crecordService
;
@Autowired
ManagerService
managerService
;
@Autowired
VirtualExchangeService
virtualExchangeService
;
Map
<
String
,
String
>
userCookies
=
new
HashMap
<>();
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//指定用户
private
static
int
uid
=
2709
;
//实物兑换限制消费
@Test
(
description
=
"实物兑换已兑换"
)
public
void
已兑换
()
throws
Exception
{
//活动详情页
Response
response
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
uid
),
"28633"
);
// response.prettyPrint();
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
uid
,
true
);
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"活动详情页请求异常"
);
//实物兑换
Response
response1
=
couponExchangeService
.
objectExchange1
(
map
,
"167611"
,
"28633"
,
"null"
,
"z9sydmcs"
,
"null"
);
response1
.
prettyPrint
();
String
message2
=
response1
.
jsonPath
().
getString
(
"message"
);
Assert
.
assertEquals
(
message2
,
"已兑换"
,
"message字段校验失败-期望是已兑换"
);
}
@Test
(
description
=
"实物兑换无库存"
)
public
void
无库存
()
throws
Exception
{
Response
response
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
3661
),
"31051"
);
//uid3661
// response.prettyPrint();
Map
<
String
,
String
>
map
=
authorization
.
dafuwengLogin
(
3661
,
true
);
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"活动详情页请求异常"
);
//实物兑换
Response
response2
=
couponExchangeService
.
objectExchange2
(
map
,
"179139"
,
"null"
,
"null"
,
"z9sydmcs"
,
"null"
);
response2
.
prettyPrint
();
String
message3
=
response2
.
jsonPath
().
getString
(
"message"
);
Assert
.
assertEquals
(
message3
,
"今日已兑完,明天再来哦(14)"
,
"message字段校验失败-期望是无库存"
);
}
@BeforeMethod
public
void
获取用户登录信息
(){
userCookies
=
authorization
.
dafuwengLogin
(
3661
,
true
);
}
@Test
(
description
=
"实物兑换无库存并发"
)
public
void
并发
()
throws
Exception
{
Response
response
=
mobileService
.
detail
(
authorization
.
dafuwengLogin
(
3661
),
"31152"
);
//uid还可以为3662
// response.prettyPrint();
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"活动详情页请求异常"
);
//实物兑换
Response
response2
=
couponExchangeService
.
objectExchange2
(
userCookies
,
"179139"
,
"null"
,
"null"
,
"z9sydmcs"
,
"null"
);
response2
.
prettyPrint
();
String
message3
=
response2
.
jsonPath
().
getString
(
"message"
);
Assert
.
assertEquals
(
message3
,
"今日已兑完,明天再来哦(14)"
,
"message字段校验失败-期望是无库存"
);
//模拟10次同时请求
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
Thread
thread
=
new
Thread
(
new
MyRunnable
());
thread
.
setName
(
"thread"
+
i
);
thread
.
start
();
thread
.
join
();
}
}
class
MyRunnable
implements
Runnable
{
@Override
public
void
run
()
{
logger
.
info
(
"开始执行 "
);
try
{
Response
response2
=
couponExchangeService
.
objectExchange2
(
userCookies
,
"179139"
,
"null"
,
"null"
,
"z9sydmcs"
,
"null"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
src/test/java/http/cases/SaasDeveloperTest/自定义分类.java
0 → 100644
View file @
0fc90c7a
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
utils.PublicMethod
;
import
http.service.Saas.ZdyflService
;
import
base.DuibaLog
;
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
;
import
java.util.List
;
/**
* Created by humengxin on 2018/8/21.
*/
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
自定义分类
extends
AbstractTestNGSpringContextTests
{
@Autowired
ZdyflService
zdyflService
;
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@Test
(
description
=
"开发者创建自定义分类商品"
)
public
void
a_
添加自定义分类商品
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
//新建实物商品
zdyflService
.
editClassify
();
//查看商品列表确认商品成功添加
Response
response1
=
zdyflService
.
classify
();
// 获取自定义分类商品ID
String
classifyId
=
String
.
valueOf
(
response1
.
jsonPath
().
getString
(
"data.list[0].id"
));
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.list[0].name"
),
"hmx自动化"
,
"校验分类名称失败"
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.list[0].appId"
),
"2239"
,
"校验当前appid失败"
);
logger
.
info
(
"校验name,appid成功"
);
//删除测试数据
//zdyflService.deleteClassify("2239",classifyId);
}
@Test
(
description
=
"上架活动"
)
public
void
b_
上架活动
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
//新建实物商品
// 获取自定义分类商品ID
String
classifyId
=
String
.
valueOf
(
zdyflService
.
classify
().
jsonPath
().
getString
(
"data.list[0].id"
));
Response
response
=
zdyflService
.
list2
(
classifyId
);
// 获取活动ID
String
actId1
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[1].id"
));
String
actId2
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[2].id"
));
String
actId3
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[3].id"
));
String
newString
=
actId1
+
","
+
actId2
+
","
+
actId3
;
Response
response1
=
zdyflService
.
saveToClassify
(
classifyId
,
newString
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.length"
),
"3"
,
"校验活动个数失败"
);
logger
.
info
(
"校验上架活动 成功"
);
//删除测试数据
//zdyflService.deleteClassify("2239",classifyId);
}
@Test
(
description
=
"上架商品"
)
public
void
c_
上架商品
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
//新建实物商品
// 获取自定义分类商品ID
String
classifyId
=
String
.
valueOf
(
zdyflService
.
classify
().
jsonPath
().
getString
(
"data.list[0].id"
));
Response
response
=
zdyflService
.
classifyAppItem
(
"2239"
,
classifyId
);
Response
response2
=
zdyflService
.
classifyNoAppItem
(
classifyId
);
// 获取商品ID
String
Id1
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.list[2].itemid"
));
String
Id2
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.list[3].itemid"
));
String
Id3
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.list[4].itemid"
));
String
newString2
=
Id1
+
","
+
Id2
+
","
+
Id3
;
Response
response1
=
zdyflService
.
saveToClassify2
(
classifyId
,
newString2
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.length"
),
"3"
,
"校验商品个数失败"
);
logger
.
info
(
"校验 上架商品 成功"
);
//删除测试数据
//zdyflService.deleteClassify("2239",classifyId);
}
@Test
(
description
=
"预览自定义分类商品"
)
public
void
d_
预览自定义分类商品
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
// 获取自定义分类商品ID
String
classifyId
=
String
.
valueOf
(
zdyflService
.
classify
().
jsonPath
().
getString
(
"data.list[0].id"
));
Response
response
=
zdyflService
.
classifyPreview
(
classifyId
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.isRedirect"
),
"true"
,
"校验预览失败"
);
logger
.
info
(
"校验 预览自定义分类列表商品 成功"
);
//删除测试数据
//zdyflService.deleteClassify("2239",classifyId);
}
@Test
(
description
=
"活动移出分类"
)
public
void
e_
活动移出分类
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
// 获取自定义分类商品ID
String
classifyId
=
String
.
valueOf
(
zdyflService
.
classify
().
jsonPath
().
getString
(
"data.list[0].id"
));
//删除前,查看所有商品数
Response
response1
=
zdyflService
.
classifyAppItem
(
"2239"
,
classifyId
);
logger
.
info
(
"XXXXXXXXX"
+
response1
.
asString
());
// 获取活动ID
String
actId11
=
String
.
valueOf
(
response1
.
jsonPath
().
getString
(
"data.classifyItemDetails[5].operatingActivityId"
));
logger
.
info
(
"XXXXXXXXX"
+
actId11
);
Response
response2
=
zdyflService
.
removeClassifyAppItem1
(
classifyId
,
actId11
);
// Assert.assertEquals(response2.jsonPath().getString("message"),"移除成功", "校验活动个数失败");
logger
.
info
(
"校验 活动移出分类 成功"
);
//删除测试数据
//zdyflService.deleteClassify("2239",classifyId);
}
@Test
(
description
=
"商品移出分类"
)
public
void
f_
商品移出分类
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
//新建实物商品
// 获取自定义分类商品ID
String
classifyId
=
String
.
valueOf
(
zdyflService
.
classify
().
jsonPath
().
getString
(
"data.list[0].id"
));
//删除前,查看所有商品数
Response
response1
=
zdyflService
.
classifyAppItem
(
"2239"
,
classifyId
);
// 获取商品ID
String
Id1
=
String
.
valueOf
(
response1
.
jsonPath
().
getString
(
"data.classifyItemDetails[0].appItemId"
));
Response
response2
=
zdyflService
.
removeClassifyAppItem2
(
classifyId
,
Id1
);
//删除后,查看所有商品数
//Response response3 = zdyflService.classifyAppItem("2239",classifyId);
logger
.
info
(
"校验 商品移除分类 成功"
);
//删除测试数据
//zdyflService.deleteClassify("2239",classifyId);
}
@Test
(
description
=
"删除新建的自定义分类"
)
public
void
g_
删除新建的自定义分类
()
throws
Exception
{
//删除前,查看所有分类列表
Response
response1
=
zdyflService
.
classify
();
logger
.
info
(
"删除前,查看所有分类列表"
+
response1
.
asString
());
// 获取自定义分类商品ID
String
classifyId
=
String
.
valueOf
(
response1
.
jsonPath
().
getString
(
"data.list[0].id"
));
//删除测试数据,删除后,查看所有分类列表
Response
response2
=
zdyflService
.
deleteClassify
(
"2239"
,
classifyId
);
logger
.
info
(
"删除后,查看所有分类列表"
+
response2
.
asString
());
}
@Test
(
description
=
"手机端自定义icon页面分页数据重复问题 校验"
)
public
void
h_
分页数据重复问题
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
Response
response1
=
zdyflService
.
classifyAppItem
(
"2239"
,
"1278"
);
logger
.
info
(
"查询该自定义分类列表数据"
);
Response
response2
=
zdyflService
.
getClassify
(
"1"
);
System
.
out
.
println
(
"----------------"
+
response2
.
asString
());
String
string
=
response2
.
asString
();
//org.apache.commons.lang.StringEscapeUtils.unescapeJavaScript(response2.asString());
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response2
.
asString
());
JSONObject
jsonObject2
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
jsonObject
.
get
(
"data"
)));
List
<
String
>
items1
=
JSONObject
.
parseArray
(
JSON
.
toJSONString
(
jsonObject2
.
get
(
"items"
)),
String
.
class
);
//System.out.println("所有的第一页数据" + JSON.toJSONString(items1));
Response
response3
=
zdyflService
.
getClassify
(
"2"
);
System
.
out
.
println
(
"所有的第一页数据"
+
response2
.
asString
());
System
.
out
.
println
(
"所有的第二页数据"
+
response3
.
asString
());
JSONObject
jsonObject3
=
JSONObject
.
parseObject
(
response3
.
asString
());
JSONObject
jsonObject4
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
jsonObject3
.
get
(
"data"
)));
List
<
String
>
items2
=
JSONObject
.
parseArray
(
JSON
.
toJSONString
(
jsonObject4
.
get
(
"items"
)),
String
.
class
);
//System.out.println("所有的第二页数据" + JSON.toJSONString(items2));
items1
.
stream
().
forEach
(
item
->{
for
(
String
item2
:
items2
)
{
if
(
item2
.
equals
(
item
)){
System
.
out
.
println
(
"=========相同数据======="
);
System
.
out
.
println
(
"第一页"
+
item
);
System
.
out
.
println
(
"第二页"
+
item2
);
throw
new
RuntimeException
(
"=========相同数据======="
);
}
}
});
}
}
\ No newline at end of file
src/test/java/http/cases/SaasDeveloperTest/自有优惠券测试_DuibaTest.java
0 → 100644
View file @
0fc90c7a
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
utils.PublicMethod
;
import
http.service.Saas.DeveloperCouponService
;
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
自有优惠券测试
_DuibaTest
extends
AbstractTestNGSpringContextTests
{
@Autowired
DeveloperObjectService
developerObjectService
;
@Autowired
DeveloperCouponService
developerCouponService
;
//我的商品列表中的ID
private
static
String
appItemId
;
//实物上下架状态
private
static
String
status
;
private
static
String
data
;
private
static
String
data2
;
private
static
String
data3
;
private
static
String
data4
;
@Test
(
description
=
"添加自有优惠券重复券码"
)
public
void
a_
添加自有重复券
()
throws
Exception
{
//添加优惠券
data
=
PublicMethod
.
data
();
developerCouponService
.
doUpdateCoupon
(
"【自动化】自有重复券"
+
data
);
//查看商品列表确认商品成功添加
Response
response
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】自有重复券"
+
data
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化】自有重复券"
+
data
,
"校验优惠券title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].belong"
),
"自有"
,
"校验优惠券belong失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].type"
),
"coupon"
,
"校验优惠券type失败"
);
logger
.
info
(
"校验title,belong成功"
);
//获取商品id
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
//导入重复的券码
developerCouponService
.
doCFAddGoodsCouponsNew
(
"19515"
,
appItemId
);
//查看商品列表确认商品成功添加
Response
response2
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】自有重复券"
+
data
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化】自有重复券"
+
data
,
"校验优惠券title失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].belong"
),
"自有"
,
"校验优惠券belong失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].remaind"
),
"10000"
,
"校验优惠券remaind失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].type"
),
"coupon"
,
"校验优惠券type失败"
);
logger
.
info
(
"校验title,belong成功,remaind成功,type成功"
);
}
@Test
(
description
=
"上架实物商品或下架实物商品"
)
public
void
b_
上下架优惠券
()
throws
Exception
{
//查看商品列表确认商品成功添加
// logger.info("status===="+status);
Response
response
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】自有重复券"
+
data
);
status
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].status"
));
if
(
status
.
equals
(
"0"
)){
developerObjectService
.
standUp
(
appItemId
,
"up"
);
//查看商品列表,确认上架成功
Response
response1
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】自有重复券"
+
data
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.list[0].status"
),
"1"
,
"校验上架实物失败"
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.list[0].statusText"
),
"上架"
,
"校验上架实物失败"
);
logger
.
info
(
"校验实物上架成功"
);
}
else
{
developerObjectService
.
standUp
(
appItemId
,
"down"
);
//查看商品列表,确认下架成功
Response
response2
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】自有重复券"
+
data
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].status"
),
"0"
,
"校验下架实物失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].statusText"
),
"下架"
,
"校验下架实物失败"
);
logger
.
info
(
"校验实物下架成功"
);
}
}
//删除
@Test
(
description
=
"删除优惠券"
)
public
void
c_
删除优惠券
()
throws
Exception
{
developerObjectService
.
ajaxDel
(
appItemId
);
}
@Test
(
description
=
"添加自有优惠券链接券码"
)
public
void
d_
添加自有链接券
()
throws
Exception
{
//添加优惠券
data2
=
PublicMethod
.
data
();
developerCouponService
.
doUpdateCoupon
(
"【自动化】自有链接券"
+
data2
);
//查看商品列表确认商品成功添加
Response
response
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】自有链接券"
+
data2
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化】自有链接券"
+
data2
,
"校验优惠券title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].belong"
),
"自有"
,
"校验优惠券belong失败"
);
logger
.
info
(
"校验title,belong成功"
);
//获取商品id
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
//导入链接券码
developerCouponService
.
doLJAddGoodsCouponsNew
(
"19515"
,
appItemId
);
//查看商品列表确认商品成功添加
Response
response2
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】自有链接券"
+
data2
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化】自有链接券"
+
data2
,
"校验优惠券title失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].belong"
),
"自有"
,
"校验优惠券belong失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].remaind"
),
"10"
,
"校验优惠券remaind失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].type"
),
"coupon"
,
"校验优惠券type失败"
);
logger
.
info
(
"校验title,belong成功,remaind成功,type成功"
);
//删除
developerObjectService
.
ajaxDel
(
appItemId
);
}
@Test
(
description
=
"添加自有优惠券普通券码"
)
public
void
e_
添加自有普通券
()
throws
Exception
{
//添加优惠券
data3
=
PublicMethod
.
data
();
developerCouponService
.
doUpdateCoupon
(
"【自动化】自有普通券"
+
data3
);
//查看商品列表确认商品成功添加
Response
response
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】自有普通券"
+
data3
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化】自有普通券"
+
data3
,
"校验优惠券title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].belong"
),
"自有"
,
"校验优惠券belong失败"
);
logger
.
info
(
"校验title,belong成功"
);
//获取商品id
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
//导入普通的券码
developerCouponService
.
doPTAddGoodsCouponsNew
(
"19515"
,
appItemId
);
//上传需要时间,休眠5秒
Thread
.
sleep
(
5000
);
//查看商品列表确认商品成功添加
Response
response2
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】自有普通券"
+
data3
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化】自有普通券"
+
data3
,
"校验优惠券title失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].belong"
),
"自有"
,
"校验优惠券belong失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].remaind"
),
"9"
,
"校验优惠券remaind失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].type"
),
"coupon"
,
"校验优惠券type失败"
);
logger
.
info
(
"校验title,belong成功,remaind成功,type成功"
);
//删除
developerObjectService
.
ajaxDel
(
appItemId
);
}
@Test
(
description
=
"输入所有条件,新增加钱购优惠券"
)
public
void
f_
加钱购优惠券
()
throws
Exception
{
data4
=
PublicMethod
.
data
();
developerCouponService
.
doJQGUpdateCoupon
(
"【自动化】加钱购优惠券"
+
data4
);
//查看商品列表确认商品成功添加
Response
response
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】加钱购优惠券"
+
data4
);
//获取商品ID
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化】加钱购优惠券"
+
data4
,
"校验优惠券title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].belong"
),
"自有"
,
"校验优惠券belong失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].type"
),
"coupon"
,
"校验优惠券type失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].titleDownTxt"
),
"88积分 + 20.0元"
,
"校验加钱购status失败"
);
logger
.
info
(
"校验title,belong成功"
);
//删除
developerObjectService
.
ajaxDel
(
appItemId
);
}
}
src/test/java/http/cases/SaasDeveloperTest/自有实物测试_DuibaTest.java
0 → 100644
View file @
0fc90c7a
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
utils.PublicMethod
;
import
http.service.Saas.DeveloperObjectService
;
import
base.DuibaLog
;
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
;
/**
* 〈开发者后台--商品--添加、修改、删除积分实物测试〉
*
* @author wangxiaoshuang
*/
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
自有实物测试
_DuibaTest
extends
AbstractTestNGSpringContextTests
{
@Autowired
DeveloperObjectService
objectService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//实物商品列表中的ID
private
static
String
appItemId
;
//实物上下架状态
private
static
String
status
;
private
static
String
data
;
@Test
(
description
=
"添加实物,放入仓库"
)
public
void
a_
添加自有实物
()
throws
Exception
{
data
=
PublicMethod
.
data
();
//新建实物商品---放入仓库
objectService
.
doUpdateObject
(
"【自动化】自有实物"
+
data
,
""
,
"no"
,
"0"
,
"1"
,
"0"
);
//查看商品列表确认商品成功添加
Response
response
=
objectService
.
appItems
(
"19515"
,
"【自动化】自有实物"
+
data
);
//获取商品id
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
status
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].status"
));
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化】自有实物"
+
data
,
"校验活动title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].belong"
),
"自有"
,
"校验活动belong失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].status"
),
"0"
,
"校验活动status失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].type"
),
"object"
,
"校验活动type失败"
);
logger
.
info
(
"校验title,belong成功"
);
}
@Test
(
description
=
"上架实物商品或下架实物商品"
)
public
void
b_
上下架实物
()
throws
Exception
{
//查看商品列表确认商品成功添加
Response
response
=
objectService
.
appItems
(
"19515"
,
"【自动化】自有实物"
+
data
);
// String status = String.valueOf(response.jsonPath().getString("data.list[0].status"));
// appItemId = String.valueOf(response.jsonPath().getString("data.list[0].id"));
logger
.
info
(
"status===="
+
status
);
if
(
status
.
equals
(
"0"
)){
objectService
.
standUp
(
appItemId
,
"up"
);
//查看商品列表,确认上架成功
Response
response1
=
objectService
.
appItems
(
"19515"
,
"【自动化】自有实物"
+
data
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.list[0].status"
),
"1"
,
"校验上架实物失败"
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.list[0].statusText"
),
"上架"
,
"校验上架实物失败"
);
logger
.
info
(
"校验实物上架成功"
);
}
else
{
objectService
.
standUp
(
appItemId
,
"down"
);
//查看商品列表,确认下架成功
Response
response2
=
objectService
.
appItems
(
"19515"
,
"【自动化】自有实物"
+
data
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].status"
),
"0"
,
"校验下架实物失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].statusText"
),
"下架"
,
"校验下架实物失败"
);
logger
.
info
(
"校验实物下架成功"
);
}
}
@Test
public
void
c_
删除实物
()
throws
Exception
{
objectService
.
ajaxDel
(
appItemId
);
}
@Test
(
description
=
"添加加钱购实物后放入仓库"
)
public
void
d_
加钱购实物放入仓库
()
throws
Exception
{
//新建实物商品---放入仓库
objectService
.
doUpdateObjectMoney
(
""
,
"no"
,
"100"
,
"9"
);
//查看商品列表确认商品成功添加
Response
response
=
objectService
.
appItems
(
"19515"
,
"【自动化】接口测试-加钱购"
);
//获取商品id
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
status
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].status"
));
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化】接口测试-加钱购"
,
"校验加钱购title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].belong"
),
"自有"
,
"校验加钱购belong失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].status"
),
"0"
,
"校验加钱购status失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].titleDownTxt"
),
"100积分 + 9.0元"
,
"校验加钱购status失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].type"
),
"object"
,
"校验活动type失败"
);
logger
.
info
(
"校验title,belong成功"
);
//删除商品
objectService
.
ajaxDel
(
appItemId
);
}
@Test
(
description
=
"添加加钱购实物后直接上架"
)
public
void
e_
加钱购实物上架
()
throws
Exception
{
//新建实物商品---放入仓库
objectService
.
doUpdateObjectMoney
(
""
,
"yes"
,
"100"
,
"9"
);
//查看商品列表确认商品成功添加
Response
response
=
objectService
.
appItems
(
"19515"
,
"【自动化】接口测试-加钱购"
);
//获取商品id
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
status
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].status"
));
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化】接口测试-加钱购"
,
"校验加钱购title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].belong"
),
"自有"
,
"校验加钱购belong失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].status"
),
"0"
,
"校验加钱购status失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].titleDownTxt"
),
"100积分 + 9.0元"
,
"校验加钱购status失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].type"
),
"object"
,
"校验活动type失败"
);
logger
.
info
(
"校验title,belong成功"
);
//删除商品
objectService
.
ajaxDel
(
appItemId
);
}
}
src/test/java/http/cases/SaasDeveloperTest/自有虚拟商品测试_DuibaTest.java
0 → 100644
View file @
0fc90c7a
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
utils.PublicMethod
;
import
http.service.Saas.DeveloperObjectService
;
import
http.service.Saas.DeveloperVirtualService
;
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
自有虚拟商品测试
_DuibaTest
extends
AbstractTestNGSpringContextTests
{
@Autowired
DeveloperVirtualService
developerVirtualService
;
@Autowired
DeveloperObjectService
developerObjectService
;
//我的商品列表中的ID appItemId = String.valueOf(response.jsonPath().getString("data.list[0].id"));
private
static
String
appItemId
;
//实物上下架状态
private
static
String
status
;
private
static
String
data
;
private
static
String
data2
;
@Test
(
description
=
"添加单档位---加钱购虚拟商品"
)
public
void
a_
添加单档位虚拟商品
()
throws
Exception
{
data
=
PublicMethod
.
data
();
developerVirtualService
.
doUpdateVirtual
(
"【自动化】加钱购自有虚拟商品"
+
data
,
"标识符100=10+1"
);
//查看商品列表确认商品成功添加
Response
response
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】加钱购自有虚拟商品"
+
data
);
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化】加钱购自有虚拟商品"
+
data
,
"校验活动title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].belong"
),
"自有"
,
"校验活动belong失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].titleDownTxt"
),
"100积分 + 88.0元"
,
"校验活动titleDownTxt失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].type"
),
"virtual"
,
"校验活动type失败"
);
logger
.
info
(
"校验title,belong成功"
);
}
@Test
(
description
=
"虚拟商品上架或下架"
)
public
void
b_
虚拟商品上下架
()
throws
Exception
{
//查看商品列表确认商品成功添加
logger
.
info
(
"status===="
+
status
);
Response
response
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】加钱购自有虚拟商品"
+
data
);
status
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].status"
));
if
(
status
.
equals
(
"0"
)){
developerObjectService
.
standUp
(
appItemId
,
"up"
);
//查看商品列表,确认上架成功
Response
response1
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】加钱购自有虚拟商品"
+
data
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.list[0].status"
),
"1"
,
"校验上架实物失败"
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.list[0].statusText"
),
"上架"
,
"校验上架实物失败"
);
logger
.
info
(
"校验实物上架成功"
);
}
else
{
developerObjectService
.
standUp
(
appItemId
,
"down"
);
//查看商品列表,确认下架成功
Response
response2
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】加钱购自有虚拟商品"
+
data
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].status"
),
"0"
,
"校验下架实物失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].statusText"
),
"下架"
,
"校验下架实物失败"
);
logger
.
info
(
"校验实物下架成功"
);
}
}
@Test
(
description
=
"删除虚拟商品"
)
public
void
c_
删除
()
throws
Exception
{
developerObjectService
.
ajaxDel
(
appItemId
);
}
@Test
(
description
=
"添加多档位虚拟商品"
)
public
void
d_
添加多档位虚拟商品
()
throws
Exception
{
String
aloneGearTag
=
"[{\"title\":\"档位1\",\"price\":\"标识100=10+1\",\"credits\":\"1\"},{\"title\":\"档位2\",\"price\":\"2\",\"credits\":\"2\"},{\"title\":\"档位3\",\"price\":\"3\",\"credits\":\"3\"}]"
;
data2
=
PublicMethod
.
data
();
developerVirtualService
.
doMoreUpdateVirtual
(
"【自动化】自有虚拟商品"
+
data2
,
aloneGearTag
);
//查看商品列表确认商品成功添加
Response
response
=
developerObjectService
.
appItems
(
"19515"
,
"【自动化】自有虚拟商品"
+
data2
);
String
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
),
"【自动化】自有虚拟商品"
+
data2
,
"校验活动title失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"data.list[0].belong"
),
"自有"
,
"校验活动belong失败"
);
logger
.
info
(
"校验title,belong成功"
);
//删除
developerObjectService
.
ajaxDel
(
appItemId
);
}
}
src/test/java/http/cases/SaasDeveloperTest/计划任务_DuibaTest.java
0 → 100644
View file @
0fc90c7a
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
utils.PublicMethod
;
import
http.service.Saas.PlannedTaskService
;
import
base.DuibaLog
;
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
;
/**
* Created by humengxin on 2018/9/3.
*/
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
计划任务
_DuibaTest
extends
AbstractTestNGSpringContextTests
{
@Autowired
PlannedTaskService
plannedTaskService
;
private
static
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@Test
(
description
=
"添加商品类型计划任务"
)
public
void
a_
添加商品类型计划任务
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
//查询实物商品集合
Response
response
=
plannedTaskService
.
appItems
();
// 获取到集合商品的ID
String
sourceId
=
response
.
jsonPath
().
getString
(
"data.list[0].id"
);
plannedTaskService
.
addTask
(
"2239"
,
sourceId
);
//查看商品列表确认商品成功添加
Response
response2
=
plannedTaskService
.
queryTasks
(
"2239"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data[0].sourceName"
),
"【自动化】自有实物19:51:09"
,
"校验名称失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data[0].sourceTypeName"
),
"商品"
,
"校验类型失败"
);
logger
.
info
(
"校验名称,类型成功"
);
//新建后删除测试数据
plannedTaskService
.
delTask
(
"2239"
,
sourceId
);
}
@Test
(
description
=
"添加活动类型计划任务"
)
public
void
b_
添加活动计划任务
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
//查询活动集合
Response
response
=
plannedTaskService
.
list2
();
// 获取到集合活动的ID
String
sourceId
=
response
.
jsonPath
().
getString
(
"data.list[0].id"
);
plannedTaskService
.
addTask2
(
sourceId
);
//查看活动列表确认活动成功添加
Response
response2
=
plannedTaskService
.
queryTasks
(
"2239"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data[1].sourceName"
),
"自有刮刮乐"
,
"校验名称失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data[1].sourceTypeName"
),
"活动工具"
,
"校验类型失败"
);
logger
.
info
(
"校验名称,类型成功"
);
//新建后删除测试数据
plannedTaskService
.
delTask
(
"2239"
,
sourceId
);
}
@Test
(
description
=
"添加自定义链接类型计划任务"
)
public
void
c_
添加自定义链接类型计划任务
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
//新建自定义链接计划任务
plannedTaskService
.
uploadBanner
();
//查看列表是否成功添加
Response
response
=
plannedTaskService
.
queryTasks
(
"2239"
);
// 获取id
String
sourceId
=
response
.
jsonPath
().
getString
(
"data[0].sourceId"
);
//新建后删除测试数据
plannedTaskService
.
delTask
(
"2239"
,
sourceId
);
}
@Test
(
description
=
"查看活动计划任务——活动规则"
)
public
void
d_
查看活动规则
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
Response
response
=
plannedTaskService
.
list2
();
// 获取ID
String
sourceId
=
response
.
jsonPath
().
getString
(
"data.list[0].id"
);
plannedTaskService
.
addTask2
(
sourceId
);
Response
response2
=
plannedTaskService
.
queryTasks
(
"2239"
);
plannedTaskService
.
rules
(
"2239"
,
sourceId
,
"appHdtool"
);
//新建后删除测试数据
plannedTaskService
.
delTask
(
"2239"
,
sourceId
);
}
@Test
(
description
=
"删除计划任务"
)
public
void
e_
删除计划任务
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
Response
response
=
plannedTaskService
.
list2
();
// 获取ID
String
sourceId
=
response
.
jsonPath
().
getString
(
"data.list[0].id"
);
plannedTaskService
.
addTask2
(
sourceId
);
Response
response2
=
plannedTaskService
.
queryTasks
(
"2239"
);
plannedTaskService
.
delTask
(
"2239"
,
sourceId
);
}
@Test
(
description
=
"预览计划任务"
)
public
void
f_
预览计划任务
()
throws
Exception
{
String
data
=
PublicMethod
.
data
();
Response
response
=
plannedTaskService
.
list2
();
// 获取ID
String
sourceId
=
response
.
jsonPath
().
getString
(
"data.list[0].id"
);
plannedTaskService
.
addTask2
(
sourceId
);
Response
response2
=
plannedTaskService
.
queryTasks
(
"2239"
);
// 获取id
String
id
=
response2
.
jsonPath
().
getString
(
"data[0].id"
);
plannedTaskService
.
preview
(
"2239"
,
id
,
sourceId
,
"appHdtool"
);
}
}
src/test/java/http/cases/SaasDeveloperTest/设置_应用信息_DuibaTest.java
0 → 100644
View file @
0fc90c7a
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
http.service.Saas.UpdateAppInfoService
;
import
base.DuibaLog
;
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
设置
_
应用信息
_DuibaTest
extends
AbstractTestNGSpringContextTests
{
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
@Autowired
UpdateAppInfoService
updateAppInfoService
;
//设置--保存应用信息
@Test
public
void
保存应用信息
()
throws
Exception
{
String
appId
=
"19515"
;
String
earnCreditsUrl
=
"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com"
;
String
creditsDetailUrl
=
"https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baidu&wd=www.baidu.com"
;
Response
response
=
updateAppInfoService
.
appInfo
(
appId
);
Boolean
isDecimalOpen
=
response
.
jsonPath
().
getBoolean
(
"data.isDecimalOpen"
);
logger
.
info
(
"******"
+
isDecimalOpen
);
String
unitName
=
isDecimalOpen
?
"元"
:
"积分"
;
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.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
(
"保存应用信息成功"
);
}
}
src/test/java/http/cases/SaasDeveloperTest/设置运费模板_DuibaTest.java
0 → 100644
View file @
0fc90c7a
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
utils.PublicMethod
;
import
http.service.Saas.ExpressTemplateService
;
import
base.DuibaLog
;
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
;
/**
* 〈开发者后台--配置--更多--运费模板测试〉
*
* @author wangxiaoshuang
*/
@ContextConfiguration
(
classes
=
Config
.
class
)
public
class
设置运费模板
_DuibaTest
extends
AbstractTestNGSpringContextTests
{
@Autowired
ExpressTemplateService
expressTemplateService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
static
String
data
=
PublicMethod
.
data
();
//运费模板ID
private
static
String
modelId
;
//获取token
public
String
获取
token
()
throws
Exception
{
Response
response
=
expressTemplateService
.
EditExpressTemplate
(
""
);
String
token
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.token"
));
return
token
;
}
//添加运费模板
@Test
public
void
a_
创建模板
()
throws
Exception
{
//获取token
String
token
=
获取
token
();
logger
.
info
(
"token为:"
+
token
);
//调用添加方法
expressTemplateService
.
SaveExpressTemplate
(
""
,
"19515"
,
token
,
"测试模板wxs"
+
data
,
""
);
//查询模板列表,获取ID
Response
HdResponse
=
expressTemplateService
.
ExpressTemplateConfig
();
modelId
=
HdResponse
.
jsonPath
().
getString
(
"data.list[0].id"
);
//验证添加成功
Assert
.
assertEquals
(
HdResponse
.
jsonPath
().
getString
(
"data.list[0].name"
),
"测试模板wxs"
+
data
,
"校验活动name失败"
);
Assert
.
assertEquals
(
HdResponse
.
jsonPath
().
getString
(
"data.list[0].defaultExpressPrice"
),
"1000"
,
"defaultExpressPrice"
);
// logger.info("校验创建模板成功,进行修改");
}
//修改运费模板
@Test
public
void
b_
修改模板
()
throws
Exception
{
// logger.info("获取添加的ID**********"+modelId);
//调用修改方法
Response
response
=
expressTemplateService
.
EditExpressTemplate
(
modelId
);
//获取token
String
token
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.token"
));
//保存修改内容
expressTemplateService
.
SaveExpressTemplate
(
modelId
,
"19515"
,
token
,
"测试模板wxs-修改"
+
data
,
modelId
);
//查询列表,判断是否编辑成功
Response
response1
=
expressTemplateService
.
ExpressTemplateConfig
();
String
modelId2
=
response1
.
jsonPath
().
getString
(
"data.list[0].id"
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.list[0].name"
),
"测试模板wxs-修改"
+
data
,
"校验活动name失败"
);
Assert
.
assertEquals
(
response1
.
jsonPath
().
getString
(
"data.list[0].defaultExpressPrice"
),
"1000"
,
"defaultExpressPrice"
);
// logger.info("修改后的ID**********"+modelId2);
}
//删除运费模板
@Test
public
void
c_
删除模板
()
throws
Exception
{
// logger.info("删除ID**********"+modelId);
//调用删除方法,传入模板ID
expressTemplateService
.
ajaxDel
(
modelId
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment