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
a51cc5cf
Commit
a51cc5cf
authored
Oct 19, 2021
by
龚小红
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Feature/20211015-gxh' into 'master'
修改测试用例描述 See merge request test-group/kejiji!141
parents
284ed0e5
ba1086cd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
99 additions
and
185 deletions
+99
-185
OpenLive.java
src/test/java/com/kjj/cases/live/anchor/OpenLive.java
+0
-49
Lottery.java
src/test/java/com/kjj/cases/live/lottery/Lottery.java
+58
-129
LotteryCode.java
...test/java/com/kjj/cases/live/lotteryCode/LotteryCode.java
+3
-7
BaseUtils.java
src/test/java/com/kjj/utils/BaseUtils.java
+38
-0
No files found.
src/test/java/com/kjj/cases/live/anchor/OpenLive.java
View file @
a51cc5cf
...
@@ -7,9 +7,6 @@ import io.restassured.response.Response;
...
@@ -7,9 +7,6 @@ import io.restassured.response.Response;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -86,50 +83,4 @@ public class OpenLive implements Authorization {
...
@@ -86,50 +83,4 @@ public class OpenLive implements Authorization {
}
}
public
void
connectSuccess
()
{
Map
<
String
,
Object
>
connectSuccessParam
=
new
HashMap
<>();
connectSuccessParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
connectSuccessParam
,
BasicConfig
.
USER_connectSuccess
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
connectSuccessParam
,
BasicConfig
.
USER_connectSuccess
,
"访客到场请求失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"用户到场"
,
priority
=
3
)
public
void
用户到场
()
throws
NoSuchMethodException
,
InvocationTargetException
,
IllegalAccessException
{
agentAuth
();
connectSuccess
();
visitorAuth1
();
connectSuccess
();
visitorAuth2
();
connectSuccess
();
visitorAuth3
();
connectSuccess
();
visitorAuth4
();
connectSuccess
();
visitorAuth5
();
connectSuccess
();
visitorAuth6
();
connectSuccess
();
visitorAuth7
();
connectSuccess
();
visitorAuth8
();
connectSuccess
();
visitorAuth9
();
connectSuccess
();
visitorAuth10
();
connectSuccess
();
visitorAuth11
();
connectSuccess
();
}
}
}
src/test/java/com/kjj/cases/live/lottery/Lottery.java
View file @
a51cc5cf
...
@@ -9,6 +9,7 @@ import com.kjj.utils.ThreadSleepUtils;
...
@@ -9,6 +9,7 @@ import com.kjj.utils.ThreadSleepUtils;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -16,6 +17,8 @@ import java.util.List;
...
@@ -16,6 +17,8 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.*;
public
class
Lottery
implements
Authorization
{
public
class
Lottery
implements
Authorization
{
public
List
<
ConfIdList
>
List_ConfId
;
public
List
<
ConfIdList
>
List_ConfId
;
...
@@ -23,6 +26,19 @@ public class Lottery implements Authorization {
...
@@ -23,6 +26,19 @@ public class Lottery implements Authorization {
public
static
String
welfareName
;
public
static
String
welfareName
;
public
static
String
lotteryConfId
;
public
static
String
lotteryConfId
;
@BeforeClass
public
void
setUp
()
{
//代理人A/访客A/访客B到场
agentAuth
();
connectSuccess
();
visitorAuth1
();
connectSuccess
();
visitorAuth2
();
connectSuccess
();
}
@Test
(
description
=
"代理人抽奖活动弹层福利列表"
,
priority
=
1
)
@Test
(
description
=
"代理人抽奖活动弹层福利列表"
,
priority
=
1
)
public
void
抽奖活动弹层福利列表
()
{
public
void
抽奖活动弹层福利列表
()
{
agentAuth
();
agentAuth
();
...
@@ -264,27 +280,30 @@ public class Lottery implements Authorization {
...
@@ -264,27 +280,30 @@ public class Lottery implements Authorization {
@Test
(
description
=
"访客C关注直播间"
,
priority
=
24
)
@Test
(
description
=
"访客C关注直播间"
,
priority
=
24
)
public
void
访客
C
关注直播间
()
{
public
void
访客
C
关注直播间
()
{
// 访客C/D/E/F/G到场
visitorAuth4
();
connectSuccess
();
visitorAuth5
();
connectSuccess
();
visitorAuth6
();
connectSuccess
();
visitorAuth7
();
connectSuccess
();
visitorAuth3
();
visitorAuth3
();
Map
<
String
,
Object
>
subscribeParam
=
new
HashMap
<>();
connectSuccess
();
subscribeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
subscribelive
();
Response
subscribeRes
=
network
.
postResponse
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
);
boolean
data
=
subscribeRes
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
,
"关注失败"
,
subscribeRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客C抽奖码数量"
,
priority
=
25
)
@Test
(
description
=
"访客C抽奖码数量"
,
priority
=
25
)
public
void
访客
C
抽奖码数量
()
{
public
void
访客
C
抽奖码数量
()
{
visitorAuth3
();
visitorAuth3
();
ThreadSleepUtils
.
sleep
(
1000
);
codeCount
(
1
);
Map
<
String
,
Object
>
myCountParam
=
new
HashMap
<>();
myCountParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
myCountRes
=
network
.
getResponse
(
myCountParam
,
BasicConfig
.
USER_myCount
);
long
data
=
myCountRes
.
jsonPath
().
getLong
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_myCount
,
"获取抽奖码数量失败"
,
myCountRes
.
body
().
asString
()));
}
}
//好运红包
//好运红包
@Test
(
description
=
"分享者访客A获取好运红包"
,
priority
=
26
)
@Test
(
description
=
"分享者访客A获取好运红包"
,
priority
=
26
)
public
void
分享者访客
A
获取好运红包
()
{
public
void
分享者访客
A
获取好运红包
()
{
...
@@ -404,13 +423,7 @@ public class Lottery implements Authorization {
...
@@ -404,13 +423,7 @@ public class Lottery implements Authorization {
@Test
(
description
=
"访客A抽奖码数量"
,
priority
=
33
)
@Test
(
description
=
"访客A抽奖码数量"
,
priority
=
33
)
public
void
访客
A
抽奖码数量
()
{
public
void
访客
A
抽奖码数量
()
{
visitorAuth1
();
visitorAuth1
();
ThreadSleepUtils
.
sleep
(
500
);
codeCount
(
2
);
Map
<
String
,
Object
>
myCountParam
=
new
HashMap
<>();
myCountParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
myCountRes
=
network
.
getResponse
(
myCountParam
,
BasicConfig
.
USER_myCount
);
long
data
=
myCountRes
.
jsonPath
().
getLong
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_myCount
,
"获取抽奖码数量失败"
,
myCountRes
.
body
().
asString
()));
}
}
...
@@ -474,24 +487,13 @@ public class Lottery implements Authorization {
...
@@ -474,24 +487,13 @@ public class Lottery implements Authorization {
@Test
(
description
=
"访客D关注直播间"
,
priority
=
40
)
@Test
(
description
=
"访客D关注直播间"
,
priority
=
40
)
public
void
访客
D
关注直播间
()
{
public
void
访客
D
关注直播间
()
{
visitorAuth4
();
visitorAuth4
();
Map
<
String
,
Object
>
subscribeParam
=
new
HashMap
<>();
subscribelive
();
subscribeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
subscribeRes
=
network
.
postResponse
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
);
boolean
data
=
subscribeRes
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
,
"关注失败"
,
subscribeRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客D抽奖码数量"
,
priority
=
41
)
@Test
(
description
=
"访客D抽奖码数量"
,
priority
=
41
)
public
void
访客
D
抽奖码数量
()
{
public
void
访客
D
抽奖码数量
()
{
visitorAuth4
();
visitorAuth4
();
ThreadSleepUtils
.
sleep
(
500
);
codeCount
(
1
);
Map
<
String
,
Object
>
myCountParam
=
new
HashMap
<>();
myCountParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
myCountRes
=
network
.
getResponse
(
myCountParam
,
BasicConfig
.
USER_myCount
);
long
data
=
myCountRes
.
jsonPath
().
getLong
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_myCount
,
"获取抽奖码数量失败"
,
myCountRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客E给访客B助力"
,
priority
=
44
)
@Test
(
description
=
"访客E给访客B助力"
,
priority
=
44
)
...
@@ -512,24 +514,13 @@ public class Lottery implements Authorization {
...
@@ -512,24 +514,13 @@ public class Lottery implements Authorization {
@Test
(
description
=
"访客E关注直播间"
,
priority
=
46
)
@Test
(
description
=
"访客E关注直播间"
,
priority
=
46
)
public
void
访客
E
关注直播间
()
{
public
void
访客
E
关注直播间
()
{
visitorAuth5
();
visitorAuth5
();
Map
<
String
,
Object
>
subscribeParam
=
new
HashMap
<>();
subscribelive
();
subscribeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
postResponse
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
,
"关注失败"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客E抽奖码数量"
,
priority
=
47
)
@Test
(
description
=
"访客E抽奖码数量"
,
priority
=
47
)
public
void
访客
E
抽奖码数量
()
{
public
void
访客
E
抽奖码数量
()
{
visitorAuth5
();
visitorAuth5
();
ThreadSleepUtils
.
sleep
(
500
);
codeCount
(
1
);
Map
<
String
,
Object
>
myCountParam
=
new
HashMap
<>();
myCountParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
myCountRes
=
network
.
getResponse
(
myCountParam
,
BasicConfig
.
USER_myCount
);
long
data
=
myCountRes
.
jsonPath
().
getLong
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_myCount
,
"获取抽奖码数量失败"
,
myCountRes
.
body
().
asString
()));
}
}
...
@@ -551,24 +542,13 @@ public class Lottery implements Authorization {
...
@@ -551,24 +542,13 @@ public class Lottery implements Authorization {
@Test
(
description
=
"访客F关注直播间"
,
priority
=
52
)
@Test
(
description
=
"访客F关注直播间"
,
priority
=
52
)
public
void
访客
F
关注直播间
()
{
public
void
访客
F
关注直播间
()
{
visitorAuth6
();
visitorAuth6
();
Map
<
String
,
Object
>
subscribeParam
=
new
HashMap
<>();
subscribelive
();
subscribeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
subscribeRes
=
network
.
postResponse
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
);
boolean
data
=
subscribeRes
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
,
"关注失败"
,
subscribeRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客F抽奖码数量"
,
priority
=
53
)
@Test
(
description
=
"访客F抽奖码数量"
,
priority
=
53
)
public
void
访客
F
抽奖码数量
()
{
public
void
访客
F
抽奖码数量
()
{
visitorAuth6
();
visitorAuth6
();
ThreadSleepUtils
.
sleep
(
500
);
codeCount
(
1
);
Map
<
String
,
Object
>
myCountParam
=
new
HashMap
<>();
myCountParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
myCountRes
=
network
.
getResponse
(
myCountParam
,
BasicConfig
.
USER_myCount
);
long
data
=
myCountRes
.
jsonPath
().
getLong
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_myCount
,
"获取抽奖码数量失败"
,
myCountRes
.
body
().
asString
()));
}
}
...
@@ -589,35 +569,16 @@ public class Lottery implements Authorization {
...
@@ -589,35 +569,16 @@ public class Lottery implements Authorization {
@Test
(
description
=
"访客G关注直播间"
,
priority
=
58
)
@Test
(
description
=
"访客G关注直播间"
,
priority
=
58
)
public
void
访客
G
关注直播间
()
{
public
void
访客
G
关注直播间
()
{
subscribelive
();
Map
<
String
,
Object
>
subscribeParam
=
new
HashMap
<>();
subscribeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
visitorAuth7
();
Response
subscribeRes
=
network
.
postResponse
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
);
boolean
data
=
subscribeRes
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
,
"关注失败"
,
subscribeRes
.
body
().
asString
()));
agentAuth
();
agentAuth
();
Response
response
=
network
.
postResponse
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
);
subscribelive
();
boolean
data1
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data1
);
Assert
.
assertTrue
(
data1
,
network
.
message
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
,
"关注失败"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客G抽奖码数量"
,
priority
=
59
)
@Test
(
description
=
"访客G抽奖码数量"
,
priority
=
59
)
public
void
访客
G
抽奖码数量
()
{
public
void
访客
G
抽奖码数量
()
{
visitorAuth7
();
visitorAuth7
();
ThreadSleepUtils
.
sleep
(
500
);
codeCount
(
1
);
Map
<
String
,
Object
>
myCountParam
=
new
HashMap
<>();
myCountParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
myCountRes
=
network
.
getResponse
(
myCountParam
,
BasicConfig
.
USER_myCount
);
long
data
=
myCountRes
.
jsonPath
().
getLong
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_myCount
,
"获取抽奖码数量失败"
,
myCountRes
.
body
().
asString
()));
}
}
...
@@ -658,14 +619,7 @@ public class Lottery implements Authorization {
...
@@ -658,14 +619,7 @@ public class Lottery implements Authorization {
@Test
(
description
=
"访客B的抽奖码数量"
,
priority
=
62
)
@Test
(
description
=
"访客B的抽奖码数量"
,
priority
=
62
)
public
void
访客
B
抽奖码数量
()
{
public
void
访客
B
抽奖码数量
()
{
visitorAuth2
();
visitorAuth2
();
ThreadSleepUtils
.
sleep
(
3000
);
codeCount
(
14
);
Map
<
String
,
Object
>
myCountParam
=
new
HashMap
<>();
myCountParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
myCountRes
=
network
.
getResponse
(
myCountParam
,
BasicConfig
.
USER_myCount
);
long
data
=
myCountRes
.
jsonPath
().
getLong
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_myCount
,
"获取访客B抽奖码数量失败"
,
myCountRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"开始第二轮抽奖"
,
priority
=
63
)
@Test
(
description
=
"开始第二轮抽奖"
,
priority
=
63
)
...
@@ -917,25 +871,22 @@ public class Lottery implements Authorization {
...
@@ -917,25 +871,22 @@ public class Lottery implements Authorization {
@Test
(
description
=
"访客H关注直播间"
,
priority
=
78
)
@Test
(
description
=
"访客H关注直播间"
,
priority
=
78
)
public
void
访客
H
关注直播间
()
{
public
void
访客
H
关注直播间
()
{
//// 访客H/I/J到场
visitorAuth8
();
connectSuccess
();
visitorAuth10
();
connectSuccess
();
visitorAuth9
();
visitorAuth9
();
Map
<
String
,
Object
>
subscribeParam
=
new
HashMap
<>();
connectSuccess
();
subscribeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
subscribelive
();
Response
subscribeRes
=
network
.
postResponse
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
);
boolean
data
=
subscribeRes
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
,
"关注失败"
,
subscribeRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客H抽奖码数量"
,
priority
=
79
)
@Test
(
description
=
"访客H抽奖码数量"
,
priority
=
79
)
public
void
访客
H
抽奖码数量
()
{
public
void
访客
H
抽奖码数量
()
{
visitorAuth9
();
visitorAuth9
();
ThreadSleepUtils
.
sleep
(
1000
);
codeCount
(
1
);
Map
<
String
,
Object
>
myCountParam
=
new
HashMap
<>();
myCountParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
myCountRes
=
network
.
getResponse
(
myCountParam
,
BasicConfig
.
USER_myCount
);
long
data
=
myCountRes
.
jsonPath
().
getLong
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_myCount
,
"获取抽奖码数量失败"
,
myCountRes
.
body
().
asString
()));
}
}
...
@@ -943,48 +894,26 @@ public class Lottery implements Authorization {
...
@@ -943,48 +894,26 @@ public class Lottery implements Authorization {
@Test
(
description
=
"访客I关注直播间"
,
priority
=
81
)
@Test
(
description
=
"访客I关注直播间"
,
priority
=
81
)
public
void
访客
I
关注直播间
()
{
public
void
访客
I
关注直播间
()
{
visitorAuth8
();
visitorAuth8
();
Map
<
String
,
Object
>
subscribeParam
=
new
HashMap
<>();
subscribelive
();
subscribeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
subscribeRes
=
network
.
postResponse
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
);
boolean
data
=
subscribeRes
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
,
"关注失败"
,
subscribeRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客I抽奖码数量"
,
priority
=
82
)
@Test
(
description
=
"访客I抽奖码数量"
,
priority
=
82
)
public
void
访客
I
抽奖码数量
()
{
public
void
访客
I
抽奖码数量
()
{
visitorAuth8
();
visitorAuth8
();
ThreadSleepUtils
.
sleep
(
1000
);
codeCount
(
1
);
Map
<
String
,
Object
>
myCountParam
=
new
HashMap
<>();
myCountParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
myCountRes
=
network
.
getResponse
(
myCountParam
,
BasicConfig
.
USER_myCount
);
long
data
=
myCountRes
.
jsonPath
().
getLong
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_myCount
,
"获取抽奖码数量失败"
,
myCountRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客J关注直播间"
,
priority
=
84
)
@Test
(
description
=
"访客J关注直播间"
,
priority
=
84
)
public
void
访客
J
关注直播间
()
{
public
void
访客
J
关注直播间
()
{
visitorAuth10
();
visitorAuth10
();
Map
<
String
,
Object
>
subscribeParam
=
new
HashMap
<>();
subscribelive
();
subscribeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
subscribeRes
=
network
.
postResponse
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
);
boolean
data
=
subscribeRes
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
,
"关注失败"
,
subscribeRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客J抽奖码数量"
,
priority
=
85
)
@Test
(
description
=
"访客J抽奖码数量"
,
priority
=
85
)
public
void
访客
J
抽奖码数量
()
{
public
void
访客
J
抽奖码数量
()
{
visitorAuth10
();
visitorAuth10
();
ThreadSleepUtils
.
sleep
(
1000
);
codeCount
(
1
);
Map
<
String
,
Object
>
myCountParam
=
new
HashMap
<>();
myCountParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
myCountRes
=
network
.
getResponse
(
myCountParam
,
BasicConfig
.
USER_myCount
);
long
data
=
myCountRes
.
jsonPath
().
getLong
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_myCount
,
"获取抽奖码数量失败"
,
myCountRes
.
body
().
asString
()));
}
}
...
...
src/test/java/com/kjj/cases/live/lotteryCode/LotteryCode.java
View file @
a51cc5cf
...
@@ -13,6 +13,8 @@ import java.util.HashMap;
...
@@ -13,6 +13,8 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
static
com
.
kjj
.
utils
.
BaseUtils
.
codeCount
;
public
class
LotteryCode
implements
Authorization
{
public
class
LotteryCode
implements
Authorization
{
public
String
shareSign
;
public
String
shareSign
;
...
@@ -86,13 +88,7 @@ public class LotteryCode implements Authorization {
...
@@ -86,13 +88,7 @@ public class LotteryCode implements Authorization {
@Test
(
description
=
"访客A抽奖码数量"
,
priority
=
6
)
@Test
(
description
=
"访客A抽奖码数量"
,
priority
=
6
)
public
void
访客
A
抽奖码数量
()
{
public
void
访客
A
抽奖码数量
()
{
visitorAuth1
();
visitorAuth1
();
Map
<
String
,
Object
>
myCountParam
=
new
HashMap
<>();
codeCount
(
3
);
myCountParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
myCountRes
=
network
.
getResponse
(
myCountParam
,
BasicConfig
.
USER_myCount
);
long
data
=
myCountRes
.
jsonPath
().
getLong
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_myCount
,
"获取抽奖码数量失败"
,
myCountRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客A查询抽奖券列表"
,
priority
=
7
)
@Test
(
description
=
"访客A查询抽奖券列表"
,
priority
=
7
)
...
...
src/test/java/com/kjj/utils/BaseUtils.java
View file @
a51cc5cf
package
com
.
kjj
.
utils
;
package
com
.
kjj
.
utils
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.constants.LiveConstants
;
import
com.kjj.sql.KjyUserDB
;
import
com.kjj.sql.KjyUserDB
;
import
com.kjj.sql.UserSqlFactory
;
import
com.kjj.sql.UserSqlFactory
;
import
io.restassured.response.Response
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -144,4 +147,39 @@ public class BaseUtils {
...
@@ -144,4 +147,39 @@ public class BaseUtils {
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
MANAGER_updateTypeOrDate
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
success
,
network
.
message
(
params
,
MANAGER_updateTypeOrDate
,
"接口返回失败"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
MANAGER_updateTypeOrDate
,
"返回数据为空"
,
response
.
body
().
asString
()));
Assert
.
assertTrue
(
result
,
network
.
message
(
params
,
MANAGER_updateTypeOrDate
,
"返回数据为空"
,
response
.
body
().
asString
()));
}
}
/*
* 访客到场
* */
public
static
void
connectSuccess
()
{
Map
<
String
,
Object
>
connectSuccessParam
=
new
HashMap
<>();
connectSuccessParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
connectSuccessParam
,
BasicConfig
.
USER_connectSuccess
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
Assert
.
assertTrue
(
success
,
network
.
message
(
connectSuccessParam
,
BasicConfig
.
USER_connectSuccess
,
"访客到场请求失败"
,
response
.
body
().
asString
()));
}
/*
* 关注直播间
* */
public
static
void
subscribelive
()
{
Map
<
String
,
Object
>
subscribeParam
=
new
HashMap
<>();
subscribeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
subscribeRes
=
network
.
postResponse
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
);
boolean
data
=
subscribeRes
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
,
"关注失败"
,
subscribeRes
.
body
().
asString
()));
}
/*
* 抽奖码数量校验
* */
public
static
void
codeCount
(
int
num
)
{
ThreadSleepUtils
.
sleep
(
500
);
Map
<
String
,
Object
>
myCountParam
=
new
HashMap
<>();
myCountParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
myCountRes
=
network
.
getResponse
(
myCountParam
,
BasicConfig
.
USER_myCount
);
int
data
=
myCountRes
.
jsonPath
().
getInt
(
"data"
);
Assert
.
assertEquals
(
data
,
num
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_myCount
,
"获取抽奖码数量失败"
,
myCountRes
.
body
().
asString
()));
}
}
}
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