Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oto
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
龚小红
oto
Commits
72ce4cab
Commit
72ce4cab
authored
Mar 08, 2022
by
龚小红
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Feature/20220305-gxh' into 'master'
fix---修复优惠券商品秒杀id错误 See merge request test-group/kejiji!232
parents
008b6c3c
59b9071f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
181 deletions
+38
-181
SecondKill.java
src/test/java/com/kjj/cases/live/secondKill/SecondKill.java
+30
-103
Voucher.java
src/test/java/com/kjj/cases/live/secondKill/Voucher.java
+8
-78
No files found.
src/test/java/com/kjj/cases/live/secondKill/SecondKill.java
View file @
72ce4cab
...
...
@@ -237,48 +237,26 @@ public class SecondKill implements Authorization {
@Test
(
description
=
"代理人下单"
,
priority
=
14
)
public
void
代理人下单
()
{
agentAuth
();
sleep
(
5000
);
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
orderPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderPar
.
put
(
"confId"
,
ConfSecondKill
.
skIdFirst
);
Response
orderRes
=
network
.
postResponse
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
);
try
{
boolean
data
=
orderRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"下单失败"
,
orderRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"未获取到数据"
,
orderRes
.
body
().
asString
()));
}
order
(
ConfSecondKill
.
skIdFirst
,
""
,
""
);
}
@Test
(
description
=
"代理人下单失败"
,
priority
=
15
)
public
void
代理人下单失败
()
{
int
code
=
orderResult
(
ConfSecondKill
.
skIdFirst
,
3
);
Assert
.
assertEquals
(
code
,
1
,
network
.
message
(
null
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"失败原因不是代理人限制
"
,
null
));
Assert
.
assertEquals
(
code
,
1
,
network
.
message
(
null
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"失败原因不是代理人限制
:code="
+
code
,
null
));
}
// 访客被黑名单限制
@Test
(
description
=
"黑名单客户下单"
,
priority
=
16
)
public
void
黑名单客户下单
()
{
visitorAuth7
();
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
orderPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderPar
.
put
(
"confId"
,
ConfSecondKill
.
skIdFirst
);
Response
orderRes
=
network
.
postResponse
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
);
try
{
boolean
data
=
orderRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"下单失败"
,
orderRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"未获取到数据"
,
orderRes
.
body
().
asString
()));
}
order
(
ConfSecondKill
.
skIdFirst
,
""
,
""
);
}
@Test
(
description
=
"黑名单客户下单失败"
,
priority
=
17
)
public
void
黑名单客户下单失败
()
{
int
code
=
orderResult
(
ConfSecondKill
.
skIdFirst
,
3
);
Assert
.
assertEquals
(
code
,
3
,
network
.
message
(
null
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"失败原因不是黑名单客户
"
,
null
));
Assert
.
assertEquals
(
code
,
3
,
network
.
message
(
null
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"失败原因不是黑名单客户
:code="
+
code
,
null
));
}
/**
...
...
@@ -300,17 +278,7 @@ public class SecondKill implements Authorization {
@Test
(
description
=
"正常用户下单"
,
priority
=
19
)
public
void
正常用户下单
()
{
visitorAuth1
();
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
orderPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderPar
.
put
(
"confId"
,
ConfSecondKill
.
skIdFirst
);
Response
orderRes
=
network
.
postResponse
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
);
try
{
boolean
data
=
orderRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"下单失败"
,
orderRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"未获取到数据"
,
orderRes
.
body
().
asString
()));
}
order
(
ConfSecondKill
.
skIdFirst
,
""
,
""
);
}
@Test
(
description
=
"正常用户获取下单结果"
,
priority
=
20
)
...
...
@@ -320,17 +288,7 @@ public class SecondKill implements Authorization {
@Test
(
description
=
"正常用户下单0元秒杀商品"
,
priority
=
21
)
public
void
正常用户下单
0
元秒杀商品
()
{
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
orderPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderPar
.
put
(
"confId"
,
ConfSecondKill
.
skIdThird
);
Response
orderRes
=
network
.
postResponse
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
);
try
{
boolean
data
=
orderRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"下单0元商品失败"
,
orderRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"未获取到数据"
,
orderRes
.
body
().
asString
()));
}
order
(
ConfSecondKill
.
skIdThird
,
""
,
""
);
}
@Test
(
description
=
"正常用户获取0元商品下单结果"
,
priority
=
22
)
...
...
@@ -472,18 +430,7 @@ public class SecondKill implements Authorization {
public
void
代理人成功下单
()
{
agentAuth2
();
// 下单
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
orderPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderPar
.
put
(
"confId"
,
ConfSecondKill
.
skIdSecond
);
Response
orderRes
=
network
.
postResponse
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
);
try
{
boolean
data
=
orderRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"下单失败"
,
orderRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"未获取到数据"
,
orderRes
.
body
().
asString
()));
}
order
(
ConfSecondKill
.
skIdSecond
,
""
,
""
);
// 获取下单结果
orderResult
(
ConfSecondKill
.
skIdSecond
,
1
);
}
...
...
@@ -491,21 +438,12 @@ public class SecondKill implements Authorization {
@Test
(
description
=
"用户下单无库存秒杀失败"
,
priority
=
30
)
public
void
用户下单无库存秒杀
()
{
visitorAuth1
();
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
orderPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderPar
.
put
(
"confId"
,
ConfSecondKill
.
skIdSecond
);
Response
orderRes
=
network
.
postResponse
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
);
try
{
boolean
data
=
orderRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"下单失败"
,
orderRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"未获取到数据"
,
orderRes
.
body
().
asString
()));
}
// 下单
order
(
ConfSecondKill
.
skIdSecond
,
""
,
""
);
// 获取下单结果
int
code
=
orderResult
(
ConfSecondKill
.
skIdSecond
,
3
);
Assert
.
assertEquals
(
code
,
2
,
network
.
message
(
null
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"失败原因不是库存不足
"
,
null
));
Assert
.
assertEquals
(
code
,
2
,
network
.
message
(
null
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"失败原因不是库存不足
:code="
+
code
,
null
));
}
// 秒杀限制
...
...
@@ -554,20 +492,10 @@ public class SecondKill implements Authorization {
ThreadSleepUtils
.
sleep
(
180000
);
// 用户下单
visitorAuth1
();
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
orderPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderPar
.
put
(
"confId"
,
ConfSecondKill
.
skIdSecond
);
Response
orderRes
=
network
.
postResponse
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
);
try
{
boolean
data
=
orderRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"下单失败"
,
orderRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"未获取到数据"
,
orderRes
.
body
().
asString
()));
}
order
(
ConfSecondKill
.
skIdSecond
,
""
,
""
);
int
code
=
orderResult
(
ConfSecondKill
.
skIdSecond
,
3
);
Assert
.
assertEquals
(
code
,
3
,
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"失败原因不是被限制"
,
orderRes
.
body
().
asString
()
));
Assert
.
assertEquals
(
code
,
3
,
network
.
message
(
null
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"失败原因不是被限制:code="
+
code
,
null
));
}
...
...
@@ -717,18 +645,8 @@ public class SecondKill implements Authorization {
public
void
用户成功支付
_
待退款
()
{
visitorAuth31
();
// 新建订单
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
orderPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderPar
.
put
(
"confId"
,
ConfSecondKill
.
skIdFirst
);
Response
orderRes
=
network
.
postResponse
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
);
try
{
boolean
data
=
orderRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"下单失败"
,
orderRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"未获取到数据"
,
orderRes
.
body
().
asString
()));
}
order
(
ConfSecondKill
.
skIdFirst
,
""
,
""
);
//获取下单结果
orderResult
(
ConfSecondKill
.
skIdFirst
,
1
);
}
...
...
@@ -793,7 +711,7 @@ public class SecondKill implements Authorization {
Assert
.
assertEquals
(
refundStatus
,
5
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_getClueDetail
,
"客户线索详情秒杀退款状态错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取优惠券列表"
,
priority
=
5
2
)
@Test
(
description
=
"获取优惠券列表"
,
priority
=
5
3
)
public
void
获取优惠券列表
(){
visitorAuth11
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
...
...
@@ -805,7 +723,7 @@ public class SecondKill implements Authorization {
int
couponsReceiveStatus
=
response
.
jsonPath
().
getInt
(
"data.get(0).couponsReceiveStatus"
);
Assert
.
assertEquals
(
couponsReceiveStatus
,
0
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_couponsList
,
"优惠券领取状态记录错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客填写表单"
,
priority
=
5
2
)
@Test
(
description
=
"访客填写表单"
,
priority
=
5
4
)
public
void
访客填写表单
(){
//获取表单题目id
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
...
...
@@ -833,7 +751,7 @@ public class SecondKill implements Authorization {
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_FormSubmit
,
"访客K提交表单资料失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"领取秒杀优惠券"
,
priority
=
5
3
)
@Test
(
description
=
"领取秒杀优惠券"
,
priority
=
5
5
)
public
void
领取秒杀优惠券
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
...
...
@@ -853,20 +771,28 @@ public class SecondKill implements Authorization {
Assert
.
assertEquals
(
couponsReceiveStatus
,
1
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_couponsList
,
"优惠券领取状态记录错误"
,
statusRes
.
body
().
asString
()));
}
@Test
(
description
=
"上架秒杀优惠券商品"
,
priority
=
5
4
)
@Test
(
description
=
"上架秒杀优惠券商品"
,
priority
=
5
6
)
public
void
上架秒杀优惠券商品
(){
adminAuth
();
killOn
(
ConfSecondKill
.
couponId
);
}
@Test
(
description
=
"下单秒杀优惠券商品"
,
priority
=
5
5
)
@Test
(
description
=
"下单秒杀优惠券商品"
,
priority
=
5
7
)
public
void
下单秒杀优惠券商品
()
{
visitorAuth11
();
// 新建订单
order
(
ConfSecondKill
.
couponId
,
couponsId
,
""
);
//获取下单结果
orderResult
(
ConfSecondKill
.
couponId
,
1
);
}
public
static
void
order
(
String
goodId
,
String
couponsID
,
String
voucherID
)
{
sleep
(
5000
);
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
orderPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderPar
.
put
(
"confId"
,
resourceConfId
);
orderPar
.
put
(
"couponsId"
,
couponsId
);
orderPar
.
put
(
"confId"
,
goodId
);
orderPar
.
put
(
"couponsId"
,
couponsID
);
orderPar
.
put
(
"voucherId"
,
voucherID
);
Response
orderRes
=
network
.
postResponse
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
);
try
{
boolean
data
=
orderRes
.
jsonPath
().
getBoolean
(
"data"
);
...
...
@@ -878,6 +804,7 @@ public class SecondKill implements Authorization {
}
public
static
int
orderResult
(
String
goodId
,
int
status
)
{
//status:1-判定需要支付且下单成功,2-判定不许支付且下单成功,3-判定下单失败
Map
<
String
,
Object
>
orderResultPar
=
new
HashMap
<>();
orderResultPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderResultPar
.
put
(
"confId"
,
goodId
);
...
...
src/test/java/com/kjj/cases/live/secondKill/Voucher.java
View file @
72ce4cab
...
...
@@ -19,7 +19,7 @@ import static com.kjj.cases.live.anchor.CloseLive.closeLive;
import
static
com
.
kjj
.
cases
.
live
.
anchor
.
OpenLive
.
openLive
;
import
static
com
.
kjj
.
cases
.
live
.
liveConfig
.
LiveBinding
.
binding
;
import
static
com
.
kjj
.
cases
.
live
.
liveConfig
.
LiveBinding
.
share
;
import
static
com
.
kjj
.
cases
.
live
.
secondKill
.
SecondKill
.
killOn
;
import
static
com
.
kjj
.
cases
.
live
.
secondKill
.
SecondKill
.
*
;
import
static
com
.
kjj
.
config
.
BasicConfig
.*;
import
static
com
.
kjj
.
config
.
BasicConfig
.
USER_clueInfoData
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
connectSuccess
;
...
...
@@ -347,50 +347,15 @@ public class Voucher implements Authorization {
}
}
@Test
(
description
=
"客户A使用代金券下单价格大于
代金券
的商品"
,
priority
=
22
)
@Test
(
description
=
"客户A使用代金券下单价格大于
价格
的商品"
,
priority
=
22
)
public
void
客户
A
使用代金券下单价格大于代金券的商品
()
{
visitorAuth3
();
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
orderPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderPar
.
put
(
"confId"
,
VoucherConf
.
skIdFirst
);
orderPar
.
put
(
"voucherId"
,
voucherId
);
orderPar
.
put
(
"couponsId"
,
""
);
Response
orderRes
=
network
.
postResponse
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
);
try
{
boolean
data
=
orderRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"下单失败"
,
orderRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"未获取到数据"
,
orderRes
.
body
().
asString
()));
}
order
(
VoucherConf
.
skIdFirst
,
""
,
voucherId
);
}
@Test
(
description
=
"客户A获取下单结果"
,
priority
=
23
)
public
void
客户
A
获取下单结果
()
{
Map
<
String
,
Object
>
orderResultPar
=
new
HashMap
<>();
orderResultPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderResultPar
.
put
(
"confId"
,
VoucherConf
.
skIdFirst
);
Response
orderResultRes
=
null
;
Object
data
=
null
;
int
i
=
0
;
try
{
// 轮训下单接口
while
(
data
==
null
){
sleep
(
2000
);
orderResultRes
=
network
.
getResponse
(
orderResultPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
);
data
=
orderResultRes
.
jsonPath
().
getJsonObject
(
"data"
);
i
++;
if
(
i
==
10
){
Assert
.
fail
(
network
.
message
(
orderResultPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"轮训下单结果超过10次"
,
orderResultRes
.
body
().
asString
()));
}
}
int
state
=
orderResultRes
.
jsonPath
().
getInt
(
"data.state"
);
Assert
.
assertEquals
(
state
,
4
,
network
.
message
(
orderResultPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"下单未成功"
,
orderResultRes
.
body
().
asString
()));
System
.
out
.
println
(
data
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
orderResultPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"获取数据失败"
,
orderResultRes
.
body
().
asString
()));
}
orderResult
(
VoucherConf
.
skIdFirst
,
2
);
}
@Test
(
description
=
"客户A用户代金券列表更新"
,
priority
=
24
)
...
...
@@ -441,50 +406,15 @@ public class Voucher implements Authorization {
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_acceptGift
,
"代理人赠送代金券未开启"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"客户B使用代金券下单价格小于
代金券
的商品"
,
priority
=
28
)
public
void
客户
B
使用代金券下单价格小于
代金券
的商品
()
{
@Test
(
description
=
"客户B使用代金券下单价格小于
价格
的商品"
,
priority
=
28
)
public
void
客户
B
使用代金券下单价格小于
价格
的商品
()
{
visitorAuth2
();
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
orderPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderPar
.
put
(
"confId"
,
VoucherConf
.
skIdSecond
);
orderPar
.
put
(
"voucherId"
,
voucherId
);
orderPar
.
put
(
"couponsId"
,
""
);
Response
orderRes
=
network
.
postResponse
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
);
try
{
boolean
data
=
orderRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"下单失败"
,
orderRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
orderPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrder
,
"未获取到数据"
,
orderRes
.
body
().
asString
()));
}
order
(
VoucherConf
.
skIdSecond
,
""
,
voucherId
);
}
@Test
(
description
=
"客户B获取下单结果"
,
priority
=
29
)
public
void
客户
B
获取下单结果
()
{
Map
<
String
,
Object
>
orderResultPar
=
new
HashMap
<>();
orderResultPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderResultPar
.
put
(
"confId"
,
VoucherConf
.
skIdSecond
);
Response
orderResultRes
=
null
;
Object
data
=
null
;
int
i
=
0
;
try
{
// 轮训下单接口
while
(
data
==
null
){
sleep
(
2000
);
orderResultRes
=
network
.
getResponse
(
orderResultPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
);
data
=
orderResultRes
.
jsonPath
().
getJsonObject
(
"data"
);
i
++;
if
(
i
==
10
){
Assert
.
fail
(
network
.
message
(
orderResultPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"轮训下单结果超过10次"
,
orderResultRes
.
body
().
asString
()));
}
}
int
state
=
orderResultRes
.
jsonPath
().
getInt
(
"data.state"
);
Assert
.
assertEquals
(
state
,
3
,
network
.
message
(
orderResultPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"下单未成功"
,
orderResultRes
.
body
().
asString
()));
System
.
out
.
println
(
data
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
orderResultPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"获取数据失败"
,
orderResultRes
.
body
().
asString
()));
}
orderResult
(
VoucherConf
.
skIdSecond
,
1
);
}
@Test
(
description
=
"管理后台查看用户代金券秒杀订单"
,
priority
=
30
)
...
...
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