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
8fb108e1
Commit
8fb108e1
authored
Nov 22, 2018
by
赵然
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop'
parents
664cd062
ae63d464
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
794 additions
and
6 deletions
+794
-6
CustomActivity_DuibaTest.java
...p/cases/DefinedActivityTest/CustomActivity_DuibaTest.java
+1
-1
优惠券_兑换异常测试_ExchangeTest.java
...java/http/cases/ExchangeTest/优惠券_兑换异常测试_ExchangeTest.java
+2
-1
虚拟商品_兑换异常测试_ExchangeTest.java
...ava/http/cases/ExchangeTest/虚拟商品_兑换异常测试_ExchangeTest.java
+0
-0
优惠券测试_DuibaTest.java
...test/java/http/cases/NewActivityTest/优惠券测试_DuibaTest.java
+1
-1
谢谢参与测试_DuibaTest.java
...est/java/http/cases/NewActivityTest/谢谢参与测试_DuibaTest.java
+1
-0
修改兑吧商品.java
src/test/java/http/cases/SaasDeveloperTest/修改兑吧商品.java
+79
-0
补给站.java
src/test/java/http/cases/SaasDeveloperTest/补给站.java
+86
-0
种红包配置校验_AccessTest.java
src/test/java/http/cases/WalletTest/种红包配置校验_AccessTest.java
+54
-3
DeveloperBJZ.java
src/test/java/http/service/Saas/DeveloperBJZ.java
+182
-0
DoUpdateAppItemService.java
src/test/java/http/service/Saas/DoUpdateAppItemService.java
+366
-0
VirtualExchangeService.java
src/test/java/http/service/app/VirtualExchangeService.java
+22
-0
No files found.
src/test/java/http/cases/DefinedActivityTest/CustomActivity_DuibaTest.java
View file @
8fb108e1
...
...
@@ -95,7 +95,7 @@ public class CustomActivity_DuibaTest extends DuibaTestBase {
String
androidDL
=
MatcherString
.
getString
(
ManagerResponse
.
asString
(),
"androidurl: '(.*?)',"
,
1
);
String
iOSDL
=
MatcherString
.
getString
(
ManagerResponse
.
asString
(),
"iosurl: '(.*?)',"
,
1
);
String
usebtn
=
MatcherString
.
getString
(
ManagerResponse
.
asString
(),
"usebtn: '(.*?)',"
,
1
);
String
actLinkEx
=
"//activity.m.duibatest.com.cn/crecord/recordDetailNew
/
"
;
String
actLinkEx
=
"//activity.m.duibatest.com.cn/crecord/recordDetailNew"
;
String
linkUrl
=
MatcherString
.
getString
(
LinkResponse
.
asString
(),
"target=\"_blank\" href=\"(.*?)\">"
,
1
);
//进行接口测试传参
...
...
src/test/java/http/cases/ExchangeTest/优惠券_兑换
流程测试pyl
_ExchangeTest.java
→
src/test/java/http/cases/ExchangeTest/优惠券_兑换
异常测试
_ExchangeTest.java
View file @
8fb108e1
...
...
@@ -23,7 +23,8 @@ import static io.restassured.RestAssured.given;
* Created by panyuli on 2018/07/06.
*/
public
class
优惠券
_
兑换流程测试
pyl_ExchangeTest
extends
CheckTemplet
{
public
class
优惠券
_
兑换异常测试
_ExchangeTest
extends
CheckTemplet
{
@Autowired
private
MobileService
mobileService
;
...
...
src/test/java/http/cases/ExchangeTest/虚拟商品_兑换异常测试_ExchangeTest.java
0 → 100644
View file @
8fb108e1
This diff is collapsed.
Click to expand it.
src/test/java/http/cases/NewActivityTest/优惠券测试_DuibaTest.java
View file @
8fb108e1
...
...
@@ -54,7 +54,7 @@ public class 优惠券测试_DuibaTest extends AbstractTestNGSpringContextTests
String
androidDL
=
MatcherString
.
getString
(
ManagerResponse
.
asString
(),
"androidurl: '(.*?)',"
,
1
);
String
iOSDL
=
MatcherString
.
getString
(
ManagerResponse
.
asString
(),
"iosurl: '(.*?)',"
,
1
);
String
actusebtn
=
MatcherString
.
getString
(
ManagerResponse
.
asString
(),
"usebtn: '(.*?)',"
,
1
);
String
actLinkEx
=
"//activity.m.duibatest.com.cn/crecord/recordDetailNew
/
"
;
String
actLinkEx
=
"//activity.m.duibatest.com.cn/crecord/recordDetailNew"
;
String
linkUrl
=
MatcherString
.
getString
(
LinkResponse
.
asString
(),
"target=\"_blank\" href=\"(.*?)\">"
,
1
);
//获取管理员后台优惠券库存
...
...
src/test/java/http/cases/NewActivityTest/谢谢参与测试_DuibaTest.java
View file @
8fb108e1
...
...
@@ -32,6 +32,7 @@ public class 谢谢参与测试_DuibaTest extends DuibaTestBase {
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.type"
),
"thanks"
,
"校验类型失败"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"lottery.id"
).
isEmpty
(),
false
,
"校验id失败"
);
Assert
.
assertNotNull
(
response
.
jsonPath
().
getString
(
"lottery.id"
),
"校验id失败"
);
//校验返回字段
Assert
.
assertEquals
(
response
.
asString
().
contains
(
"id"
),
true
,
"校验id失败"
);
logger
.
info
(
"校验type,id成功"
);
...
...
src/test/java/http/cases/SaasDeveloperTest/修改兑吧商品.java
0 → 100644
View file @
8fb108e1
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
base.DuibaTestBase
;
import
base.DuibaLog
;
import
http.service.Saas.DeveloperCouponService
;
import
http.service.Saas.DeveloperObjectService
;
import
http.service.Saas.DoUpdateAppItemService
;
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
{
@Autowired
DoUpdateAppItemService
doUpdateAppItemService
;
@Autowired
DeveloperObjectService
developerObjectService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//修改兑吧实物
@Test
public
void
a_
修改兑吧实物
()
throws
Exception
{
String
appId
=
"19515"
;
String
rowId
=
"1"
;
String
itemTyp
=
""
;
String
status
=
""
;
String
itemName
=
"【SaaS-自动化测试】实物勿动"
;
String
belong
=
""
;
String
priceType
=
""
;
//查询商品,获取商品ID
Response
response
=
doUpdateAppItemService
.
appItems
(
appId
,
rowId
,
itemTyp
,
status
,
itemName
,
belong
,
priceType
);
//获取商品ID
String
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
title
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
String
type
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].type"
));
// logger.info("获取appitermid=="+appItemId+"title=="+title+"type=="+type);
//编辑
Response
response2
=
developerObjectService
.
editAppItem2
(
appItemId
);
//保存
doUpdateAppItemService
.
doUpdateAppItem
(
appId
,
appItemId
,
title
,
"38"
,
type
,
"31654"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.title"
),
"【SaaS-自动化测试】实物勿动"
,
"校验兑吧商品标题失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.credits"
),
"38"
,
"校验兑吧商品失败"
);
logger
.
info
(
"校验title,belong成功"
);
}
//修改兑吧优惠券
@Test
public
void
b_
修改兑吧优惠券
()
throws
Exception
{
String
appId
=
"19515"
;
String
rowId
=
"1"
;
String
itemTyp
=
""
;
String
status
=
""
;
String
itemName
=
"【SaaS-自动化测试】优惠券勿动"
;
String
belong
=
""
;
String
priceType
=
""
;
Response
response
=
doUpdateAppItemService
.
appItems
(
appId
,
rowId
,
itemTyp
,
status
,
itemName
,
belong
,
priceType
);
//获取商品ID
String
appItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
title
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].title"
));
String
type
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].type"
));
// logger.info("获取appitermid=="+appItemId+"title=="+title+"type=="+type);
//编辑
doUpdateAppItemService
.
doUpdateAppItem
(
appId
,
appItemId
,
title
,
"10"
,
"coupon"
,
"31658"
);
Response
response2
=
developerObjectService
.
editAppItem2
(
appItemId
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.title"
),
"【SaaS-自动化测试】优惠券勿动"
,
"校验兑吧优惠券商品标题失败"
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.credits"
),
"10"
,
"校验兑吧优惠券商品失败"
);
logger
.
info
(
"校验title,belong成功"
);
}
}
src/test/java/http/cases/SaasDeveloperTest/补给站.java
0 → 100644
View file @
8fb108e1
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
{
@Autowired
DeveloperBJZ
developerBJZ
;
@Autowired
DeveloperObjectService
developerObjectService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
String
appId
=
"19515"
;
//添加、上架至尊版实物
@Test
public
void
a_
添加至尊版实物
()
throws
Exception
{
//查询列表,获取ID
Response
response
=
developerBJZ
.
item
(
"2"
);
String
id
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
String
title
=
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"
));
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成功"
);
//删除添加的商品
developerObjectService
.
ajaxDel
(
appItemId
);
}
//添加、上架优惠券
@Test
public
void
b_
添加至尊版优惠券
()
throws
Exception
{
//查询列表,获取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"
));
//添加
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"
));
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
);
}
//添加活动
@Test
public
void
c_
添加活动
()
throws
Exception
{
//查询热门活动-活动列表,获取商品ID
Response
response
=
developerBJZ
.
saasActivitys
(
"3"
);
String
goodItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.saasActivitys[0].id"
));
//获取商品ID,进入商品订购页面,获取SKU
Response
response2
=
developerBJZ
.
itemOrderDetail
(
goodItemId
);
String
skuId
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.goodsItemSku[0].skuId"
));
//点击订购,传入SKU创建订单
logger
.
info
(
"kuid==="
+
skuId
);
Response
response3
=
developerBJZ
.
createAutomationOrderNew
(
skuId
);
String
orderid
=
String
.
valueOf
(
response3
.
jsonPath
().
getString
(
"data"
));
logger
.
info
(
"kuid==="
+
orderid
);
//下单购买
Response
response4
=
developerBJZ
.
orderAccountPay
(
orderid
);
}
}
src/test/java/http/cases/WalletTest/种红包配置校验_AccessTest.java
View file @
8fb108e1
...
...
@@ -30,9 +30,10 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
//指定用户
private
static
int
uid
=
4689
;
private
static
int
uid2
=
4552
;
private
static
int
uid3
=
3590
;
private
static
int
uid4
=
4386
;
@Test
public
void
出券开关校验
_
开
()
throws
Exception
{
public
void
出券
衰减
开关校验
_
开
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid
);
//校验种红包配置
...
...
@@ -58,11 +59,12 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
logger
.
info
(
"种红包的红包配置接口校验正确"
);
}
@Test
public
void
出券开关校验
_
关
()
throws
Exception
{
public
void
出券
衰减
开关校验
_
关
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid2
);
//校验种红包配置
...
...
@@ -81,4 +83,53 @@ public class 种红包配置校验_AccessTest extends DuibaTestBase{
logger
.
info
(
"种红包的红包配置接口校验正确"
);
}
@Test
public
void
流量策略打开校验
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid3
);
//校验种红包配置
Response
response
=
seedRedPacketService
.
getExtConfig
(
cookies
);
response
.
prettyPrint
();
String
adPositions
=
response
.
jsonPath
().
getString
(
"data.adPositions"
);
String
adSwitch
=
response
.
jsonPath
().
getString
(
"data.adSwitch"
);
String
decrBeginTime
=
response
.
jsonPath
().
getString
(
"data.decrBeginTime"
);
String
decrSwitch
=
response
.
jsonPath
().
getString
(
"data.decrSwitch"
);
Assert
.
assertNull
(
adPositions
,
"发券位置校验异常"
);
Assert
.
assertEquals
(
adSwitch
,
"false"
,
"种红包开关校验异常"
);
Assert
.
assertEquals
(
decrSwitch
,
"false"
,
"种红包衰减开关校验异常"
);
Assert
.
assertNull
(
decrBeginTime
,
"衰减时间校验异常"
);
logger
.
info
(
"种红包的红包配置接口校验正确"
);
}
@Test
public
void
衰减红包校验
()
throws
Exception
{
//dafuweng登陆获取cookies
Map
cookies
=
authorization
.
dafuwengLogin
(
uid4
);
//调用种植seed
Response
response
=
seedRedPacketService
.
seed
(
cookies
,
"1"
,
"424"
,
"1"
);
//种子号
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderNum"
);
Assert
.
assertNotNull
(
orderId
,
"订单号为空"
);
logger
.
info
(
"红包订单为:"
+
orderId
);
//红包衰减
Thread
.
sleep
(
65000
);
//获取种植结果状态getOrderStatus,异步接口,while循环,status为2处理完成,1处理中
response
=
seedRedPacketService
.
getOrderStatus
(
cookies
,
orderId
);
String
status
=
response
.
jsonPath
().
getString
(
"data"
);
int
i
=
5
;
while
(
i
>
0
&&
status
.
equals
(
"1"
)){
response
=
seedRedPacketService
.
getOrderStatus
(
cookies
,
orderId
);
status
=
response
.
jsonPath
().
getString
(
"data"
);
i
--;
}
//获取种植获得金额
response
=
seedRedPacketService
.
reap
(
cookies
,
"1"
,
orderId
);
response
.
prettyPrint
();
String
isDecr
=
response
.
jsonPath
().
getString
(
"data.isDecr"
);
Assert
.
assertEquals
(
isDecr
,
"true"
,
"红包衰减标识校验失败"
);
}
}
src/test/java/http/service/Saas/DeveloperBJZ.java
0 → 100644
View file @
8fb108e1
package
http
.
service
.
Saas
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
http.service.Authorization
;
import
base.DuibaLog
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.testng.Assert
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* 补给站
*/
@Service
public
class
DeveloperBJZ
{
@Value
(
"${hdserver.host}"
)
String
hdHost
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//优质好货--查询至尊版特权TAB
public
Response
item
(
String
type
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/items"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"type"
,
type
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"itemName"
,
""
);
map
.
put
(
"max"
,
"20"
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//至尊特权添加商品
public
Response
ajaxAddRepo
(
String
appId
,
String
itemId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devRepo/ajaxAddRepo"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"itemId"
,
itemId
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//至尊特权上架商品
public
Response
ajaxDirectUp
(
String
appId
,
String
itemIds
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/devRepo/ajaxDirectUp"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"itemIds"
,
itemIds
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
post
(
url
);
response
.
prettyPrint
();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"直接上架成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//大牌好券--查询至尊版特权TAB
public
Response
coupons
(
String
appId
,
String
type
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/coupons"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appId"
,
appId
);
map
.
put
(
"type"
,
type
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"subType"
,
""
);
map
.
put
(
"max"
,
"12"
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//热门活动--查询活动
public
Response
saasActivitys
(
String
categoryId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/saasActivitys"
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"attrIds"
,
""
);
map
.
put
(
"rowId"
,
"1"
);
map
.
put
(
"max"
,
"25"
);
map
.
put
(
"categoryId"
,
categoryId
);
logger
.
info
(
"********"
+
url
);
//json 格式转成form表单
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
Response
response
=
given
().
contentType
(
"application/json;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
"19515"
)).
body
(
jsonParam
).
post
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//选中活动
public
Response
itemOrderDetail
(
String
goodItemId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/itemOrderDetail"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"goodItemId"
,
goodItemId
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//订购活动--创建订单
public
Response
createAutomationOrderNew
(
String
skuId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saas/createAutomationOrderNew"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"skuId"
,
skuId
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
"19515"
)).
params
(
map
).
post
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//订购--账户余额付款
public
Response
orderAccountPay
(
String
orderId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saas/orderAccountPay"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderId"
,
orderId
);
// logger.info("********"+url);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
()).
params
(
map
).
get
(
url
);
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"创建接口1失败,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"创建接口2失败,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
src/test/java/http/service/Saas/DoUpdateAppItemService.java
0 → 100644
View file @
8fb108e1
This diff is collapsed.
Click to expand it.
src/test/java/http/service/app/VirtualExchangeService.java
View file @
8fb108e1
...
...
@@ -42,4 +42,26 @@ public class VirtualExchangeService {
return
response
;
}
public
Response
exchange2
(
Map
cookies
,
String
appItemId
,
String
degreeId
)
throws
Exception
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"appItemId"
,
appItemId
);
map
.
put
(
"degreeId"
,
degreeId
);
map
.
put
(
"token"
,
"xz9eyi"
);
logger
.
info
(
"请求/virtualExchange/exchange接口"
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
cookies
).
params
(
map
).
post
(
"http://"
+
goodsHost
+
"/virtualExchange/exchange"
);
//couponExchange
try
{
Assert
.
assertEquals
(
String
.
valueOf
(
response
.
getStatusCode
()),
"200"
,
"/objectExchange/exchange接口返回异常"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/objectExchange/exchange接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/objectExchange/exchange接口返回异常,返回信息:"
+
response
.
asString
());
}
return
response
;
}
}
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