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
2e16ae71
Commit
2e16ae71
authored
Dec 06, 2018
by
胡梦新
Browse files
Options
Browse Files
Download
Plain Diff
zr
parents
826f229d
e759bed8
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
146 additions
and
2 deletions
+146
-2
补给站_商品.java
src/test/java/http/cases/SaasDeveloperTest/补给站_商品.java
+0
-0
补给站_活动.java
src/test/java/http/cases/SaasDeveloperTest/补给站_活动.java
+112
-0
DeveloperBJZ.java
src/test/java/http/service/Saas/DeveloperBJZ.java
+34
-2
No files found.
src/test/java/http/cases/SaasDeveloperTest/补给站.java
→
src/test/java/http/cases/SaasDeveloperTest/补给站
_商品
.java
View file @
2e16ae71
This diff is collapsed.
Click to expand it.
src/test/java/http/cases/SaasDeveloperTest/补给站_活动.java
0 → 100644
View file @
2e16ae71
package
http
.
cases
.
SaasDeveloperTest
;
import
base.Config
;
import
http.service.Saas.DeveloperBJZ
;
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
补给站
_
活动
extends
AbstractTestNGSpringContextTests
{
@Autowired
DeveloperBJZ
developerBJZ
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
//至尊版app
String
appId
=
"19515"
;
//旗舰版app
String
appId2
=
"21695"
;
//添加活动
@Test
(
description
=
"//添加活动"
)
public
void
a_
添加活动
()
throws
Exception
{
//查询热门活动-活动列表,获取商品ID
Response
response
=
developerBJZ
.
saasActivitys
(
"3"
,
appId
);
String
goodItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.saasActivitys[0].id"
));
//获取商品ID,进入商品订购页面,获取SKU
Response
response2
=
developerBJZ
.
itemOrderDetail
(
goodItemId
,
appId
);
String
skuId
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.goodsItemSku[0].skuId"
));
//点击订购,传入SKU创建订单
logger
.
info
(
"kuid==="
+
skuId
);
Response
response3
=
developerBJZ
.
createAutomationOrderNew
(
skuId
,
appId
);
String
orderid
=
String
.
valueOf
(
response3
.
jsonPath
().
getString
(
"data"
));
logger
.
info
(
"kuid==="
+
orderid
);
//下单购买
developerBJZ
.
orderAccountPay
(
orderid
,
appId
);
//查询是否购买成功
Response
response4
=
developerBJZ
.
findOrderById
(
orderid
,
appId
);
Assert
.
assertEquals
(
response4
.
jsonPath
().
getString
(
"data.vo.funcName"
),
"自动化测试活动--勿动"
,
"校验名称失败"
);
Assert
.
assertEquals
(
response4
.
jsonPath
().
getString
(
"data.vo.limitTime"
),
"一年"
,
"校验购买期限失败"
);
logger
.
info
(
"校验名称,期限成功"
);
}
@Test
(
description
=
"//添加签到活动"
)
public
void
b_
添加签到活动
()
throws
Exception
{
//查询热门活动-活动列表,获取商品ID
Response
response
=
developerBJZ
.
saasActivitys
(
"2"
,
appId
);
String
goodItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.saasActivitys[1].id"
));
//获取商品ID,进入商品订购页面,获取SKU
Response
response2
=
developerBJZ
.
itemOrderDetail
(
goodItemId
,
appId
);
String
skuId
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.goodsItemSku[0].skuId"
));
//点击订购,传入SKU创建订单
logger
.
info
(
"kuid==="
+
skuId
);
Response
response3
=
developerBJZ
.
createAutomationOrderNew
(
skuId
,
appId
);
String
orderid
=
String
.
valueOf
(
response3
.
jsonPath
().
getString
(
"data"
));
logger
.
info
(
"kuid==="
+
orderid
);
//下单购买
developerBJZ
.
orderAccountPay
(
orderid
,
appId
);
//查询是否购买成功
Response
response4
=
developerBJZ
.
findOrderById
(
orderid
,
appId
);
Assert
.
assertEquals
(
response4
.
jsonPath
().
getString
(
"data.vo.funcName"
),
"SaaS签到"
,
"校验名称失败"
);
logger
.
info
(
"校验名称成功"
);
}
@Test
(
description
=
"付款时有待处理的订单(异常场景)"
)
public
void
c_
待处理的订单
()
throws
Exception
{
//查询热门活动-活动列表,获取商品ID
Response
response
=
developerBJZ
.
saasActivitys
(
"2"
,
appId
);
String
goodItemId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.saasActivitys[1].id"
));
//获取商品ID,进入商品订购页面,获取SKU
Response
response2
=
developerBJZ
.
itemOrderDetail
(
goodItemId
,
appId
);
String
skuId
=
String
.
valueOf
(
response2
.
jsonPath
().
getString
(
"data.goodsItemSku[0].skuId"
));
//点击订购,传入SKU创建订单
logger
.
info
(
"kuid==="
+
skuId
);
developerBJZ
.
createAutomationOrderNew
(
skuId
,
appId
);
developerBJZ
.
createAutomationOrderNew2
(
skuId
,
appId
);
Assert
.
assertEquals
(
developerBJZ
.
createAutomationOrderNew2
(
skuId
,
appId
).
jsonPath
().
getString
(
"desc"
),
"订单未处理"
,
"校验订单待处理成功"
);
//查询待处理订单
Response
response3
=
developerBJZ
.
selectOrders
(
"1"
,
appId
);
Assert
.
assertEquals
(
response3
.
jsonPath
().
getString
(
"data.list[0].serviceName"
),
"SaaS签到"
,
"校验名称失败"
);
logger
.
info
(
"查询待处理订单成功"
);
}
@Test
(
description
=
"查询交易关闭的订单"
)
public
void
d_
交易关闭的订单
()
throws
Exception
{
//查询待付款订单
Response
response
=
developerBJZ
.
selectOrders
(
"1"
,
appId
);
String
orderId
=
String
.
valueOf
(
response
.
jsonPath
().
getString
(
"data.list[0].id"
));
// 点击取消付款,进入到交易关闭订单
developerBJZ
.
cancleOrder
(
orderId
,
appId
);
Response
response2
=
developerBJZ
.
selectOrders
(
"3"
,
appId
);
Assert
.
assertEquals
(
response2
.
jsonPath
().
getString
(
"data.list[0].serviceName"
),
"SaaS签到"
,
"校验名称失败"
);
logger
.
info
(
"查询交易关闭订单成功"
);
}
}
src/test/java/http/service/Saas/DeveloperBJZ.java
View file @
2e16ae71
...
...
@@ -220,6 +220,21 @@ public class DeveloperBJZ {
return
response
;
}
//订购活动--创建订单
public
Response
createAutomationOrderNew2
(
String
skuId
,
String
appId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saas/createAutomationOrderNew"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"skuId"
,
skuId
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
appId
)).
params
(
map
).
post
(
url
);
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
,
String
appId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saas/orderAccountPay"
;
...
...
@@ -254,10 +269,10 @@ public class DeveloperBJZ {
}
//查看记录是否添加购买成功
public
Response
selectOrders
(
String
appId
)
throws
Exception
{
public
Response
selectOrders
(
String
orderStatus
,
String
appId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saas/selectOrders"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderStatus"
,
"2"
);
map
.
put
(
"orderStatus"
,
orderStatus
);
map
.
put
(
"appId"
,
appId
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
appId
)).
params
(
map
).
get
(
url
);
response
.
prettyPrint
();
try
{
...
...
@@ -270,6 +285,23 @@ public class DeveloperBJZ {
return
response
;
}
//取消付款
public
Response
cancleOrder
(
String
orderId
,
String
appId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saas/cancleOrder"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderId"
,
orderId
);
Response
response
=
given
().
contentType
(
"application/x-www-form-urlencoded;charset=UTF-8"
).
cookies
(
authorization
.
hdLoginSaas
(
appId
)).
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
directCharges
(
String
appId
)
throws
Exception
{
String
url
=
"http://"
+
hdHost
+
"/saasitem/directCharges"
;
...
...
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