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
98c28a53
Commit
98c28a53
authored
Sep 22, 2021
by
郭姣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0元秒杀,多商品上架接口用例
parent
d592ef14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
28 deletions
+107
-28
ConfSecondKill.java
...st/java/com/kjj/cases/live/secondKill/ConfSecondKill.java
+33
-13
SecondKill.java
src/test/java/com/kjj/cases/live/secondKill/SecondKill.java
+74
-15
No files found.
src/test/java/com/kjj/cases/live/secondKill/ConfSecondKill.java
View file @
98c28a53
...
@@ -29,6 +29,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -29,6 +29,7 @@ public class ConfSecondKill implements Authorization {
public
static
final
String
secKillGoodsIdEncode
=
IdMakeUtil
.
managerEncodingId
(
secKillGoodsId
);
public
static
final
String
secKillGoodsIdEncode
=
IdMakeUtil
.
managerEncodingId
(
secKillGoodsId
);
public
static
String
skIdFirst
;
// 第一轮秒杀id
public
static
String
skIdFirst
;
// 第一轮秒杀id
public
static
String
skIdSecond
;
// 第二轮秒杀ID
public
static
String
skIdSecond
;
// 第二轮秒杀ID
public
static
String
skIdThird
;
//0元商品秒杀ID
public
static
int
killListSize
;
public
static
int
killListSize
;
@BeforeClass
@BeforeClass
...
@@ -164,7 +165,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -164,7 +165,7 @@ public class ConfSecondKill implements Authorization {
/**
/**
* 助播端编辑秒杀轮次
* 助播端编辑秒杀轮次
*/
*/
@Test
(
description
=
"助播端获取公司秒杀商品列表"
,
priority
=
6
)
@Test
(
description
=
"助播端获取公司秒杀商品列表"
,
priority
=
7
)
public
void
助播端获取公司秒杀商品列表
()
{
public
void
助播端获取公司秒杀商品列表
()
{
Map
<
String
,
Object
>
skGoodsListPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
skGoodsListPar
=
new
HashMap
<>();
skGoodsListPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
skGoodsListPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
...
@@ -180,7 +181,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -180,7 +181,7 @@ public class ConfSecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"助播端新增秒杀轮次"
,
priority
=
7
)
@Test
(
description
=
"助播端新增秒杀轮次"
,
priority
=
8
)
public
void
助播端新增秒杀轮次
()
{
public
void
助播端新增秒杀轮次
()
{
Map
<
String
,
Object
>
secKillAddPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
secKillAddPar
=
new
HashMap
<>();
secKillAddPar
.
put
(
"goodsId"
,
secKillGoodsIdEncode
);
secKillAddPar
.
put
(
"goodsId"
,
secKillGoodsIdEncode
);
...
@@ -198,7 +199,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -198,7 +199,7 @@ public class ConfSecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"新增第二轮秒杀"
,
priority
=
8
)
@Test
(
description
=
"新增第二轮秒杀"
,
priority
=
9
)
public
void
新增第二轮秒杀
()
{
public
void
新增第二轮秒杀
()
{
Map
<
String
,
Object
>
secKillAddPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
secKillAddPar
=
new
HashMap
<>();
secKillAddPar
.
put
(
"goodsId"
,
secKillGoodsIdEncode
);
secKillAddPar
.
put
(
"goodsId"
,
secKillGoodsIdEncode
);
...
@@ -216,7 +217,25 @@ public class ConfSecondKill implements Authorization {
...
@@ -216,7 +217,25 @@ public class ConfSecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"助播端获取秒杀轮次列表"
,
priority
=
9
)
@Test
(
description
=
"助播端新增0元秒杀商品"
,
priority
=
10
)
public
void
助播端新增
0
元秒杀商品
(){
Map
<
String
,
Object
>
secKillAddPar
=
new
HashMap
<>();
secKillAddPar
.
put
(
"goodsId"
,
secKillGoodsIdEncode
);
secKillAddPar
.
put
(
"goodsAmount"
,
0
);
// 1 == 0.01
secKillAddPar
.
put
(
"interactNum"
,
1
);
secKillAddPar
.
put
(
"ableAgent"
,
1
);
// 代理人可参与
secKillAddPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
secKillAddRes
=
network
.
postResponse
(
secKillAddPar
,
BasicConfig
.
ANCHOR_secondKillSave
);
try
{
boolean
data
=
secKillAddRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
secKillAddPar
,
BasicConfig
.
ANCHOR_secondKillSave
,
"新增轮次失败"
,
secKillAddRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
secKillAddPar
,
BasicConfig
.
ANCHOR_secondKillSave
,
"未获取到数据"
,
secKillAddRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"助播端获取秒杀轮次列表"
,
priority
=
11
)
public
void
助播端获取秒杀轮次列表
()
{
public
void
助播端获取秒杀轮次列表
()
{
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
...
@@ -230,6 +249,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -230,6 +249,7 @@ public class ConfSecondKill implements Authorization {
Assert
.
assertEquals
(
goodsId
,
secKillGoodsIdEncode
,
network
.
message
(
liveSecKillPar
,
BasicConfig
.
ANCHOR_secondKillLists
,
"轮次对应商品ID错误"
,
liveSecKillRes
.
body
().
asString
()));
Assert
.
assertEquals
(
goodsId
,
secKillGoodsIdEncode
,
network
.
message
(
liveSecKillPar
,
BasicConfig
.
ANCHOR_secondKillLists
,
"轮次对应商品ID错误"
,
liveSecKillRes
.
body
().
asString
()));
skIdFirst
=
secKillLists
.
get
(
0
).
getId
();
skIdFirst
=
secKillLists
.
get
(
0
).
getId
();
skIdSecond
=
secKillLists
.
get
(
1
).
getId
();
skIdSecond
=
secKillLists
.
get
(
1
).
getId
();
skIdThird
=
secKillLists
.
get
(
2
).
getId
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
liveSecKillPar
,
BasicConfig
.
ANCHOR_secondKillLists
,
"未获取到数据"
,
liveSecKillRes
.
body
().
asString
()));
Assert
.
fail
(
network
.
message
(
liveSecKillPar
,
BasicConfig
.
ANCHOR_secondKillLists
,
"未获取到数据"
,
liveSecKillRes
.
body
().
asString
()));
...
@@ -237,7 +257,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -237,7 +257,7 @@ public class ConfSecondKill implements Authorization {
}
}
@Test
(
description
=
"助播端编辑秒杀轮次"
,
priority
=
1
0
)
@Test
(
description
=
"助播端编辑秒杀轮次"
,
priority
=
1
2
)
public
void
助播端编辑秒杀轮次
()
{
public
void
助播端编辑秒杀轮次
()
{
Map
<
String
,
Object
>
secKillUpdatePar
=
new
HashMap
<>();
Map
<
String
,
Object
>
secKillUpdatePar
=
new
HashMap
<>();
secKillUpdatePar
.
put
(
"goodsId"
,
secKillGoodsIdEncode
);
secKillUpdatePar
.
put
(
"goodsId"
,
secKillGoodsIdEncode
);
...
@@ -256,7 +276,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -256,7 +276,7 @@ public class ConfSecondKill implements Authorization {
}
}
//****************************秒杀预告***************************************
//****************************秒杀预告***************************************
@Test
(
description
=
"上传预告底图"
,
priority
=
1
1
)
@Test
(
description
=
"上传预告底图"
,
priority
=
1
3
)
public
void
上传预告底图
()
{
public
void
上传预告底图
()
{
BaseUtils
.
ssoLogin
();
BaseUtils
.
ssoLogin
();
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
...
@@ -273,7 +293,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -273,7 +293,7 @@ public class ConfSecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"开启秒杀预告配置"
,
priority
=
1
2
)
@Test
(
description
=
"开启秒杀预告配置"
,
priority
=
1
4
)
public
void
开启秒杀预告配置
()
{
public
void
开启秒杀预告配置
()
{
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
...
@@ -289,7 +309,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -289,7 +309,7 @@ public class ConfSecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"获取秒杀预告配置详情"
,
priority
=
1
3
)
@Test
(
description
=
"获取秒杀预告配置详情"
,
priority
=
1
5
)
public
void
获取秒杀预告配置详情
()
{
public
void
获取秒杀预告配置详情
()
{
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
...
@@ -307,7 +327,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -307,7 +327,7 @@ public class ConfSecondKill implements Authorization {
}
}
//************************访客端********************************
//************************访客端********************************
@Test
(
description
=
"查询秒杀预告开启状态"
,
priority
=
1
4
)
@Test
(
description
=
"查询秒杀预告开启状态"
,
priority
=
1
6
)
public
void
查询秒杀预告开启状态
()
{
public
void
查询秒杀预告开启状态
()
{
visitorAuth9
();
visitorAuth9
();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
...
@@ -325,7 +345,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -325,7 +345,7 @@ public class ConfSecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"获取秒杀预告配置图片"
,
priority
=
1
5
)
@Test
(
description
=
"获取秒杀预告配置图片"
,
priority
=
1
7
)
public
void
获取秒杀预告配置图片
()
{
public
void
获取秒杀预告配置图片
()
{
visitorAuth9
();
visitorAuth9
();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
...
@@ -343,7 +363,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -343,7 +363,7 @@ public class ConfSecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"获取秒杀预告商品列表"
,
priority
=
1
6
)
@Test
(
description
=
"获取秒杀预告商品列表"
,
priority
=
1
8
)
public
void
获取秒杀预告商品列表
()
{
public
void
获取秒杀预告商品列表
()
{
visitorAuth9
();
visitorAuth9
();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
...
@@ -361,7 +381,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -361,7 +381,7 @@ public class ConfSecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"订阅秒杀开抢提醒"
,
priority
=
1
7
)
@Test
(
description
=
"订阅秒杀开抢提醒"
,
priority
=
1
9
)
public
void
订阅秒杀开抢提醒
()
{
public
void
订阅秒杀开抢提醒
()
{
visitorAuth9
();
visitorAuth9
();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
...
@@ -378,7 +398,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -378,7 +398,7 @@ public class ConfSecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"查询秒杀订阅状态"
,
priority
=
18
)
@Test
(
description
=
"查询秒杀订阅状态"
,
priority
=
20
)
public
void
查询秒杀订阅状态
()
{
public
void
查询秒杀订阅状态
()
{
visitorAuth9
();
visitorAuth9
();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
...
...
src/test/java/com/kjj/cases/live/secondKill/SecondKill.java
View file @
98c28a53
...
@@ -167,14 +167,28 @@ public class SecondKill implements Authorization {
...
@@ -167,14 +167,28 @@ public class SecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"无法同时上架多轮秒杀"
,
priority
=
10
)
// @Test(description = "无法同时上架多轮秒杀", priority = 10)
public
void
无法同时上架多轮秒杀
()
{
// public void 无法同时上架多轮秒杀() {
// Map<String, Object> goodsOnPar = new HashMap<>();
// goodsOnPar.put("id", ConfSecondKill.skIdSecond);
// Response goodsOnRes = network.postResponse(goodsOnPar, BasicConfig.ANCHOR_secondKillOn);
// try {
// boolean data = goodsOnRes.jsonPath().getBoolean("data");
// Assert.assertTrue(data, network.message(goodsOnPar, BasicConfig.ANCHOR_secondKillOn, "上架第二轮秒杀失败", goodsOnRes.body().asString()));
// }catch (NullPointerException e){
// e.printStackTrace();
// Assert.fail(network.message(goodsOnPar, BasicConfig.ANCHOR_secondKillOn, "未获取到数据", goodsOnRes.body().asString()));
// }
// }
@Test
(
description
=
"同时上架0秒杀商品"
,
priority
=
10
)
public
void
同时上架
0
秒杀商品
()
{
adminAuth
();
Map
<
String
,
Object
>
goodsOnPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
goodsOnPar
=
new
HashMap
<>();
goodsOnPar
.
put
(
"id"
,
ConfSecondKill
.
skId
Secon
d
);
goodsOnPar
.
put
(
"id"
,
ConfSecondKill
.
skId
Thir
d
);
Response
goodsOnRes
=
network
.
postResponse
(
goodsOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
);
Response
goodsOnRes
=
network
.
postResponse
(
goodsOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
);
try
{
try
{
boolean
data
=
goodsOnRes
.
jsonPath
().
getBoolean
(
"data"
);
boolean
data
=
goodsOnRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
goodsOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
,
"上架
第二轮
秒杀失败"
,
goodsOnRes
.
body
().
asString
()));
Assert
.
assertTrue
(
data
,
network
.
message
(
goodsOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
,
"上架
0元商品
秒杀失败"
,
goodsOnRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
goodsOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
,
"未获取到数据"
,
goodsOnRes
.
body
().
asString
()));
Assert
.
fail
(
network
.
message
(
goodsOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
,
"未获取到数据"
,
goodsOnRes
.
body
().
asString
()));
...
@@ -191,7 +205,7 @@ public class SecondKill implements Authorization {
...
@@ -191,7 +205,7 @@ public class SecondKill implements Authorization {
System
.
out
.
println
(
goodsFirstRes
.
body
().
asString
());
System
.
out
.
println
(
goodsFirstRes
.
body
().
asString
());
try
{
try
{
String
confId
=
goodsFirstRes
.
jsonPath
().
getString
(
"data.confId"
);
String
confId
=
goodsFirstRes
.
jsonPath
().
getString
(
"data.confId"
);
Assert
.
assertEquals
(
confId
,
ConfSecondKill
.
skId
Secon
d
,
network
.
message
(
goodsFirstPar
,
BasicConfig
.
MOBILE_secondKill_goodsFirst
,
"当前秒杀商品配置ID错误"
,
goodsFirstRes
.
body
().
asString
()));
Assert
.
assertEquals
(
confId
,
ConfSecondKill
.
skId
Thir
d
,
network
.
message
(
goodsFirstPar
,
BasicConfig
.
MOBILE_secondKill_goodsFirst
,
"当前秒杀商品配置ID错误"
,
goodsFirstRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
goodsFirstPar
,
BasicConfig
.
MOBILE_secondKill_goodsFirst
,
"未获取到数据"
,
goodsFirstRes
.
body
().
asString
()));
Assert
.
fail
(
network
.
message
(
goodsFirstPar
,
BasicConfig
.
MOBILE_secondKill_goodsFirst
,
"未获取到数据"
,
goodsFirstRes
.
body
().
asString
()));
...
@@ -205,7 +219,8 @@ public class SecondKill implements Authorization {
...
@@ -205,7 +219,8 @@ public class SecondKill implements Authorization {
Response
downgradeGoodsRes
=
network
.
getResponse
(
downgradeGoodsPar
,
BasicConfig
.
MOBILE_secondKill_downgradeGoodsFirst
);
Response
downgradeGoodsRes
=
network
.
getResponse
(
downgradeGoodsPar
,
BasicConfig
.
MOBILE_secondKill_downgradeGoodsFirst
);
try
{
try
{
String
confId
=
downgradeGoodsRes
.
jsonPath
().
getString
(
"data.confId"
);
String
confId
=
downgradeGoodsRes
.
jsonPath
().
getString
(
"data.confId"
);
Assert
.
assertEquals
(
confId
,
ConfSecondKill
.
skIdSecond
,
network
.
message
(
downgradeGoodsPar
,
BasicConfig
.
MOBILE_secondKill_goodsFirst
,
"当前秒杀商品配置ID错误"
,
downgradeGoodsRes
.
body
().
asString
()));
//校验最新上架的商品
Assert
.
assertEquals
(
confId
,
ConfSecondKill
.
skIdThird
,
network
.
message
(
downgradeGoodsPar
,
BasicConfig
.
MOBILE_secondKill_goodsFirst
,
"当前秒杀商品配置ID错误"
,
downgradeGoodsRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
downgradeGoodsPar
,
BasicConfig
.
MOBILE_secondKill_goodsFirst
,
"未获取到数据"
,
downgradeGoodsRes
.
body
().
asString
()));
Assert
.
fail
(
network
.
message
(
downgradeGoodsPar
,
BasicConfig
.
MOBILE_secondKill_goodsFirst
,
"未获取到数据"
,
downgradeGoodsRes
.
body
().
asString
()));
...
@@ -368,7 +383,51 @@ public class SecondKill implements Authorization {
...
@@ -368,7 +383,51 @@ public class SecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"查询待支付状态"
,
priority
=
21
)
@Test
(
description
=
"正常用户下单0元秒杀商品"
,
priority
=
21
)
public
void
正常用户下单
0
元秒杀商品
()
{
visitorAuth
();
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
()));
}
}
@Test
(
description
=
"正常用户获取0元商品下单结果"
,
priority
=
22
)
public
void
正常用户获取
0
元商品下单结果
()
{
Map
<
String
,
Object
>
orderResultPar
=
new
HashMap
<>();
orderResultPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
orderResultPar
.
put
(
"confId"
,
ConfSecondKill
.
skIdThird
);
Response
orderResultRes
=
null
;
Object
data
=
null
;
int
i
=
0
;
try
{
// 轮训下单接口
while
(
data
==
null
){
ThreadSleepUtils
.
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
()));
}
}
@Test
(
description
=
"查询待支付状态"
,
priority
=
23
)
public
void
查询待支付状态
()
{
public
void
查询待支付状态
()
{
Map
<
String
,
Object
>
killGoodsPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
killGoodsPar
=
new
HashMap
<>();
killGoodsPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
killGoodsPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
...
@@ -391,7 +450,7 @@ public class SecondKill implements Authorization {
...
@@ -391,7 +450,7 @@ public class SecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"占用库存"
,
priority
=
2
2
)
@Test
(
description
=
"占用库存"
,
priority
=
2
4
)
public
void
占用库存
()
{
public
void
占用库存
()
{
// 切换助播端视角获取当前轮次剩余数量
// 切换助播端视角获取当前轮次剩余数量
adminAuth
();
adminAuth
();
...
@@ -417,7 +476,7 @@ public class SecondKill implements Authorization {
...
@@ -417,7 +476,7 @@ public class SecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"超时未支付"
,
priority
=
2
3
)
@Test
(
description
=
"超时未支付"
,
priority
=
2
5
)
public
void
超时未支付
()
{
public
void
超时未支付
()
{
// 助播端视角查看库存是否释放
// 助播端视角查看库存是否释放
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
...
@@ -463,7 +522,7 @@ public class SecondKill implements Authorization {
...
@@ -463,7 +522,7 @@ public class SecondKill implements Authorization {
* 放开代理人秒杀限制
* 放开代理人秒杀限制
* 助播端需先下架秒杀才能进行编辑
* 助播端需先下架秒杀才能进行编辑
*/
*/
@Test
(
description
=
"助播端下架秒杀"
,
priority
=
2
4
)
@Test
(
description
=
"助播端下架秒杀"
,
priority
=
2
6
)
public
void
助播端下架秒杀
()
{
public
void
助播端下架秒杀
()
{
adminAuth
();
adminAuth
();
Map
<
String
,
Object
>
skOffPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
skOffPar
=
new
HashMap
<>();
...
@@ -478,7 +537,7 @@ public class SecondKill implements Authorization {
...
@@ -478,7 +537,7 @@ public class SecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"上架第二轮秒杀,代理人可参与"
,
priority
=
2
5
)
@Test
(
description
=
"上架第二轮秒杀,代理人可参与"
,
priority
=
2
7
)
public
void
上架第二轮秒杀
()
{
public
void
上架第二轮秒杀
()
{
Map
<
String
,
Object
>
skOnPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
skOnPar
=
new
HashMap
<>();
skOnPar
.
put
(
"id"
,
ConfSecondKill
.
skIdSecond
);
skOnPar
.
put
(
"id"
,
ConfSecondKill
.
skIdSecond
);
...
@@ -492,7 +551,7 @@ public class SecondKill implements Authorization {
...
@@ -492,7 +551,7 @@ public class SecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"代理人成功下单-占用库存"
,
priority
=
2
6
)
@Test
(
description
=
"代理人成功下单-占用库存"
,
priority
=
2
8
)
public
void
代理人成功下单
()
{
public
void
代理人成功下单
()
{
agentAuth
();
agentAuth
();
// 下单
// 下单
...
@@ -535,7 +594,7 @@ public class SecondKill implements Authorization {
...
@@ -535,7 +594,7 @@ public class SecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"用户下单无库存秒杀失败"
,
priority
=
2
7
)
@Test
(
description
=
"用户下单无库存秒杀失败"
,
priority
=
2
9
)
public
void
用户下单无库存秒杀
()
{
public
void
用户下单无库存秒杀
()
{
visitorAuth
();
visitorAuth
();
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
...
@@ -585,7 +644,7 @@ public class SecondKill implements Authorization {
...
@@ -585,7 +644,7 @@ public class SecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"删除已上架过的轮次"
,
priority
=
28
)
@Test
(
description
=
"删除已上架过的轮次"
,
priority
=
30
)
public
void
已上架过的轮次无法删除
()
{
public
void
已上架过的轮次无法删除
()
{
long
id
=
IdMakeUtil
.
managerDecodeingId
(
ConfSecondKill
.
skIdFirst
);
long
id
=
IdMakeUtil
.
managerDecodeingId
(
ConfSecondKill
.
skIdFirst
);
Map
<
String
,
Object
>
delSkPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
delSkPar
=
new
HashMap
<>();
...
@@ -604,7 +663,7 @@ public class SecondKill implements Authorization {
...
@@ -604,7 +663,7 @@ public class SecondKill implements Authorization {
}
}
}
}
@Test
(
description
=
"用户成功支付"
,
priority
=
29
)
@Test
(
description
=
"用户成功支付"
,
priority
=
31
)
public
void
用户成功支付
()
{
public
void
用户成功支付
()
{
visitorAuth
();
visitorAuth
();
// 新建订单
// 新建订单
...
...
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