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
a4f73e9c
Commit
a4f73e9c
authored
Feb 22, 2022
by
龚小红
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加代理人赠送秒杀代金券的接口用例
parent
a50df135
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
915 additions
and
84 deletions
+915
-84
Test.xml
src/test/Test.xml
+5
-28
AgentBean.java
src/test/java/com/kjj/bean/agent/AgentBean.java
+1
-0
WhoSawMe.java
src/test/java/com/kjj/cases/assistant/whoSawMe/WhoSawMe.java
+2
-2
Agent.java
src/test/java/com/kjj/cases/live/agent/Agent.java
+1
-0
SimpleLive.java
src/test/java/com/kjj/cases/live/liveConfig/SimpleLive.java
+172
-0
ConfSecondKill.java
...st/java/com/kjj/cases/live/secondKill/ConfSecondKill.java
+15
-1
SecondKill.java
src/test/java/com/kjj/cases/live/secondKill/SecondKill.java
+19
-52
Voucher.java
src/test/java/com/kjj/cases/live/secondKill/Voucher.java
+532
-0
VoucherConf.java
src/test/java/com/kjj/cases/live/secondKill/VoucherConf.java
+138
-0
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+11
-0
BaseUtils.java
src/test/java/com/kjj/utils/BaseUtils.java
+1
-1
liveTestNG.xml
src/test/liveTestNG.xml
+18
-0
No files found.
src/test/Test.xml
View file @
a4f73e9c
...
@@ -6,44 +6,21 @@
...
@@ -6,44 +6,21 @@
<test
preserve-order=
"true"
name=
"创建直播"
>
<test
preserve-order=
"true"
name=
"创建直播"
>
<classes>
<classes>
<class
name=
"com.kjj.cases.live.liveConfig.S
av
eLive"
/>
<class
name=
"com.kjj.cases.live.liveConfig.S
impl
eLive"
/>
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name=
"配置
秒杀轮次及秒杀预告
"
>
<test
preserve-order=
"true"
name=
"配置
代理人赠送秒杀优惠券
"
>
<classes>
<classes>
<class
name=
"com.kjj.cases.live.secondKill.
ConfSecondKill
"
/>
<class
name=
"com.kjj.cases.live.secondKill.
VoucherConf
"
/>
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name=
"
绑定关系绑定
"
>
<test
preserve-order=
"true"
name=
"
代理人赠送秒杀优惠券并用户使用代金券
"
>
<classes>
<classes>
<class
name=
"com.kjj.cases.live.
liveConfig.LiveBinding
"
/>
<class
name=
"com.kjj.cases.live.
secondKill.Voucher
"
/>
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name=
"助播-开启直播"
>
<classes>
<class
name=
"com.kjj.cases.live.anchor.OpenLive"
/>
</classes>
</test>
<!-- 仅用于自测-->
<test
preserve-order=
"true"
name=
"秒杀到场"
>
<classes>
<class
name=
"com.kjj.cases.live.liveConfig.ConnectLive"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"秒杀互动"
>
<classes>
<class
name=
"com.kjj.cases.live.secondKill.SecondKill"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"助播-结束直播"
>
<classes>
<class
name=
"com.kjj.cases.live.anchor.CloseLive"
/>
</classes>
</test>
</suite>
</suite>
src/test/java/com/kjj/bean/agent/AgentBean.java
View file @
a4f73e9c
...
@@ -23,4 +23,5 @@ public class AgentBean {
...
@@ -23,4 +23,5 @@ public class AgentBean {
private
int
inviteAuthStatus
;
private
int
inviteAuthStatus
;
private
int
agentAwardOpenFlag
;
// 是否开启代理人邀约奖励
private
int
agentAwardOpenFlag
;
// 是否开启代理人邀约奖励
private
int
agentNeedInviteNum
;
// 还需邀请多少人才能开启红包
private
int
agentNeedInviteNum
;
// 还需邀请多少人才能开启红包
private
boolean
agentVoucherHasOpen
;
//代理人赠送优惠券开关
}
}
src/test/java/com/kjj/cases/assistant/whoSawMe/WhoSawMe.java
View file @
a4f73e9c
...
@@ -145,8 +145,8 @@ public class WhoSawMe implements Authorization {
...
@@ -145,8 +145,8 @@ public class WhoSawMe implements Authorization {
Assert
.
assertTrue
(
success
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"接口请求失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
success
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"接口请求失败"
,
response
.
body
().
asString
()));
int
todayClueNum
=
response
.
jsonPath
().
getInt
(
"data.todayClueNum"
);
int
todayClueNum
=
response
.
jsonPath
().
getInt
(
"data.todayClueNum"
);
int
todayVisitNum
=
response
.
jsonPath
().
getInt
(
"data.todayVisitNum"
);
int
todayVisitNum
=
response
.
jsonPath
().
getInt
(
"data.todayVisitNum"
);
Assert
.
assertTrue
(
todayClueNum
==
1
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取今日线索数有误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
todayClueNum
==
3
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取今日线索数有误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
todayVisitNum
==
1
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取今日访问数有误"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
todayVisitNum
==
2
,
network
.
message
(
BasicConfig
.
VISITHEADER
,
"获取今日访问数有误"
,
response
.
body
().
asString
()));
}
}
// 查看谁看过我首页我的访客列表
// 查看谁看过我首页我的访客列表
...
...
src/test/java/com/kjj/cases/live/agent/Agent.java
View file @
a4f73e9c
...
@@ -127,6 +127,7 @@ public class Agent implements Authorization {
...
@@ -127,6 +127,7 @@ public class Agent implements Authorization {
Assert
.
assertNotNull
(
item
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_Procurator
,
"查询直播列表失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
item
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_Procurator
,
"查询直播列表失败"
,
response
.
body
().
asString
()));
// 判断代理人邀约奖励openFlag是否为开
// 判断代理人邀约奖励openFlag是否为开
Assert
.
assertEquals
(
item
.
getAgentAwardOpenFlag
(),
1
,
network
.
message
(
params
,
MOBILE_Procurator
,
"代理人邀约奖励开启状态错误"
,
response
.
body
().
asString
()));
Assert
.
assertEquals
(
item
.
getAgentAwardOpenFlag
(),
1
,
network
.
message
(
params
,
MOBILE_Procurator
,
"代理人邀约奖励开启状态错误"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
item
.
isAgentVoucherHasOpen
(),
network
.
message
(
params
,
MOBILE_Procurator
,
"代理人邀约奖励开启状态错误"
,
response
.
body
().
asString
()));
break
;
break
;
}
}
}
}
...
...
src/test/java/com/kjj/cases/live/liveConfig/SimpleLive.java
0 → 100644
View file @
a4f73e9c
package
com
.
kjj
.
cases
.
live
.
liveConfig
;
import
com.alibaba.fastjson.JSON
;
import
com.kjj.bean.answer.AddReward
;
import
com.kjj.bean.answer.AddWelfareConf
;
import
com.kjj.bean.answer.RewardList
;
import
com.kjj.bean.issue.Dialogue
;
import
com.kjj.bean.lottery.ConfIdList
;
import
com.kjj.bean.manager.*
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.constants.LiveConstants
;
import
com.kjj.utils.IdMakeUtil
;
import
com.kjj.utils.JsonUtil
;
import
com.kjj.utils.ThreadSleepUtils
;
import
io.restassured.response.Response
;
import
org.apache.commons.lang3.RandomUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.util.*
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
ssoLogin
;
public
class
SimpleLive
implements
Authorization
{
public
String
liveID
;
public
String
EncodeLiveID
;
public
long
welfareConfId
;
private
Integer
taskId
;
public
List
<
RedList
>
redId
;
public
List
<
WelfareList
>
id
;
//奖品列表id
private
int
confID
;
// 默认抽奖券配置ID
@BeforeClass
public
void
setUp
()
{
ssoLogin
();
}
/**
* 创建直播
*/
@Test
(
description
=
"创建直播"
,
priority
=
1
)
public
void
创建直播
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"posterUrl"
,
"https://streamimg.kjjcrm.com/kjy/image/20210201/e36cb31828e14a3ebb9d01e6be79ad66.jpg"
);
Params
.
put
(
"videoUrl"
,
"http://streamimg.kjjcrm.com/kjy/image/20210201/1612171657348.mp4"
);
Params
.
put
(
"welfareUrl"
,
"https://streamimg.kjjcrm.com/kjy/image/20210201/62c25dcb3b9b4d269a74894e4255a193.jpg"
);
Params
.
put
(
"coverUrl"
,
"https://streamimg.kjjcrm.com/kjy/image/20210201/d4093b24aaca49da8f0e3e276721feea.jpg"
);
Params
.
put
(
"mpShareUrl"
,
"https://streamimg.kjjcrm.com/kjy/image/20210201/182f3659e39b4ea6898af781cc6344a1.jpg"
);
Params
.
put
(
"title"
,
"直播测试"
+
RandomUtils
.
nextInt
(
1
,
100
));
Params
.
put
(
"mpShareTitle"
,
"自动化直播"
);
Params
.
put
(
"companyId"
,
101
);
//公司
Params
.
put
(
"agentInviteAuthType"
,
1
);
Params
.
put
(
"agentInviteAuthLimitNum"
,
1
);
long
noticeTime
=
DateUtils
.
addHours
(
new
Date
(),
2
).
getTime
();
long
broadcastTime
=
DateUtils
.
addHours
(
new
Date
(),
5
).
getTime
();
Params
.
put
(
"noticeTime"
,
noticeTime
);
Params
.
put
(
"broadcastTime"
,
broadcastTime
);
Params
.
put
(
"shareContent"
,
"自动化直播 #{shortLink}"
);
Params
.
put
(
"shelfStatus"
,
2
);
Params
.
put
(
"secondPoster"
,
"https://streamimg.kjjcrm.com/kjy/image/20210201/cc999ebde48e49f99ac3f0d93480453f.jpg"
);
Params
.
put
(
"regionType"
,
1
);
Params
.
put
(
"preAwardUrl"
,
"https://yun.dui88.com/kjy/image/20210629/1624949155842.png"
);
Params
.
put
(
"preWindowUrl"
,
"https://yun.dui88.com/kjy/image/20210629/1624949098093.png"
);
Params
.
put
(
"distributionType"
,
1
);
//奖品分发方式0-代理人领奖1-快递寄送
Params
.
put
(
"existSeriesPoster"
,
0
);
Params
.
put
(
"followPushState"
,
0
);
// 关注直播间用户是否推送开关,0 = false
List
<
ProvinceCityCodeList
>
provinceCityCode
=
new
ArrayList
<>();
Params
.
put
(
"provinceCityCodeList"
,
provinceCityCode
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_saveAndUpdate_0
);
liveID
=
response
.
jsonPath
().
getString
(
"data"
);
EncodeLiveID
=
IdMakeUtil
.
encodingId
(
Long
.
valueOf
(
liveID
));
System
.
out
.
println
(
liveID
);
LiveConstants
.
setValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
(),
liveID
);
LiveConstants
.
setValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
(),
EncodeLiveID
);
Assert
.
assertNotNull
(
liveID
,
network
.
message
(
Params
,
BasicConfig
.
MANAGER_saveAndUpdate_0
,
"新增直播失败"
,
response
.
body
().
asString
()));
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
());
}
/**
* 基础配置
*/
@Test
(
description
=
"查询直播配置"
,
priority
=
2
)
public
void
查询直播配置
()
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
liveID
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MANAGER_getConfDetail
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_getConfDetail
,
"查询配置失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"单场红包配置"
,
priority
=
3
)
public
void
单场红包配置
()
{
//单场红包限额
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"liveId"
,
liveID
);
Params
.
put
(
"maxAmount"
,
100000
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_MaxAmount
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
Params
,
BasicConfig
.
MANAGER_MaxAmount
,
"单场红包限额配置失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"展示红包金额"
,
priority
=
4
)
public
void
展示红包金额
()
{
//展示红包金额
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"liveId"
,
liveID
);
Params
.
put
(
"showAmount"
,
100000
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_ShowAmount
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
Params
,
BasicConfig
.
MANAGER_ShowAmount
,
"展示红包配置失败"
,
response
.
body
().
asString
()));
}
/**
* 直播中奖品
*/
//直播中奖品配置
@Test
(
description
=
"直播中抽奖"
,
priority
=
9
)
public
void
直播中抽奖
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"liveId"
,
liveID
);
Params
.
put
(
"interactNum"
,
1
);
Params
.
put
(
"showInteractNum"
,
1
);
Params
.
put
(
"welfareId"
,
191
);
Params
.
put
(
"afterMin"
,
20
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_add_1
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
Params
,
BasicConfig
.
MANAGER_add_1
,
"直播中抽奖配置失败"
,
response
.
body
().
asString
()));
Params
.
clear
();
Params
.
put
(
"liveId"
,
liveID
);
Params
.
put
(
"interactNum"
,
100
);
Params
.
put
(
"showInteractNum"
,
100
);
Params
.
put
(
"welfareId"
,
192
);
Params
.
put
(
"afterMin"
,
30
);
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_add_1
);
boolean
data1
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data1
);
Assert
.
assertTrue
(
data1
,
network
.
message
(
Params
,
BasicConfig
.
MANAGER_add_1
,
"直播中抽奖配置失败"
,
response
.
body
().
asString
()));
Params
.
clear
();
Params
.
put
(
"liveId"
,
liveID
);
Params
.
put
(
"interactNum"
,
100
);
Params
.
put
(
"showInteractNum"
,
100
);
Params
.
put
(
"welfareId"
,
193
);
Params
.
put
(
"afterMin"
,
35
);
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_add_1
);
boolean
data2
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data2
);
Assert
.
assertTrue
(
data2
,
network
.
message
(
Params
,
BasicConfig
.
MANAGER_add_1
,
"直播中抽奖配置失败"
,
response
.
body
().
asString
()));
Params
.
clear
();
Params
.
put
(
"liveId"
,
liveID
);
Params
.
put
(
"interactNum"
,
2
);
Params
.
put
(
"showInteractNum"
,
2
);
Params
.
put
(
"welfareId"
,
194
);
Params
.
put
(
"afterMin"
,
40
);
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_add_1
);
boolean
data3
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data3
);
Assert
.
assertTrue
(
data3
,
network
.
message
(
Params
,
BasicConfig
.
MANAGER_add_1
,
"直播中抽奖配置失败"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/live/secondKill/ConfSecondKill.java
View file @
a4f73e9c
...
@@ -587,7 +587,7 @@ public class ConfSecondKill implements Authorization {
...
@@ -587,7 +587,7 @@ public class ConfSecondKill implements Authorization {
long
resourceConfId
=
response
.
jsonPath
().
getLong
(
"data.resourceConfId"
);
long
resourceConfId
=
response
.
jsonPath
().
getLong
(
"data.resourceConfId"
);
Assert
.
assertNotNull
(
resourceConfId
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_killGoodsDetail
,
"查看看秒杀优惠券商品详情失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
resourceConfId
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_killGoodsDetail
,
"查看看秒杀优惠券商品详情失败"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"助播端获取秒杀优惠券轮次"
,
priority
=
3
2
)
@Test
(
description
=
"助播端获取秒杀优惠券轮次"
,
priority
=
3
1
)
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
()));
...
@@ -604,4 +604,18 @@ public class ConfSecondKill implements Authorization {
...
@@ -604,4 +604,18 @@ public class ConfSecondKill implements Authorization {
Assert
.
fail
(
network
.
message
(
liveSecKillPar
,
BasicConfig
.
ANCHOR_secondKillLists
,
"未获取到数据"
,
liveSecKillRes
.
body
().
asString
()));
Assert
.
fail
(
network
.
message
(
liveSecKillPar
,
BasicConfig
.
ANCHOR_secondKillLists
,
"未获取到数据"
,
liveSecKillRes
.
body
().
asString
()));
}
}
}
}
@Test
(
description
=
"保存代理人赠送优惠券配置"
,
priority
=
32
)
public
void
保存代理人赠送优惠券配置
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
());
params
.
put
(
"voucherPrice"
,
1
);
params
.
put
(
"effectiveScope"
,
1
);
params
.
put
(
"totalCount"
,
10
);
params
.
put
(
"invitationNumPerVoucher"
,
1
);
params
.
put
(
"maxCountPerAgent"
,
1
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_voucherSave
);
boolean
succcess
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertFalse
(
succcess
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_voucherSave
,
"高级玩法下可配置代理人赠送优惠券"
,
response
.
body
().
asString
()));
}
}
}
src/test/java/com/kjj/cases/live/secondKill/SecondKill.java
View file @
a4f73e9c
...
@@ -44,6 +44,20 @@ public class SecondKill implements Authorization {
...
@@ -44,6 +44,20 @@ public class SecondKill implements Authorization {
connectSuccess
();
connectSuccess
();
}
}
public
static
void
killOn
(
String
killId
){
Map
<
String
,
Object
>
goodsOnPar
=
new
HashMap
<>();
goodsOnPar
.
put
(
"id"
,
killId
);
Response
goodsOnRes
=
network
.
postResponse
(
goodsOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
);
System
.
out
.
println
(
goodsOnRes
.
body
().
asString
());
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
()));
}
}
/**
/**
* 直播中编辑秒杀轮次
* 直播中编辑秒杀轮次
*/
*/
...
@@ -163,17 +177,7 @@ public class SecondKill implements Authorization {
...
@@ -163,17 +177,7 @@ public class SecondKill implements Authorization {
@Test
(
description
=
"助播端上架秒杀"
,
priority
=
10
)
@Test
(
description
=
"助播端上架秒杀"
,
priority
=
10
)
public
void
助播端上架秒杀
()
{
public
void
助播端上架秒杀
()
{
adminAuth
();
adminAuth
();
Map
<
String
,
Object
>
goodsOnPar
=
new
HashMap
<>();
killOn
(
ConfSecondKill
.
skIdFirst
);
goodsOnPar
.
put
(
"id"
,
ConfSecondKill
.
skIdFirst
);
Response
goodsOnRes
=
network
.
postResponse
(
goodsOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
);
System
.
out
.
println
(
goodsOnRes
.
body
().
asString
());
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
()));
}
// 检查秒杀状态
// 检查秒杀状态
Map
<
String
,
Object
>
goodsStatusPar
=
new
HashMap
<>();
Map
<
String
,
Object
>
goodsStatusPar
=
new
HashMap
<>();
...
@@ -192,17 +196,7 @@ public class SecondKill implements Authorization {
...
@@ -192,17 +196,7 @@ public class SecondKill implements Authorization {
@Test
(
description
=
"同时上架0秒杀商品"
,
priority
=
11
)
@Test
(
description
=
"同时上架0秒杀商品"
,
priority
=
11
)
public
void
同时上架
0
秒杀商品
()
{
public
void
同时上架
0
秒杀商品
()
{
adminAuth
();
adminAuth
();
Map
<
String
,
Object
>
goodsOnPar
=
new
HashMap
<>();
killOn
(
ConfSecondKill
.
skIdThird
);
goodsOnPar
.
put
(
"id"
,
ConfSecondKill
.
skIdThird
);
Response
goodsOnRes
=
network
.
postResponse
(
goodsOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
);
System
.
out
.
println
(
goodsOnRes
.
body
().
asString
());
try
{
boolean
data
=
goodsOnRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
goodsOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
,
"上架0元商品秒杀失败"
,
goodsOnRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
goodsOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
,
"未获取到数据"
,
goodsOnRes
.
body
().
asString
()));
}
}
}
// 切换访客
// 切换访客
...
@@ -585,16 +579,7 @@ public class SecondKill implements Authorization {
...
@@ -585,16 +579,7 @@ public class SecondKill implements Authorization {
@Test
(
description
=
"上架第二轮秒杀,代理人可参与"
,
priority
=
28
)
@Test
(
description
=
"上架第二轮秒杀,代理人可参与"
,
priority
=
28
)
public
void
上架第二轮秒杀
()
{
public
void
上架第二轮秒杀
()
{
Map
<
String
,
Object
>
skOnPar
=
new
HashMap
<>();
killOn
(
ConfSecondKill
.
skIdSecond
);
skOnPar
.
put
(
"id"
,
ConfSecondKill
.
skIdSecond
);
Response
goodsOnRes
=
network
.
postResponse
(
skOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
);
try
{
boolean
data
=
goodsOnRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
skOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
,
"上架秒杀失败"
,
goodsOnRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
skOnPar
,
BasicConfig
.
ANCHOR_secondKillOn
,
"未获取到数据"
,
goodsOnRes
.
body
().
asString
()));
}
}
}
@Test
(
description
=
"代理人成功下单-占用库存"
,
priority
=
29
)
@Test
(
description
=
"代理人成功下单-占用库存"
,
priority
=
29
)
...
@@ -809,16 +794,7 @@ public class SecondKill implements Authorization {
...
@@ -809,16 +794,7 @@ public class SecondKill implements Authorization {
@Test
(
description
=
"上架需要秒杀资格的商品"
,
priority
=
36
)
@Test
(
description
=
"上架需要秒杀资格的商品"
,
priority
=
36
)
public
void
上架需要秒杀资格的商品
(){
public
void
上架需要秒杀资格的商品
(){
adminAuth
();
adminAuth
();
Map
<
String
,
Object
>
goodsOnPar
=
new
HashMap
<>();
killOn
(
ConfSecondKill
.
QualifiedId
);
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
=
37
)
@Test
(
description
=
"推送秒杀资格券"
,
priority
=
37
)
public
void
推送秒杀资格券
(){
public
void
推送秒杀资格券
(){
...
@@ -1128,16 +1104,7 @@ public class SecondKill implements Authorization {
...
@@ -1128,16 +1104,7 @@ public class SecondKill implements Authorization {
@Test
(
description
=
"上架秒杀优惠券商品"
,
priority
=
54
)
@Test
(
description
=
"上架秒杀优惠券商品"
,
priority
=
54
)
public
void
上架秒杀优惠券商品
(){
public
void
上架秒杀优惠券商品
(){
adminAuth
();
adminAuth
();
Map
<
String
,
Object
>
goodsOnPar
=
new
HashMap
<>();
killOn
(
ConfSecondKill
.
couponId
);
goodsOnPar
.
put
(
"id"
,
ConfSecondKill
.
couponId
);
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
=
55
)
@Test
(
description
=
"下单秒杀优惠券商品"
,
priority
=
55
)
...
...
src/test/java/com/kjj/cases/live/secondKill/Voucher.java
0 → 100644
View file @
a4f73e9c
This diff is collapsed.
Click to expand it.
src/test/java/com/kjj/cases/live/secondKill/VoucherConf.java
0 → 100644
View file @
a4f73e9c
package
com
.
kjj
.
cases
.
live
.
secondKill
;
import
com.kjj.bean.secondKill.AnchorGetSKList
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.constants.LiveConstants
;
import
com.kjj.utils.JsonUtil
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
VoucherConf
implements
Authorization
{
private
static
final
long
secKillGoodsId
=
115
;
// 用来配置轮次的秒杀商品ID
private
long
voucherConfId
;
public
static
String
skIdFirst
;
// 第一轮秒杀id
public
static
String
skIdSecond
;
// 第二轮秒杀ID
@Test
(
description
=
"添加秒杀互动"
,
priority
=
1
)
public
void
添加秒杀互动
()
{
Map
<
String
,
Object
>
secKillAddPar
=
new
HashMap
<>();
secKillAddPar
.
put
(
"goodsId"
,
secKillGoodsId
);
secKillAddPar
.
put
(
"goodsAmount"
,
2
);
// 1 == 0.01
secKillAddPar
.
put
(
"interactNum"
,
3
);
secKillAddPar
.
put
(
"ableAgent"
,
0
);
// 代理人不可参与
secKillAddPar
.
put
(
"isNeedQualified"
,
0
);
// 不需要秒杀资格
secKillAddPar
.
put
(
"playType"
,
0
);
//高级玩法配置,0为不配置,1为秒杀资格,2为秒杀优惠券
secKillAddPar
.
put
(
"afterPrice"
,
""
);
secKillAddPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
secKillAddRes
=
network
.
postResponse
(
secKillAddPar
,
BasicConfig
.
MANAGER_secondKillSave
);
boolean
data
=
secKillAddRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
secKillAddPar
,
BasicConfig
.
MANAGER_secondKillSave
,
"添加秒杀互动失败"
,
secKillAddRes
.
body
().
asString
()));
secKillAddPar
.
put
(
"goodsAmount"
,
3
);
secKillAddRes
=
network
.
postResponse
(
secKillAddPar
,
BasicConfig
.
MANAGER_secondKillSave
);
data
=
secKillAddRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
secKillAddPar
,
BasicConfig
.
MANAGER_secondKillSave
,
"添加秒杀互动失败"
,
secKillAddRes
.
body
().
asString
()));
}
@Test
(
description
=
"保存代理人赠送优惠券配置"
,
priority
=
2
)
public
void
保存代理人赠送优惠券配置
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
params
.
put
(
"voucherPrice"
,
1
);
params
.
put
(
"effectiveScope"
,
1
);
params
.
put
(
"totalCount"
,
2
);
params
.
put
(
"invitationNumPerVoucher"
,
1
);
params
.
put
(
"maxCountPerAgent"
,
1
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_voucherSave
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_voucherSave
,
"配置代理人赠送优惠券失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询代理人赠送优惠券配置"
,
priority
=
3
)
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_voucherDetail
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_voucherDetail
,
"查询代理人赠送优惠券失败"
,
response
.
body
().
asString
()));
Assert
.
assertNotNull
(
response
.
jsonPath
().
getJsonObject
(
"data"
),
network
.
message
(
params
,
BasicConfig
.
MANAGER_voucherDetail
,
"代理人赠送优惠券配置为空"
,
response
.
body
().
asString
()));
voucherConfId
=
response
.
jsonPath
().
getLong
(
"data.id"
);
}
@Test
(
description
=
"减少优惠券总数失败"
,
priority
=
3
)
public
void
减少优惠券总数失败
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
params
.
put
(
"id"
,
voucherConfId
);
params
.
put
(
"voucherPrice"
,
1
);
params
.
put
(
"effectiveScope"
,
1
);
params
.
put
(
"totalCount"
,
1
);
params
.
put
(
"invitationNumPerVoucher"
,
1
);
params
.
put
(
"maxCountPerAgent"
,
1
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_voucherSave
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertFalse
(
success
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_voucherSave
,
"减少优惠券总数成功"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"修改代理人赠送优惠券配置"
,
priority
=
4
)
public
void
修改代理人赠送优惠券配置
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
params
.
put
(
"id"
,
voucherConfId
);
params
.
put
(
"voucherPrice"
,
2
);
params
.
put
(
"effectiveScope"
,
1
);
params
.
put
(
"totalCount"
,
3
);
params
.
put
(
"invitationNumPerVoucher"
,
2
);
params
.
put
(
"maxCountPerAgent"
,
2
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_voucherSave
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_voucherSave
,
"修改代理人赠送优惠券配置失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"开启代理人赠送优惠券配置"
,
priority
=
6
)
public
void
开启代理人赠送优惠券配置
(){
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
params
.
put
(
"open"
,
false
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_voucherModifyState
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_voucherModifyState
,
"关闭代理人赠送优惠券配置失败"
,
response
.
body
().
asString
()));
params
.
put
(
"open"
,
true
);
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MANAGER_voucherModifyState
);
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_voucherModifyState
,
"开启代理人赠送优惠券配置失败"
,
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_voucherState
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_voucherState
,
"代理人赠送优惠券配置未开启"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"助播端获取秒杀轮次列表"
,
priority
=
8
)
public
void
助播端获取秒杀轮次列表
()
{
adminAuth
();
Map
<
String
,
Object
>
liveSecKillPar
=
new
HashMap
<>();
liveSecKillPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
liveSecKillRes
=
network
.
getResponse
(
liveSecKillPar
,
BasicConfig
.
ANCHOR_secondKillLists
);
List
<
AnchorGetSKList
>
secKillLists
;
secKillLists
=
JsonUtil
.
parseResponseToListBean
(
liveSecKillRes
,
AnchorGetSKList
.
class
);
skIdFirst
=
secKillLists
.
get
(
0
).
getId
();
skIdSecond
=
secKillLists
.
get
(
1
).
getId
();
}
}
src/test/java/com/kjj/config/BasicConfig.java
View file @
a4f73e9c
...
@@ -193,6 +193,17 @@ public class BasicConfig {
...
@@ -193,6 +193,17 @@ public class BasicConfig {
public
static
final
String
MANAGER_killGoodsDetail
=
MANAGER_HOST
+
"/kjy/manager/live/second/kill/goods/detail"
;
public
static
final
String
MANAGER_killGoodsDetail
=
MANAGER_HOST
+
"/kjy/manager/live/second/kill/goods/detail"
;
public
static
final
String
MOBILE_couponsList
=
MOBILE_HOST
+
"/clue/goods/coupons/list"
;
public
static
final
String
MOBILE_couponsList
=
MOBILE_HOST
+
"/clue/goods/coupons/list"
;
public
static
final
String
MOBILE_couponsReceive
=
MOBILE_HOST
+
"/clue/goods/coupons/receive"
;
public
static
final
String
MOBILE_couponsReceive
=
MOBILE_HOST
+
"/clue/goods/coupons/receive"
;
public
static
final
String
MANAGER_voucherSave
=
MANAGER_HOST
+
"/kjy/manager/live/voucher/save"
;
public
static
final
String
MANAGER_voucherDetail
=
MANAGER_HOST
+
"/kjy/manager/live/voucher/detail"
;
public
static
final
String
MANAGER_voucherModifyState
=
MANAGER_HOST
+
"/kjy/manager/live/voucher/modifyState"
;
public
static
final
String
MANAGER_voucherState
=
MANAGER_HOST
+
"/kjy/manager/live/voucher/state"
;
public
static
final
String
MOBILE_voucherDetail
=
MOBILE_HOST
+
"/kjy/live/voucher/detail"
;
public
static
final
String
MOBILE_voucherJoinInfo
=
MOBILE_HOST
+
"/kjy/live/voucher/agent/joinInfo"
;
public
static
final
String
MOBILE_voucherGiftList
=
MOBILE_HOST
+
"/kjy/live/voucher/agent/giftList"
;
public
static
final
String
MOBILE_agentSelectList
=
MOBILE_HOST
+
"/kjy/live/voucher/agent/selectList"
;
public
static
final
String
MOBILE_agentGift
=
MOBILE_HOST
+
"/kjy/live/voucher/agent/gift"
;
public
static
final
String
MOBILE_acceptGift
=
MOBILE_HOST
+
"/clue/goods/voucher/accept"
;
public
static
final
String
MOBILE_voucherList
=
MOBILE_HOST
+
"/clue/goods/voucher/list"
;
//客户承诺话术配置
//客户承诺话术配置
public
static
final
String
MANAGER_saveDialogue
=
MANAGER_HOST
+
"/kjy/manager/live/potential/saveDialogue"
;
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"
;
public
static
final
String
MANAGER_findDialogue
=
MANAGER_HOST
+
"/kjy/manager/live/potential/findDialogue"
;
...
...
src/test/java/com/kjj/utils/BaseUtils.java
View file @
a4f73e9c
...
@@ -203,7 +203,7 @@ public class BaseUtils {
...
@@ -203,7 +203,7 @@ public class BaseUtils {
}
}
/*
/*
* 访客到场
* 访客到场
(仅直播开始后才可调用)
* */
* */
public
static
void
connectSuccess
()
{
public
static
void
connectSuccess
()
{
Map
<
String
,
Object
>
connectSuccessParam
=
new
HashMap
<>();
Map
<
String
,
Object
>
connectSuccessParam
=
new
HashMap
<>();
...
...
src/test/liveTestNG.xml
View file @
a4f73e9c
...
@@ -273,5 +273,23 @@
...
@@ -273,5 +273,23 @@
<class
name=
"com.kjj.cases.live.customer.PersonalPage"
/>
<class
name=
"com.kjj.cases.live.customer.PersonalPage"
/>
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name=
"创建简易直播"
>
<classes>
<class
name=
"com.kjj.cases.live.liveConfig.SimpleLive"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"配置代理人赠送秒杀优惠券"
>
<classes>
<class
name=
"com.kjj.cases.live.secondKill.VoucherConf"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"代理人赠送秒杀优惠券并用户使用代金券"
>
<classes>
<class
name=
"com.kjj.cases.live.secondKill.Voucher"
/>
</classes>
</test>
</suite>
</suite>
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