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
59b9071f
Commit
59b9071f
authored
Mar 08, 2022
by
龚小红
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix---修复优惠券商品秒杀id错误
parent
8b83730b
Changes
2
Expand all
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 @
59b9071f
This diff is collapsed.
Click to expand it.
src/test/java/com/kjj/cases/live/secondKill/Voucher.java
View file @
59b9071f
...
...
@@ -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