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
e3161dbe
Commit
e3161dbe
authored
Apr 28, 2021
by
张艳玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
奖品签收
parent
7b95cd47
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
387 additions
and
118 deletions
+387
-118
QuestionList.java
src/test/java/com/kjj/bean/answer/QuestionList.java
+18
-0
Add.java
src/test/java/com/kjj/cases/live/manager/QuesReward/Add.java
+1
-1
Limited.java
src/test/java/com/kjj/cases/live/red/Limited.java
+243
-79
QuestionAwards.java
src/test/java/com/kjj/cases/live/red/QuestionAwards.java
+0
-1
Unlimited.java
src/test/java/com/kjj/cases/live/red/Unlimited.java
+123
-30
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+2
-2
liveTestNG.xml
src/test/liveTestNG.xml
+0
-5
No files found.
src/test/java/com/kjj/bean/answer/QuestionList.java
0 → 100644
View file @
e3161dbe
package
com
.
kjj
.
bean
.
answer
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
QuestionList
{
public
List
<
QuestionList
.
question
>
list
;
@Data
public
static
class
question
{
private
String
id
;
private
int
optionType
;
private
String
optionDetail
;
}
}
src/test/java/com/kjj/cases/live/manager/QuesReward/Add.java
View file @
e3161dbe
...
...
@@ -157,7 +157,7 @@ public class Add implements AdminAuthorization {
AnswerBean
Answer_1
=
new
AnswerBean
();
Answer_1
.
setOptionDetail
(
"错误"
);
Answer_1
.
setOptionType
(
2
);
Answers
.
add
(
Answer_1
);
Answers
1
.
add
(
Answer_1
);
AnswerListBean
bean1
=
new
AnswerListBean
();
bean1
.
setQuestionDetail
(
"答题现金红包2"
);
bean1
.
setOptionList
(
Answers1
);
...
...
src/test/java/com/kjj/cases/live/red/Limited.java
View file @
e3161dbe
...
...
@@ -13,14 +13,15 @@ import org.testng.Assert;
import
org.testng.annotations.Test
;
import
javax.xml.crypto.Data
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
public
class
Limited
implements
AdminAuthorization
{
private
List
<
QuseRewardList
.
QuesList
>
quesConfId
;
private
QuestionList
.
question
wronganswer
;
private
QuestionList
.
question
rightanswer
;
/*主播端添加有奖答题-现金红包*/
@Test
(
description
=
"主播端添加有奖答题现金红包"
,
priority
=
1
)
...
...
@@ -118,9 +119,9 @@ public class Limited implements AdminAuthorization {
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
this
.
quesConfId
.
get
(
0
).
getQuesConfId
());
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardGetDetail
);
RewardGetDetail
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
RewardGetDetail
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
)
);
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardGetDetail
,
"查询主播端有奖答题配置失败"
,
response
.
body
().
asString
()));
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardGetDetail
,
"查询主播端有奖答题配置失败"
,
response
.
body
().
asString
()));
}
/*上架主播端未发放的有奖答题*/
...
...
@@ -161,9 +162,14 @@ public class Limited implements AdminAuthorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesDetail
);
Object
quesType
=
response
.
jsonPath
().
getJsonObject
(
"data.quesType"
);
System
.
out
.
println
(
quesType
);
Assert
.
assertEquals
(
quesType
,
1
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
List
<
QuestionList
.
question
>
list
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
response
.
jsonPath
().
get
(
"data.questionList"
)),
QuestionList
.
question
.
class
);
System
.
out
.
println
(
list
);
Optional
<
QuestionList
.
question
>
wrongAnswerOption
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getOptionType
(),
2
)).
findAny
();
this
.
wronganswer
=
wrongAnswerOption
.
get
();
Optional
<
QuestionList
.
question
>
correctAnswerOption
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getOptionType
(),
1
)).
findFirst
();
this
.
rightanswer
=
correctAnswerOption
.
get
();
System
.
out
.
println
(
list
);
Assert
.
assertNotNull
(
list
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包-错误选项*/
...
...
@@ -174,11 +180,17 @@ public class Limited implements AdminAuthorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
0
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MjM"
);
params
.
put
(
"optionId"
,
this
.
wronganswer
.
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"用户参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"用户答题失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包-访客A选择正确选项*/
...
...
@@ -189,11 +201,36 @@ public class Limited implements AdminAuthorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
0
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MTU"
);
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertNull
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包结果*/
@Test
(
description
=
"查询用户A领取答题红包结果"
,
priority
=
10
)
public
void
查询用户
A
领取答题红包结果
()
{
visitorAuth9
();
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
rightanswer
.
getId
());
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"用户答题结果获取失败"
,
response
.
body
().
asString
()));
Integer
amount
=
response
.
jsonPath
().
getJsonObject
(
"data.amount"
);
System
.
out
.
println
(
amount
);
Assert
.
assertTrue
(
amount
>
0
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"用户答题结果获取失败"
,
response
.
body
().
asString
()));
}
...
...
@@ -205,45 +242,78 @@ public class Limited implements AdminAuthorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
0
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MTU"
);
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assert
False
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包
失败"
,
response
.
body
().
asString
()));
Assert
.
assert
True
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题
失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包结果*/
@Test
(
description
=
"查询黑名单用户领取答题红包结果"
,
priority
=
12
)
public
void
查询黑名单用户领取答题红包结果
()
{
visitorAuth7
();
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
0
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Object
amount
=
response
.
jsonPath
().
getJsonObject
(
"data.amount"
);
System
.
out
.
println
(
amount
);
Assert
.
assertNull
(
amount
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取失败"
,
response
.
body
().
asString
()));
}
/*代理人领取答题红包*/
@Test
(
description
=
"代理人领取答题红包"
,
priority
=
1
2
)
@Test
(
description
=
"代理人领取答题红包"
,
priority
=
1
3
)
public
void
代理人领取答题红包
()
{
agentAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
0
).
getQuesConfId
()
);
params
.
put
(
"optionId"
,
"Kj21MTU"
);
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assert
Fals
e
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assert
Tru
e
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包结果*/
@Test
(
description
=
"领取答题红包结果"
,
priority
=
13
)
public
void
领取答题红包结果
()
@Test
(
description
=
"查询代理人领取答题红包结果"
,
priority
=
14
)
public
void
查询代理人领取答题红包结果
()
{
visitorAuth9
();
ThreadSleepUtils
.
sleep
(
5
00
);
agentAuth
();
ThreadSleepUtils
.
sleep
(
30
00
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
0
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertNotNull
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Object
amount
=
response
.
jsonPath
().
getJsonObject
(
"data.amount"
);
System
.
out
.
println
(
amount
);
Assert
.
assertNull
(
amount
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取失败"
,
response
.
body
().
asString
()));
}
/*查询主播端未上架的有奖答题配置详情*/
@Test
(
description
=
"查询第二轮答题现金红包"
,
priority
=
1
4
)
@Test
(
description
=
"查询第二轮答题现金红包"
,
priority
=
1
5
)
public
void
查询第二轮答题现金红包
()
{
adminAuth
();
...
...
@@ -251,13 +321,13 @@ public class Limited implements AdminAuthorization {
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
this
.
quesConfId
.
get
(
1
).
getQuesConfId
());
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardGetDetail
);
RewardGetDetail
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
RewardGetDetail
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
)
);
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardGetDetail
,
"查询主播端有奖答题配置失败"
,
response
.
body
().
asString
()));
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardGetDetail
,
"查询主播端有奖答题配置失败"
,
response
.
body
().
asString
()));
}
/*上架主播端未发放的有奖答题*/
@Test
(
description
=
"上架第二轮答题现金红包"
,
priority
=
1
5
)
@Test
(
description
=
"上架第二轮答题现金红包"
,
priority
=
1
6
)
public
void
上架第二轮答题现金红包
()
{
ThreadSleepUtils
.
sleep
(
100000
);
...
...
@@ -272,7 +342,7 @@ public class Limited implements AdminAuthorization {
}
/*主播端发放答题红包*/
@Test
(
description
=
"发放第二轮现金红包"
,
priority
=
1
6
)
@Test
(
description
=
"发放第二轮现金红包"
,
priority
=
1
7
)
public
void
发放第二轮现金红包
()
{
adminAuth
();
...
...
@@ -287,7 +357,7 @@ public class Limited implements AdminAuthorization {
//访客端
/*查询访客端有奖答题配置详情*/
@Test
(
description
=
"访客A查询有奖答题配置详情"
,
priority
=
1
7
)
@Test
(
description
=
"访客A查询有奖答题配置详情"
,
priority
=
1
8
)
public
void
访客
A
查询有奖答题配置详情
()
{
visitorAuth9
();
...
...
@@ -300,22 +370,27 @@ public class Limited implements AdminAuthorization {
}
/*领取答题红包-访客A选择正确选项*/
@Test
(
description
=
"访客A领取第二轮答题红包"
,
priority
=
1
8
)
@Test
(
description
=
"访客A领取第二轮答题红包"
,
priority
=
1
9
)
public
void
访客
A
领取第二轮答题红包
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
1
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MTU"
);
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assert
False
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包
失败"
,
response
.
body
().
asString
()));
Assert
.
assert
True
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题
失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包结果*/
@Test
(
description
=
"第二轮领取答题红包结果"
,
priority
=
19
)
@Test
(
description
=
"第二轮领取答题红包结果"
,
priority
=
20
)
public
void
第二轮领取答题红包结果
()
{
visitorAuth9
();
...
...
@@ -325,14 +400,19 @@ public class Limited implements AdminAuthorization {
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
ThreadSleepUtils
.
sleep
(
30000
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Integer
amount
=
response
.
jsonPath
().
getJsonObject
(
"data.amount"
);
System
.
out
.
println
(
amount
);
Assert
.
assertTrue
(
amount
==
0
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取失败"
,
response
.
body
().
asString
()));
}
//*****************有奖答题福利类型*****************//
/*上架主播端未发放的有奖答题-福利*/
@Test
(
description
=
"上架第一轮答题福利"
,
priority
=
2
0
)
@Test
(
description
=
"上架第一轮答题福利"
,
priority
=
2
1
)
public
void
上架第一轮答题福利
()
{
adminAuth
();
...
...
@@ -347,7 +427,7 @@ public class Limited implements AdminAuthorization {
}
/*主播端发放福利类型的有奖答题*/
@Test
(
description
=
"发放第一轮答题福利"
,
priority
=
2
1
)
@Test
(
description
=
"发放第一轮答题福利"
,
priority
=
2
2
)
public
void
发放第一轮答题福利
()
{
adminAuth
();
...
...
@@ -361,96 +441,168 @@ public class Limited implements AdminAuthorization {
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
,
"发放答题红包失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客查询第一轮答题福利"
,
priority
=
2
2
)
@Test
(
description
=
"访客查询第一轮答题福利"
,
priority
=
2
3
)
public
void
访客查询第一轮答题福利
()
{
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_QuesDetail
);
Object
quesType
=
response
.
jsonPath
().
getJsonObject
(
"data.quesType"
);
System
.
out
.
println
(
quesType
);
Assert
.
assertEquals
(
quesType
,
2
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
List
<
QuestionList
.
question
>
list
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
response
.
jsonPath
().
get
(
"data.questionList"
)),
QuestionList
.
question
.
class
);
System
.
out
.
println
(
list
);
Optional
<
QuestionList
.
question
>
wrongAnswerOption
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getOptionType
(),
2
)).
findAny
();
this
.
wronganswer
=
wrongAnswerOption
.
get
();
Optional
<
QuestionList
.
question
>
correctAnswerOption
=
list
.
stream
().
filter
(
option
->
Objects
.
equals
(
option
.
getOptionType
(),
1
)).
findFirst
();
this
.
rightanswer
=
correctAnswerOption
.
get
();
Assert
.
assertNotNull
(
list
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型-错误选项*/
@Test
(
description
=
"领取有奖答题福利类型-错误选项"
,
priority
=
2
3
)
@Test
(
description
=
"领取有奖答题福利类型-错误选项"
,
priority
=
2
4
)
public
void
领取有奖答题福利类型选择错误
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MjM"
);
params
.
put
(
"optionId"
,
this
.
wronganswer
.
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test
(
description
=
"领取有奖答题福利
类型-访客A答题正确"
,
priority
=
24
)
public
void
访客
A
领取有奖答题福利
类型
()
@Test
(
description
=
"领取有奖答题福利
-访客A答题正确"
,
priority
=
25
)
public
void
访客
A
领取有奖答题福利
()
{
visitorAuth3
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MTU"
);
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertNull
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型结果*/
@Test
(
description
=
"查询访客A领取有奖答题福利结果"
,
priority
=
26
)
public
void
查询访客
A
领取有奖答题福利结果
()
{
visitorAuth3
();
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
Integer
welfareStatus
=
response
.
jsonPath
().
getJsonObject
(
"data.welfareStatus"
);
System
.
out
.
println
(
welfareStatus
);
Assert
.
assertTrue
(
welfareStatus
==
2
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型-黑名单用户选择正确选项*/
@Test
(
description
=
"黑名单用户领取有奖答题福利-答题正确"
,
priority
=
2
5
)
@Test
(
description
=
"黑名单用户领取有奖答题福利-答题正确"
,
priority
=
2
7
)
public
void
黑名单用户领取有奖答题福利
()
{
visitorAuth7
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MTU"
);
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
}
/*
代理人领取有奖答题福利类型
*/
@Test
(
description
=
"
代理人领取有奖答题福利类型"
,
priority
=
26
)
public
void
代理人领取有奖答题福利类型
()
/*
领取有奖答题福利类型结果
*/
@Test
(
description
=
"
查询黑名单用户领取有奖答题福利结果"
,
priority
=
28
)
public
void
查询黑名单用户领取有奖答题福利结果
()
{
agentAuth
();
visitorAuth7
();
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
()
);
params
.
put
(
"optionId"
,
"Kj21MTU"
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Integer
welfareStatus
=
response
.
jsonPath
().
getJsonObject
(
"data.welfareStatus"
);
System
.
out
.
println
(
welfareStatus
);
Assert
.
assertTrue
(
welfareStatus
==
3
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取异常"
,
response
.
body
().
asString
()));
}
/*代理人领取有奖答题福利类型*/
@Test
(
description
=
"代理人领取有奖答题福利"
,
priority
=
29
)
public
void
代理人领取有奖答题福利
()
{
agentAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
());
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assert
False
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包
失败"
,
response
.
body
().
asString
()));
Assert
.
assert
True
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题
失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型结果*/
@Test
(
description
=
"
领取有奖答题福利类型结果"
,
priority
=
27
)
public
void
领取有奖答题福利类型
结果
()
@Test
(
description
=
"
查询代理人领取有奖答题福利结果"
,
priority
=
30
)
public
void
查询代理人领取有奖答题福利
结果
()
{
visitorAuth3
();
agentAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertNotNull
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Integer
welfareStatus
=
response
.
jsonPath
().
getJsonObject
(
"data.welfareStatus"
);
System
.
out
.
println
(
welfareStatus
);
Assert
.
assertTrue
(
welfareStatus
==
3
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取异常"
,
response
.
body
().
asString
()));
}
/*上架主播端未发放的有奖答题-福利*/
@Test
(
description
=
"上架第二轮答题福利"
,
priority
=
28
)
@Test
(
description
=
"上架第二轮答题福利"
,
priority
=
31
)
public
void
上架第二轮答题福利
()
{
adminAuth
();
...
...
@@ -466,7 +618,7 @@ public class Limited implements AdminAuthorization {
}
/*主播端发放福利类型的有奖答题*/
@Test
(
description
=
"发放第二轮答题福利"
,
priority
=
29
)
@Test
(
description
=
"发放第二轮答题福利"
,
priority
=
32
)
public
void
发放第二轮答题福利
()
{
adminAuth
();
...
...
@@ -480,7 +632,7 @@ public class Limited implements AdminAuthorization {
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
,
"发放答题红包失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客查询第二轮答题福利"
,
priority
=
3
0
)
@Test
(
description
=
"访客查询第二轮答题福利"
,
priority
=
3
3
)
public
void
访客查询第二轮答题福利
()
{
visitorAuth9
();
...
...
@@ -495,32 +647,44 @@ public class Limited implements AdminAuthorization {
/*领取有奖答题福利类型-访客A选择正确选项*/
@Test
(
description
=
"访客A第二轮领取有奖答题福利
类型-答题正确"
,
priority
=
31
)
public
void
访客
A
第二轮领取有奖答题福利
类型
()
@Test
(
description
=
"访客A第二轮领取有奖答题福利
-答题正确"
,
priority
=
34
)
public
void
访客
A
第二轮领取有奖答题福利
()
{
visitorAuth3
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
3
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MTU"
);
params
.
put
(
"optionId"
,
this
.
rightanswer
.
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertFalse
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
}
/*领取有奖答题福利类型结果*/
@Test
(
description
=
"
领取第二轮有奖答题福利类型结果"
,
priority
=
32
)
public
void
领取
第二轮有奖答题福利类型结果
()
@Test
(
description
=
"
查询访客A第二轮有奖答题福利类型结果"
,
priority
=
35
)
public
void
查询访客
A
第二轮有奖答题福利类型结果
()
{
visitorAuth3
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
3
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
boolean
Result
=
response
.
jsonPath
().
getBoolean
(
"data.Result"
);
System
.
out
.
println
(
Result
);
Assert
.
assertFalse
(
Result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Integer
welfareStatus
=
response
.
jsonPath
().
getJsonObject
(
"data.welfareStatus"
);
System
.
out
.
println
(
welfareStatus
);
Assert
.
assertTrue
(
welfareStatus
==
3
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取异常"
,
response
.
body
().
asString
()));
}
...
...
src/test/java/com/kjj/cases/live/red/QuestionAwards.java
View file @
e3161dbe
...
...
@@ -21,7 +21,6 @@ public class QuestionAwards implements AdminAuthorization {
public
String
confId_ques
;
public
String
confId_reward
;
public
String
wronganswer
;
public
String
rightanswer
;
...
...
src/test/java/com/kjj/cases/live/red/Unlimited.java
View file @
e3161dbe
package
com
.
kjj
.
cases
.
live
.
red
;
import
com.alibaba.fastjson.JSON
;
import
com.kjj.bean.answer.QuestionList
;
import
com.kjj.bean.answer.QuseRewardList
;
import
com.kjj.bean.answer.RewardGetDetail
;
import
com.kjj.cases.live.admin.AdminAuthorization
;
...
...
@@ -15,10 +16,14 @@ import org.testng.annotations.Test;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
public
class
Unlimited
implements
AdminAuthorization
{
private
List
<
QuseRewardList
.
QuesList
>
quesConfId
;
private
List
<
QuestionList
.
question
>
wronganswer
;
private
List
<
QuestionList
.
question
>
rightanswer
;
/*查询主播端有奖答题列表*/
@Test
(
description
=
"查询主播端有奖答题列表"
,
priority
=
1
)
public
void
查询主播端有奖答题列表
()
...
...
@@ -44,9 +49,9 @@ public class Unlimited implements AdminAuthorization {
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
());
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesRewardGetDetail
);
RewardGetDetail
Beans
=
JsonUtil
.
parseResponseToBean
(
response
,
RewardGetDetail
.
class
);
System
.
out
.
println
(
JSON
.
toJSONString
(
Beans
)
);
Assert
.
assertNotNull
(
Beans
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardGetDetail
,
"查询主播端有奖答题配置失败"
,
response
.
body
().
asString
()));
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardGetDetail
,
"查询主播端有奖答题配置失败"
,
response
.
body
().
asString
()));
}
/*上架主播端未发放的有奖答题*/
...
...
@@ -62,7 +67,6 @@ public class Unlimited implements AdminAuthorization {
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardUp
,
"上架答题红包失败"
,
response
.
body
().
asString
()));
ThreadSleepUtils
.
sleep
(
3000
);
}
/*主播端发放答题红包*/
...
...
@@ -70,7 +74,7 @@ public class Unlimited implements AdminAuthorization {
public
void
发放第三轮现金红包
()
{
adminAuth
();
ThreadSleepUtils
.
sleep
(
5
00
);
ThreadSleepUtils
.
sleep
(
30
00
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
());
...
...
@@ -89,9 +93,11 @@ public class Unlimited implements AdminAuthorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesDetail
);
Object
quesType
=
response
.
jsonPath
().
getJsonObject
(
"data.quesType"
);
System
.
out
.
println
(
quesType
);
Assert
.
assertEquals
(
quesType
,
1
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
List
<
QuestionList
.
question
>
list
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
response
.
jsonPath
().
get
(
"data.questionList"
)),
QuestionList
.
question
.
class
);
System
.
out
.
println
(
list
);
this
.
wronganswer
=
list
;
this
.
rightanswer
=
list
;
Assert
.
assertNotNull
(
list
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesDetail
,
"查询访客端有奖答题配置详情失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包-错误选项*/
...
...
@@ -102,11 +108,16 @@ public class Unlimited implements AdminAuthorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MjM"
);
params
.
put
(
"optionId"
,
this
.
wronganswer
.
stream
().
filter
(
a
->
a
.
getOptionType
()==
2
).
collect
(
Collectors
.
toList
()).
get
(
0
).
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包-访客A选择正确选项*/
...
...
@@ -117,62 +128,126 @@ public class Unlimited implements AdminAuthorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MTU"
);
params
.
put
(
"optionId"
,
this
.
rightanswer
.
stream
().
filter
(
a
->
a
.
getOptionType
()==
1
).
collect
(
Collectors
.
toList
()).
get
(
0
).
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertNull
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包结果*/
@Test
(
description
=
"查询访客A领取答题红包结果"
,
priority
=
8
)
public
void
查询访客
A
领取答题红包结果
()
{
visitorAuth9
();
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Integer
amount
=
response
.
jsonPath
().
getJsonObject
(
"data.amount"
);
System
.
out
.
println
(
amount
);
Assert
.
assertTrue
(
amount
>
0
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包-黑名单用户选择正确选项*/
@Test
(
description
=
"领取答题红包-黑名单用户答题正确"
,
priority
=
8
)
@Test
(
description
=
"领取答题红包-黑名单用户答题正确"
,
priority
=
9
)
public
void
黑名单用户领取答题红包成功
()
{
visitorAuth7
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MTU"
);
params
.
put
(
"optionId"
,
this
.
rightanswer
.
stream
().
filter
(
a
->
a
.
getOptionType
()==
1
).
collect
(
Collectors
.
toList
()).
get
(
0
).
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"答题失败"
,
response
.
body
().
asString
()));
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"参与失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包结果*/
@Test
(
description
=
"查询黑名单用户领取答题红包结果"
,
priority
=
10
)
public
void
查询黑名单用户领取答题红包结果
()
{
visitorAuth7
();
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Integer
amount
=
response
.
jsonPath
().
getJsonObject
(
"data.amount"
);
System
.
out
.
println
(
amount
);
Assert
.
assertNull
(
amount
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"领取异常"
,
response
.
body
().
asString
()));
}
/*代理人领取答题红包*/
@Test
(
description
=
"代理人领取答题红包"
,
priority
=
9
)
@Test
(
description
=
"代理人领取答题红包"
,
priority
=
11
)
public
void
代理人领取答题红包
()
{
agentAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
()
);
params
.
put
(
"optionId"
,
"Kj21MTU"
);
params
.
put
(
"optionId"
,
this
.
rightanswer
.
stream
().
filter
(
a
->
a
.
getOptionType
()==
1
).
collect
(
Collectors
.
toList
()).
get
(
0
).
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertFalse
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
/*领取答题红包结果*/
@Test
(
description
=
"
领取答题红包结果"
,
priority
=
10
)
public
void
领取答题红包结果
()
@Test
(
description
=
"
查询代理人领取答题红包结果"
,
priority
=
12
)
public
void
查询代理人
领取答题红包结果
()
{
visitorAuth9
();
ThreadSleepUtils
.
sleep
(
5
00
);
agentAuth
();
ThreadSleepUtils
.
sleep
(
30
00
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
4
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertNotNull
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
Integer
amount
=
response
.
jsonPath
().
getJsonObject
(
"data.amount"
);
System
.
out
.
println
(
amount
);
Assert
.
assertNull
(
amount
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"答题失败"
,
response
.
body
().
asString
()));
}
/*上架主播端未发放的有奖答题-福利*/
@Test
(
description
=
"上架第一轮答题福利"
,
priority
=
1
1
)
@Test
(
description
=
"上架第一轮答题福利"
,
priority
=
1
3
)
public
void
上架第一轮答题福利
()
{
adminAuth
();
...
...
@@ -187,11 +262,11 @@ public class Unlimited implements AdminAuthorization {
}
/*主播端发放福利类型的有奖答题*/
@Test
(
description
=
"发放第一轮答题福利"
,
priority
=
1
2
)
@Test
(
description
=
"发放第一轮答题福利"
,
priority
=
1
4
)
public
void
发放第一轮答题福利
()
{
adminAuth
();
ThreadSleepUtils
.
sleep
(
5
00
);
ThreadSleepUtils
.
sleep
(
30
00
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
this
.
quesConfId
.
get
(
5
).
getQuesConfId
());
...
...
@@ -201,7 +276,7 @@ public class Unlimited implements AdminAuthorization {
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesRewardStart
,
"发放答题红包失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客查询第一轮答题福利"
,
priority
=
1
3
)
@Test
(
description
=
"访客查询第一轮答题福利"
,
priority
=
1
5
)
public
void
访客查询第一轮答题福利
()
{
visitorAuth9
();
...
...
@@ -215,14 +290,14 @@ public class Unlimited implements AdminAuthorization {
/*领取有奖答题福利类型-错误选项*/
@Test
(
description
=
"领取有奖答题福利类型-错误选项"
,
priority
=
1
4
)
@Test
(
description
=
"领取有奖答题福利类型-错误选项"
,
priority
=
1
6
)
public
void
领取有奖答题福利类型选择错误
()
{
visitorAuth9
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
5
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MjM"
);
params
.
put
(
"optionId"
,
this
.
wronganswer
.
stream
().
filter
(
a
->
a
.
getOptionType
()==
2
).
collect
(
Collectors
.
toList
()).
get
(
0
).
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
...
...
@@ -238,14 +313,32 @@ public class Unlimited implements AdminAuthorization {
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
5
).
getQuesConfId
());
params
.
put
(
"optionId"
,
"Kj21MTU"
);
params
.
put
(
"optionId"
,
this
.
rightanswer
.
stream
().
filter
(
a
->
a
.
getOptionType
()==
1
).
collect
(
Collectors
.
toList
()).
get
(
0
).
getId
()
);
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
);
boolean
result
=
response
.
jsonPath
().
getBoolean
(
"data.result"
);
System
.
out
.
println
(
result
);
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipate
,
"领取答题红包失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询访客A领取有奖答题福利结果"
,
priority
=
16
)
public
void
查询访客
A
领取有奖答题福利结果
()
{
visitorAuth3
();
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"quesConfId"
,
this
.
quesConfId
.
get
(
2
).
getQuesConfId
()
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
);
boolean
openResult
=
response
.
jsonPath
().
getBoolean
(
"data.openResult"
);
System
.
out
.
println
(
openResult
);
Assert
.
assertTrue
(
openResult
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
Integer
welfareStatus
=
response
.
jsonPath
().
getJsonObject
(
"data.welfareStatus"
);
System
.
out
.
println
(
welfareStatus
);
Assert
.
assertTrue
(
welfareStatus
==
2
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_QuesParticipateInfo
,
"查询答题红包结果失败"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/config/BasicConfig.java
View file @
e3161dbe
...
...
@@ -19,11 +19,11 @@ public class BasicConfig {
//直播访客 (刘超)
public
static
String
VISITORKEY3
=
"LEH7epeHVDJWzhZ6DiexTHnsaP3ed5NWb7fwGDRPzUCcfxMKyEZr5fYSmKv5AZVQu1w2FRoEvz6mP3RzfeKLqjV8Kq1XE"
;
//直播访客 (李执)
public
static
String
VISITORKEY4
=
"
5MgSyboxqzAQZZJEsTf43nVX8FkunrWfgVgxhR9mmo6thaPjMjfgUM62TrCUYvnSdn3kTGsGvJsSaiS4m5LS1up5twWa
"
;
public
static
String
VISITORKEY4
=
"
DyGoVEPj7nANppy7P8NS4Z4mtMsJhG8DmhaSQPam9aBfp49QoDsHkMeQEFDqHgpbfXt2ESodJMJrGEDiTxk687Kcq
"
;
//直播访客 (吉吉)
public
static
String
VISITORKEY9
=
"LEH7epeHVDJWzhZ6DiexTHnfZY2NrKnNHmHY52FxaDfigK3U4NQpLsQrodQUPUXwmumQ1kr3xsfZoGw7cEswYryWfUtMW"
;
//直播访客 (周成)
public
static
String
VISITORKEY5
=
"
LEH7epeHVDJWzhZ6DiexTHnsy28uMFcnMj6a1Nh76ZtqrBohi2vbvjsoksZjyRcqFdSgh5zddoi95S8gKvBbuggy6Bhku
"
;
public
static
String
VISITORKEY5
=
"
zFNkBc7JtvLPL6ifAfXbcgXf7k83YNaKjHreYoVN6SLoZF8WsHX87aGwwxpLiGDXLfX4GvfvDzp9uJsxooF5ZPLVrn
"
;
//直播访客 (新强)
public
static
String
VISITORKEY6
=
"DyGoVEPj7nANppy7P8NS4Z4v3PAwxeqJodqYrmwYkoHYMsV4yAxbTXwZ5wWmGQTddQgxdWoNCmN43P8fzhcuWRmdE"
;
//直播访客 (熊二)
...
...
src/test/liveTestNG.xml
View file @
e3161dbe
...
...
@@ -119,11 +119,6 @@
<class
name=
"com.kjj.cases.live.red.LiveVistorRed"
/>
</classes>
</test>
<!-- <test preserve-order="true" name="有奖答题">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.red.QuestionAwards"/>-->
<!-- </classes>-->
<!-- </test>-->
<test
preserve-order=
"true"
name=
"有奖答题限制1次中奖"
>
<classes>
...
...
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