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
54c98c23
Commit
54c98c23
authored
Oct 23, 2021
by
郭姣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
秒杀资格接口
parent
8b6429a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
228 additions
and
31 deletions
+228
-31
QualifiedCardList.java
src/test/java/com/kjj/bean/secondKill/QualifiedCardList.java
+10
-0
ConfSecondKill.java
...st/java/com/kjj/cases/live/secondKill/ConfSecondKill.java
+103
-18
SecondKill.java
src/test/java/com/kjj/cases/live/secondKill/SecondKill.java
+112
-12
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+3
-1
No files found.
src/test/java/com/kjj/bean/secondKill/QualifiedCardList.java
0 → 100644
View file @
54c98c23
package
com
.
kjj
.
bean
.
secondKill
;
import
lombok.Data
;
@Data
public
class
QualifiedCardList
{
private
String
goodsImg
;
private
String
goodsPrice
;
private
String
goodsTitle
;
}
src/test/java/com/kjj/cases/live/secondKill/ConfSecondKill.java
View file @
54c98c23
...
...
@@ -2,6 +2,7 @@ package com.kjj.cases.live.secondKill;
import
com.kjj.bean.secondKill.AnchorGetKGList
;
import
com.kjj.bean.secondKill.AnchorGetSKList
;
import
com.kjj.bean.secondKill.QualifiedCardList
;
import
com.kjj.bean.secondKill.SecondKillList
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.config.BasicConfig
;
...
...
@@ -27,6 +28,8 @@ public class ConfSecondKill implements Authorization {
private
long
newSecKillId
;
// 会被删除的秒杀id
private
static
final
long
secKillGoodsId
=
115
;
// 用来配置轮次的秒杀商品ID
public
static
final
String
secKillGoodsIdEncode
=
IdMakeUtil
.
managerEncodingId
(
secKillGoodsId
);
public
static
String
ManageQualifiedId
;
//管理后台秒杀资格的商品ID
public
static
String
QualifiedId
;
//秒杀资格的商品ID
public
static
String
skIdFirst
;
// 第一轮秒杀id
public
static
String
skIdSecond
;
// 第二轮秒杀ID
public
static
String
skIdThird
;
//0元商品秒杀ID
...
...
@@ -165,10 +168,91 @@ public class ConfSecondKill implements Authorization {
}
}
//************************秒杀资格商品********************************
//管理后台新增秒杀资格商品
@Test
(
description
=
"新增秒杀资格商品"
,
priority
=
6
)
public
void
新增秒杀资格商品
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"goodsId"
,
secKillGoodsId
);
params
.
put
(
"ableAgent"
,
0
);
params
.
put
(
"assistLimit"
,
10
);
params
.
put
(
"assistPeopleNum"
,
2
);
//秒杀资格需要的助力人数
QualifiedCardList
cardConfigOne
=
new
QualifiedCardList
();
cardConfigOne
.
setGoodsImg
(
"https://yun.kjjcrm.com/kjy/media/file/20211019/3137ec33ffdd757e18335e0dd5da5927.png?x-oss-process=image/quality,q_80"
);
cardConfigOne
.
setGoodsPrice
(
"0.01元"
);
cardConfigOne
.
setGoodsTitle
(
"现金红包11"
);
QualifiedCardList
cardConfigTwo
=
new
QualifiedCardList
();
cardConfigTwo
.
setGoodsImg
(
"https://yun.kjjcrm.com/kjy/media/file/20211019/628d4ec75a516a8ef8a20f1a4de22d41.png?x-oss-process=image/quality,q_80"
);
cardConfigTwo
.
setGoodsPrice
(
"10元秒杀资格"
);
cardConfigTwo
.
setGoodsTitle
(
"清风卷纸11"
);
QualifiedCardList
infallibleConfig
=
new
QualifiedCardList
();
infallibleConfig
.
setGoodsImg
(
"https://yun.dui88.com/kjy/image/20210819/1629368676829.jpeg"
);
infallibleConfig
.
setGoodsPrice
(
"0元秒杀资格"
);
infallibleConfig
.
setGoodsTitle
(
"自动化专用商品"
);
params
.
put
(
"cardConfigOne"
,
cardConfigOne
);
params
.
put
(
"cardConfigTwo"
,
cardConfigTwo
);
params
.
put
(
"infallibleConfig"
,
infallibleConfig
);
params
.
put
(
"goodsAmount"
,
0
);
params
.
put
(
"interactNum"
,
2
);
params
.
put
(
"isNeedQualified"
,
1
);
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_secondKillSave
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_secondKillSave
,
"新增需要秒杀资格的商品失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取秒杀资格商品详情"
,
priority
=
7
)
public
void
获取秒杀资格商品详情
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MANAGER_secondKillLists
);
Object
cardConfigOne
=
response
.
jsonPath
().
getJsonObject
(
"data.get(0).cardConfigOne"
);
Assert
.
assertNotNull
(
cardConfigOne
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_secondKillLists
,
"获取商品配图1信息失败"
,
response
.
body
().
asString
()));
Object
cardConfigTwo
=
response
.
jsonPath
().
getJsonObject
(
"data.get(0).cardConfigTwo"
);
Assert
.
assertNotNull
(
cardConfigTwo
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_secondKillLists
,
"获取商品配图2信息失败"
,
response
.
body
().
asString
()));
Object
infallibleConfig
=
response
.
jsonPath
().
getJsonObject
(
"data.get(0).infallibleConfig"
);
Assert
.
assertNotNull
(
infallibleConfig
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_secondKillLists
,
"获取秒杀资格商品信息失败"
,
response
.
body
().
asString
()));
int
isNeedQualified
=
response
.
jsonPath
().
getJsonObject
(
"data.get(0).isNeedQualified"
);
Assert
.
assertEquals
(
isNeedQualified
,
1
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_secondKillLists
,
"获取秒杀资格配置状态错误"
,
response
.
body
().
asString
()));
ManageQualifiedId
=
response
.
jsonPath
().
getString
(
"data.get(0).id"
);
System
.
out
.
println
(
ManageQualifiedId
);
}
@Test
(
description
=
"编辑秒杀资格商品"
,
priority
=
8
)
public
void
编辑秒杀资格商品
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"goodsId"
,
secKillGoodsId
);
params
.
put
(
"id"
,
ManageQualifiedId
);
params
.
put
(
"ableAgent"
,
1
);
params
.
put
(
"assistLimit"
,
10
);
params
.
put
(
"assistPeopleNum"
,
1
);
//秒杀资格需要的助力人数
QualifiedCardList
cardConfigOne
=
new
QualifiedCardList
();
cardConfigOne
.
setGoodsImg
(
"https://yun.kjjcrm.com/kjy/media/file/20211019/3137ec33ffdd757e18335e0dd5da5927.png?x-oss-process=image/quality,q_80"
);
cardConfigOne
.
setGoodsPrice
(
"0.01元"
);
cardConfigOne
.
setGoodsTitle
(
"现金红包11"
);
QualifiedCardList
cardConfigTwo
=
new
QualifiedCardList
();
cardConfigTwo
.
setGoodsImg
(
"https://yun.kjjcrm.com/kjy/media/file/20211019/628d4ec75a516a8ef8a20f1a4de22d41.png?x-oss-process=image/quality,q_80"
);
cardConfigTwo
.
setGoodsPrice
(
"10元秒杀资格"
);
cardConfigTwo
.
setGoodsTitle
(
"清风卷纸11"
);
QualifiedCardList
infallibleConfig
=
new
QualifiedCardList
();
infallibleConfig
.
setGoodsImg
(
"https://yun.dui88.com/kjy/image/20211020/1634721909361.jpeg"
);
infallibleConfig
.
setGoodsPrice
(
"0元秒杀资格"
);
infallibleConfig
.
setGoodsTitle
(
"自动化秒杀资格商品"
);
params
.
put
(
"cardConfigOne"
,
cardConfigOne
);
params
.
put
(
"cardConfigTwo"
,
cardConfigTwo
);
params
.
put
(
"infallibleConfig"
,
infallibleConfig
);
params
.
put
(
"goodsAmount"
,
0
);
params
.
put
(
"interactNum"
,
2
);
params
.
put
(
"isNeedQualified"
,
1
);
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_secondKillUpdate
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_secondKillUpdate
,
"编辑需要秒杀资格的商品失败"
,
response
.
body
().
asString
()));
}
/**
* 助播端编辑秒杀轮次
*/
@Test
(
description
=
"助播端获取公司秒杀商品列表"
,
priority
=
7
)
@Test
(
description
=
"助播端获取公司秒杀商品列表"
,
priority
=
9
)
public
void
助播端获取公司秒杀商品列表
()
{
Map
<
String
,
Object
>
skGoodsListPar
=
new
HashMap
<>();
skGoodsListPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
...
...
@@ -184,7 +268,7 @@ public class ConfSecondKill implements Authorization {
}
}
@Test
(
description
=
"助播端新增秒杀轮次"
,
priority
=
8
)
@Test
(
description
=
"助播端新增秒杀轮次"
,
priority
=
10
)
public
void
助播端新增秒杀轮次
()
{
Map
<
String
,
Object
>
secKillAddPar
=
new
HashMap
<>();
secKillAddPar
.
put
(
"goodsId"
,
secKillGoodsIdEncode
);
...
...
@@ -203,7 +287,7 @@ public class ConfSecondKill implements Authorization {
}
}
@Test
(
description
=
"新增第二轮秒杀"
,
priority
=
9
)
@Test
(
description
=
"新增第二轮秒杀"
,
priority
=
11
)
public
void
新增第二轮秒杀
()
{
Map
<
String
,
Object
>
secKillAddPar
=
new
HashMap
<>();
secKillAddPar
.
put
(
"goodsId"
,
secKillGoodsIdEncode
);
...
...
@@ -222,7 +306,7 @@ public class ConfSecondKill implements Authorization {
}
}
@Test
(
description
=
"助播端新增0元秒杀商品"
,
priority
=
1
0
)
@Test
(
description
=
"助播端新增0元秒杀商品"
,
priority
=
1
2
)
public
void
助播端新增
0
元秒杀商品
(){
Map
<
String
,
Object
>
secKillAddPar
=
new
HashMap
<>();
secKillAddPar
.
put
(
"goodsId"
,
secKillGoodsIdEncode
);
...
...
@@ -241,7 +325,7 @@ public class ConfSecondKill implements Authorization {
}
}
@Test
(
description
=
"助播端获取秒杀轮次列表"
,
priority
=
1
1
)
@Test
(
description
=
"助播端获取秒杀轮次列表"
,
priority
=
1
3
)
public
void
助播端获取秒杀轮次列表
()
{
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
...
...
@@ -253,9 +337,10 @@ public class ConfSecondKill implements Authorization {
killListSize
=
secKillLists
.
size
();
String
goodsId
=
secKillLists
.
get
(
0
).
getGoodsId
();
Assert
.
assertEquals
(
goodsId
,
secKillGoodsIdEncode
,
network
.
message
(
liveSecKillPar
,
BasicConfig
.
ANCHOR_secondKillLists
,
"轮次对应商品ID错误"
,
liveSecKillRes
.
body
().
asString
()));
skIdFirst
=
secKillLists
.
get
(
0
).
getId
();
skIdSecond
=
secKillLists
.
get
(
1
).
getId
();
skIdThird
=
secKillLists
.
get
(
2
).
getId
();
QualifiedId
=
secKillLists
.
get
(
0
).
getId
();
skIdFirst
=
secKillLists
.
get
(
1
).
getId
();
skIdSecond
=
secKillLists
.
get
(
2
).
getId
();
skIdThird
=
secKillLists
.
get
(
3
).
getId
();
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
liveSecKillPar
,
BasicConfig
.
ANCHOR_secondKillLists
,
"未获取到数据"
,
liveSecKillRes
.
body
().
asString
()));
...
...
@@ -263,7 +348,7 @@ public class ConfSecondKill implements Authorization {
}
@Test
(
description
=
"助播端编辑秒杀轮次"
,
priority
=
1
2
)
@Test
(
description
=
"助播端编辑秒杀轮次"
,
priority
=
1
4
)
public
void
助播端编辑秒杀轮次
()
{
Map
<
String
,
Object
>
secKillUpdatePar
=
new
HashMap
<>();
secKillUpdatePar
.
put
(
"goodsId"
,
secKillGoodsIdEncode
);
...
...
@@ -283,7 +368,7 @@ public class ConfSecondKill implements Authorization {
}
//****************************秒杀预告***************************************
@Test
(
description
=
"上传预告底图"
,
priority
=
1
3
)
@Test
(
description
=
"上传预告底图"
,
priority
=
1
5
)
public
void
上传预告底图
()
{
BaseUtils
.
ssoLogin
();
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
...
...
@@ -300,7 +385,7 @@ public class ConfSecondKill implements Authorization {
}
}
@Test
(
description
=
"开启秒杀预告配置"
,
priority
=
1
4
)
@Test
(
description
=
"开启秒杀预告配置"
,
priority
=
1
6
)
public
void
开启秒杀预告配置
()
{
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
...
...
@@ -316,7 +401,7 @@ public class ConfSecondKill implements Authorization {
}
}
@Test
(
description
=
"获取秒杀预告配置详情"
,
priority
=
1
5
)
@Test
(
description
=
"获取秒杀预告配置详情"
,
priority
=
1
7
)
public
void
获取秒杀预告配置详情
()
{
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
...
...
@@ -334,7 +419,7 @@ public class ConfSecondKill implements Authorization {
}
//************************访客端********************************
@Test
(
description
=
"查询秒杀预告开启状态"
,
priority
=
1
6
)
@Test
(
description
=
"查询秒杀预告开启状态"
,
priority
=
1
8
)
public
void
查询秒杀预告开启状态
()
{
visitorAuth9
();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
...
...
@@ -352,7 +437,7 @@ public class ConfSecondKill implements Authorization {
}
}
@Test
(
description
=
"获取秒杀预告配置图片"
,
priority
=
1
7
)
@Test
(
description
=
"获取秒杀预告配置图片"
,
priority
=
1
9
)
public
void
获取秒杀预告配置图片
()
{
visitorAuth9
();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
...
...
@@ -370,7 +455,7 @@ public class ConfSecondKill implements Authorization {
}
}
@Test
(
description
=
"获取秒杀预告商品列表"
,
priority
=
18
)
@Test
(
description
=
"获取秒杀预告商品列表"
,
priority
=
20
)
public
void
获取秒杀预告商品列表
()
{
visitorAuth9
();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
...
...
@@ -388,7 +473,7 @@ public class ConfSecondKill implements Authorization {
}
}
@Test
(
description
=
"订阅秒杀开抢提醒"
,
priority
=
19
)
@Test
(
description
=
"订阅秒杀开抢提醒"
,
priority
=
21
)
public
void
订阅秒杀开抢提醒
()
{
visitorAuth9
();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
...
...
@@ -405,7 +490,7 @@ public class ConfSecondKill implements Authorization {
}
}
@Test
(
description
=
"查询秒杀订阅状态"
,
priority
=
2
0
)
@Test
(
description
=
"查询秒杀订阅状态"
,
priority
=
2
2
)
public
void
查询秒杀订阅状态
()
{
visitorAuth9
();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
...
...
@@ -413,7 +498,7 @@ public class ConfSecondKill implements Authorization {
Response
response
=
network
.
getResponse
(
getLiveAwardListParam
,
BasicConfig
.
ANCHOR_secondKillLists_goodsList
);
System
.
out
.
println
(
response
.
body
().
asString
());
try
{
int
isAppoint
=
response
.
jsonPath
().
getInt
(
"data.get(
0
).isAppoint"
);
int
isAppoint
=
response
.
jsonPath
().
getInt
(
"data.get(
1
).isAppoint"
);
Assert
.
assertEquals
(
isAppoint
,
1
,
network
.
message
(
getLiveAwardListParam
,
BasicConfig
.
ANCHOR_secondKillLists_goodsList
,
"用户秒杀订阅状态失败"
,
response
.
body
().
asString
()));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
...
...
src/test/java/com/kjj/cases/live/secondKill/SecondKill.java
View file @
54c98c23
...
...
@@ -20,7 +20,10 @@ import static com.kjj.utils.ThreadSleepUtils.sleep;
public
class
SecondKill
implements
Authorization
{
private
List
<
Long
>
confIds
;
private
static
final
long
secKillGoodsId
=
115
;
// 用来配置轮次的秒杀商品ID
public
static
final
String
secKillGoodsIdEncode
=
IdMakeUtil
.
managerEncodingId
(
secKillGoodsId
);
public
String
shareSign
;
public
Object
timestamp
;
//领取秒杀资格的时间戳
@BeforeClass
public
void
setUp
(){
BaseUtils
.
ssoLogin
();
...
...
@@ -123,7 +126,7 @@ public class SecondKill implements Authorization {
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
goodsListPar
,
BasicConfig
.
MOBILE_secondKill_getGoodsList
,
"未获取到数据"
,
goodsListRes
.
body
().
asString
()));
}
ConfSecondKill
.
skIdFirst
=
goodsListRes
.
jsonPath
().
getString
(
"data[0].confId"
);
//
ConfSecondKill.skIdFirst = goodsListRes.jsonPath().getString("data[0].confId");
}
@Test
(
description
=
"查看秒杀商品详情"
,
priority
=
8
)
...
...
@@ -142,9 +145,8 @@ public class SecondKill implements Authorization {
Assert
.
fail
(
network
.
message
(
goodsDetailPar
,
BasicConfig
.
MOBILE_secondKill_getGoodsDetail
,
"未获取到数据"
,
goodsDetailRes
.
body
().
asString
()));
}
}
// 助播端上架秒杀
@Test
(
description
=
"助播端上架秒杀"
,
priority
=
9
)
@Test
(
description
=
"助播端上架秒杀"
,
priority
=
10
)
public
void
助播端上架秒杀
()
{
adminAuth
();
Map
<
String
,
Object
>
goodsOnPar
=
new
HashMap
<>();
...
...
@@ -165,7 +167,7 @@ public class SecondKill implements Authorization {
Response
goodsStatusRes
=
network
.
getResponse
(
goodsStatusPar
,
BasicConfig
.
ANCHOR_secondKillLists
);
try
{
List
<
AnchorGetSKList
>
anchorGetSKLists
=
JsonUtil
.
parseResponseToListBean
(
goodsStatusRes
,
AnchorGetSKList
.
class
);
int
interactStatus
=
anchorGetSKLists
.
get
(
0
).
getInteractStatus
();
int
interactStatus
=
anchorGetSKLists
.
get
(
1
).
getInteractStatus
();
Assert
.
assertEquals
(
interactStatus
,
2
,
network
.
message
(
goodsStatusPar
,
BasicConfig
.
ANCHOR_secondKillLists
,
"秒杀轮次状态错误"
,
goodsStatusRes
.
body
().
asString
()));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
...
...
@@ -173,7 +175,7 @@ public class SecondKill implements Authorization {
}
}
@Test
(
description
=
"同时上架0秒杀商品"
,
priority
=
1
0
)
@Test
(
description
=
"同时上架0秒杀商品"
,
priority
=
1
1
)
public
void
同时上架
0
秒杀商品
()
{
adminAuth
();
Map
<
String
,
Object
>
goodsOnPar
=
new
HashMap
<>();
...
...
@@ -190,7 +192,7 @@ public class SecondKill implements Authorization {
}
// 切换访客
@Test
(
description
=
"查看当前秒杀商品"
,
priority
=
1
1
)
@Test
(
description
=
"查看当前秒杀商品"
,
priority
=
1
2
)
public
void
查看当前秒杀商品
()
{
visitorAuth1
();
sleep
(
10000
);
...
...
@@ -207,7 +209,7 @@ public class SecondKill implements Authorization {
}
}
@Test
(
description
=
"当前秒杀商品降级接口"
,
priority
=
1
2
)
@Test
(
description
=
"当前秒杀商品降级接口"
,
priority
=
1
3
)
public
void
当前秒杀商品降级接口
()
{
Map
<
String
,
Object
>
downgradeGoodsPar
=
new
HashMap
<>();
downgradeGoodsPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
...
...
@@ -227,7 +229,7 @@ public class SecondKill implements Authorization {
* 下单失败
*/
// 秒杀配置代理人不可参与
@Test
(
description
=
"代理人下单"
,
priority
=
1
3
)
@Test
(
description
=
"代理人下单"
,
priority
=
1
4
)
public
void
代理人下单
()
{
agentAuth
();
...
...
@@ -245,7 +247,7 @@ public class SecondKill implements Authorization {
}
}
@Test
(
description
=
"代理人下单失败"
,
priority
=
1
4
)
@Test
(
description
=
"代理人下单失败"
,
priority
=
1
5
)
public
void
代理人下单失败
()
{
Map
<
String
,
Object
>
orderResultPar
=
new
HashMap
<>();
orderResultPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
...
...
@@ -282,7 +284,7 @@ public class SecondKill implements Authorization {
}
// 访客被黑名单限制
@Test
(
description
=
"黑名单客户下单"
,
priority
=
1
5
)
@Test
(
description
=
"黑名单客户下单"
,
priority
=
1
6
)
public
void
黑名单客户下单
()
{
visitorAuth7
();
Map
<
String
,
Object
>
orderPar
=
new
HashMap
<>();
...
...
@@ -298,7 +300,7 @@ public class SecondKill implements Authorization {
}
}
@Test
(
description
=
"黑名单客户下单失败"
,
priority
=
1
6
)
@Test
(
description
=
"黑名单客户下单失败"
,
priority
=
1
7
)
public
void
黑名单客户下单失败
()
{
Map
<
String
,
Object
>
orderResultPar
=
new
HashMap
<>();
orderResultPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
...
...
@@ -797,4 +799,102 @@ public class SecondKill implements Authorization {
Assert
.
fail
(
network
.
message
(
orderResultPar
,
BasicConfig
.
MOBILE_secondKill_goodsOrderResult
,
"获取数据失败"
,
orderResultRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"上架需要秒杀资格的商品"
,
priority
=
35
)
public
void
上架需要秒杀资格的商品
(){
adminAuth
();
Map
<
String
,
Object
>
goodsOnPar
=
new
HashMap
<>();
goodsOnPar
.
put
(
"id"
,
ConfSecondKill
.
QualifiedId
);
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
=
"推送秒杀资格券"
,
priority
=
36
)
public
void
推送秒杀资格券
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
ConfSecondKill
.
QualifiedId
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
ANCHOR_sendQualification
);
Boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
ANCHOR_sendQualification
,
"助播端推送秒杀资格失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取秒杀资格商品列表"
,
priority
=
37
)
public
void
获取秒杀资格商品列表
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
ANCHOR_secondKillLists
);
int
pushCount
=
response
.
jsonPath
().
getInt
(
"data.get(0).pushCount"
);
Assert
.
assertEquals
(
pushCount
,
1
,
network
.
message
(
params
,
BasicConfig
.
ANCHOR_secondKillLists
,
"推送次数记录失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客H领取秒杀资格"
,
priority
=
38
)
public
void
访客
H
领取秒杀资格
(){
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
ConfSecondKill
.
QualifiedId
);
Response
requireRes
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_qualification
);
boolean
data
=
requireRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_qualification
,
"访客H领取秒杀资格失败"
,
requireRes
.
body
().
asString
()));
timestamp
=
requireRes
.
jsonPath
().
getJsonObject
(
"timestamp"
);
}
@Test
(
description
=
"访客H分享直播间"
,
priority
=
39
)
public
void
访客
H
分享直播间
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"shareType"
,
1
);
Response
signRes
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_sign
);
String
data
=
signRes
.
jsonPath
().
getString
(
"data"
);
shareSign
=
data
;
Assert
.
assertNotNull
(
shareSign
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_sign
,
"分享失败"
,
signRes
.
body
().
asString
()));
}
@Test
(
description
=
"查询访客H的秒杀商品助力信息"
,
priority
=
40
)
public
void
查询访客
H
的秒杀商品助力信息
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_receiveStatus
);
int
qualificationStatus
=
response
.
jsonPath
().
getInt
(
"data.get(0).qualificationStatus"
);
Assert
.
assertTrue
(
qualificationStatus
==
1
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_receiveStatus
,
"访客秒杀资格状态记录错误"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客H完成助力"
,
priority
=
41
)
public
void
访客
H
完成助力
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
visitorAuth27
();
//访客X
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"shareSign"
,
shareSign
);
params
.
put
(
"shareType"
,
16
);
params
.
put
(
"confId"
,
ConfSecondKill
.
QualifiedId
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_assist
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_assist
,
"用户W给用户H助力失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查看秒杀资格商品详情"
,
priority
=
42
)
public
void
查看秒杀资格商品详情
()
{
visitorAuth9
();
Map
<
String
,
Object
>
goodsDetailPar
=
new
HashMap
<>();
goodsDetailPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
goodsDetailPar
.
put
(
"confId"
,
ConfSecondKill
.
QualifiedId
);
Response
goodsDetailRes
=
network
.
getResponse
(
goodsDetailPar
,
BasicConfig
.
MOBILE_secondKill_getGoodsDetail
);
int
qualificationStatus
=
goodsDetailRes
.
jsonPath
().
getInt
(
"data.qualificationStatus"
);
Assert
.
assertEquals
(
qualificationStatus
,
2
,
network
.
message
(
goodsDetailPar
,
BasicConfig
.
MOBILE_secondKill_getGoodsDetail
,
"秒杀资格商品状态记录错误"
,
goodsDetailRes
.
body
().
asString
()));
}
@Test
(
description
=
"查看秒杀商品列表"
,
priority
=
43
)
public
void
查看秒杀商品列表
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_secondKill_getGoodsList
);
Object
infallibleConfig
=
response
.
jsonPath
().
getJsonObject
(
"data.get(0).infallibleConfig"
);
Object
cardConfigOne
=
response
.
jsonPath
().
getJsonObject
(
"data.get(0).cardConfigOne"
);
Object
cardConfigTwo
=
response
.
jsonPath
().
getJsonObject
(
"data.get(0).cardConfigTwo"
);
Assert
.
assertNotNull
(
infallibleConfig
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_secondKill_getGoodsList
,
"秒杀资格商品信息获取失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
cardConfigOne
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_secondKill_getGoodsList
,
"配图1商品信息获取失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
cardConfigTwo
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_secondKill_getGoodsList
,
"配图2商品信息获取失败"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/config/BasicConfig.java
View file @
54c98c23
...
...
@@ -159,7 +159,9 @@ public class BasicConfig {
public
static
final
String
ANCHOR_secondKillLists_goodsImg
=
MOBILE_HOST
+
"/kjy/live/second/kill/pre/goodsImg"
;
public
static
final
String
ANCHOR_secondKillLists_goodsList
=
MOBILE_HOST
+
"/kjy/live/second/kill/pre/goodsList"
;
public
static
final
String
ANCHOR_secondKillLists_remind
=
MOBILE_HOST
+
"/kjy/live/second/kill/pre/remind"
;
public
static
final
String
ANCHOR_sendQualification
=
MOBILE_HOST
+
"/conf/live/second/kill/goods/sendQualification"
;
public
static
final
String
MOBILE_qualification
=
MOBILE_HOST
+
"/clue/goods/receive/qualification"
;
public
static
final
String
MOBILE_receiveStatus
=
MOBILE_HOST
+
"/clue/goods/receive/status"
;
//客户承诺话术配置
public
static
final
String
MANAGER_saveDialogue
=
MANAGER_HOST
+
"/kjy/manager/live/potential/saveDialogue"
;
public
static
final
String
MANAGER_findDialogue
=
MANAGER_HOST
+
"/kjy/manager/live/potential/findDialogue"
;
...
...
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