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
1b9741b2
Commit
1b9741b2
authored
Mar 25, 2021
by
张艳玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
cb6e0544
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
29 deletions
+74
-29
User.java
src/test/java/com/kjj/cases/live/User.java
+56
-17
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+1
-0
IdMakeUtil.java
src/test/java/com/kjj/utils/IdMakeUtil.java
+0
-1
liveTestNG.xml
src/test/liveTestNG.xml
+17
-11
No files found.
src/test/java/com/kjj/cases/live/User.java
View file @
1b9741b2
package
com
.
kjj
.
cases
.
live
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.constants.LiveConstants
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
User
implements
AdminAuthorization
{
public
String
shareSign
;
@BeforeClass
public
void
setUp
()
{
visitorAuth
();
agentAuth
();
}
//代理人分享直播链接
@Test
(
description
=
"分享直播间"
,
priority
=
1
)
public
void
分享直播间
()
{
Map
<
String
,
Object
>
signParam
=
new
HashMap
<>();
signParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
signParam
.
put
(
"shareType"
,
1
);
Response
signRes
=
network
.
getResponse
(
signParam
,
BasicConfig
.
MOBILE_GETSHARESIGN
);
HashMap
data
=
signRes
.
jsonPath
().
getJsonObject
(
"data"
);
this
.
shareSign
=
(
String
)
data
.
get
(
"shareSign"
);
System
.
out
.
println
(
shareSign
);
Assert
.
assertNotNull
(
shareSign
,
network
.
message
(
signParam
,
BasicConfig
.
MOBILE_GETSHARESIGN
,
"分享失败"
,
signRes
.
body
().
asString
()));
}
//访客与代理人建立绑定关系
@Test
(
description
=
"邀请关系绑定"
,
priority
=
2
)
public
void
邀请关系绑定
()
{
Map
<
String
,
Object
>
bindingParam
=
new
HashMap
<>();
bindingParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
bindingParam
.
put
(
"shareType"
,
shareSign
);
Response
bindingRes
=
network
.
postResponse
(
bindingParam
,
BasicConfig
.
MOBILE_BINDING
);
boolean
success
=
bindingRes
.
jsonPath
().
getJsonObject
(
"success"
);
System
.
out
.
println
(
success
);
Assert
.
assertTrue
(
success
,
network
.
message
(
bindingParam
,
BasicConfig
.
MOBILE_BINDING
,
"绑定失败"
,
bindingRes
.
body
().
asString
()));
}
@Test
(
description
=
"预约直播间"
,
priority
=
1
)
@Test
(
description
=
"预约直播间"
,
priority
=
3
)
public
void
预约直播间
()
{
Map
<
String
,
Object
>
sycParam
=
new
HashMap
<>();
sycParam
.
put
(
"bizId"
,
"Kj21MTg0NzE"
);
sycParam
.
put
(
"bizId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
())
);
sycParam
.
put
(
"bizType"
,
1
);
List
<
Long
>
markIds1
=
new
ArrayList
<>();
markIds1
.
add
(
142L
);
...
...
@@ -35,11 +64,10 @@ public class User implements AdminAuthorization{
Assert
.
assertNotNull
(
data
,
network
.
message
(
sycParam
,
BasicConfig
.
USER_SYCAPPOINTMENT
,
"预约失败"
,
sycRes
.
body
().
asString
()));
}
@Test
(
description
=
"关注直播间"
,
priority
=
2
)
@Test
(
description
=
"关注直播间"
,
priority
=
4
)
public
void
关注直播间
()
{
Map
<
String
,
Object
>
subscribeParam
=
new
HashMap
<>();
subscribeParam
.
put
(
"live
id"
,
"Kj21MTg0NzE"
);
subscribeParam
.
put
(
"live
Id"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
())
);
List
<
Long
>
markIds2
=
new
ArrayList
<>();
markIds2
.
add
(
146L
);
markIds2
.
add
(
144L
);
...
...
@@ -50,27 +78,38 @@ public class User implements AdminAuthorization{
Assert
.
assertTrue
(
data
,
network
.
message
(
subscribeParam
,
BasicConfig
.
USER_SUBSCRIBE
,
"关注失败"
,
subscribeRes
.
body
().
asString
()));
}
@Test
(
description
=
"查询关注状态"
,
priority
=
3
)
@Test
(
description
=
"查询关注状态"
,
priority
=
5
)
public
void
查询关注状态
()
{
Map
<
String
,
Object
>
findParam
=
new
HashMap
<>();
findParam
.
put
(
"live
id"
,
"Kj21MTg0Nzk"
);
Response
findRes
=
network
.
pos
tResponse
(
findParam
,
BasicConfig
.
USER_FIND
);
findParam
.
put
(
"live
Id"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
())
);
Response
findRes
=
network
.
ge
tResponse
(
findParam
,
BasicConfig
.
USER_FIND
);
boolean
data
=
findRes
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
findParam
,
BasicConfig
.
USER_FIND
,
"关注失败"
,
findRes
.
body
().
asString
()));
}
@Test
(
description
=
"保存海报获得抽奖码"
,
priority
=
4
)
@Test
(
description
=
"保存海报获得抽奖码"
,
priority
=
6
)
public
void
保存海报获得抽奖码
()
{
Map
<
String
,
Object
>
saveposterParam
=
new
HashMap
<>();
saveposterParam
.
put
(
"liveid"
,
"Kj21MTg0Nzk"
);
Response
saveposterRes
=
network
.
postResponse
(
saveposterParam
,
BasicConfig
.
USER_SAVEPOSTER
);
boolean
data
=
saveposterRes
.
jsonPath
().
getBoolean
(
"data"
);
Map
<
String
,
Object
>
savePosterParam
=
new
HashMap
<>();
savePosterParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
savePosterRes
=
network
.
postResponse
(
savePosterParam
,
BasicConfig
.
USER_SAVEPOSTER
);
boolean
data
=
savePosterRes
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
savePosterParam
,
BasicConfig
.
USER_SAVEPOSTER
,
"海报保存失败"
,
savePosterRes
.
body
().
asString
()));
}
@Test
(
description
=
"我的抽奖码数量"
,
priority
=
7
)
public
void
我的抽奖码数量
()
{
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
.
assert
True
(
data
,
network
.
message
(
saveposterParam
,
BasicConfig
.
USER_SAVEPOSTER
,
"海报保存失败"
,
saveposter
Res
.
body
().
asString
()));
Assert
.
assert
NotNull
(
data
,
network
.
message
(
myCountParam
,
BasicConfig
.
USER_MYCOUNT
,
"获取抽奖码数量失败"
,
myCount
Res
.
body
().
asString
()));
}
}
}
src/test/java/com/kjj/config/BasicConfig.java
View file @
1b9741b2
...
...
@@ -49,6 +49,7 @@ public class BasicConfig {
public
static
final
String
USER_DRAW
=
MOBILE_HOST
+
"/kjy/live/user/lottery/draw"
;
public
static
final
String
USER_END
=
MOBILE_HOST
+
"/kjy/live/assist/lottery/end"
;
public
static
final
String
USER_SAVEPOSTER
=
MOBILE_HOST
+
"/kjy/live/user/share/savePoster"
;
public
static
final
String
USER_MYCOUNT
=
MOBILE_HOST
+
"/kjy/live/user/lottery/myCount"
;
// *************** 直播管理端 ***************
public
static
final
String
MANAGER_SAVEANDUPDATE
=
MANAGER_HOST
+
"/kjy/manager/live/pre/conf/saveAndUpdate"
;
...
...
src/test/java/com/kjj/utils/IdMakeUtil.java
View file @
1b9741b2
package
com
.
kjj
.
utils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
java.util.Base64
;
...
...
src/test/liveTestNG.xml
View file @
1b9741b2
...
...
@@ -20,17 +20,23 @@
<!-- </classes>-->
<!-- </test>-->
<test
preserve-order=
"true"
name=
"助播-开启直播
"
>
<test
preserve-order=
"true"
name=
"访客券码领取
"
>
<classes>
<class
name=
"com.kjj.cases.live.OpenLive
"
/>
<class
name=
"com.kjj.cases.live.User
"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"助播-结束直播"
>
<classes>
<class
name=
"com.kjj.cases.live.CloseLive"
/>
</classes>
</test>
<!-- <test preserve-order="true" name="助播-开启直播">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.OpenLive"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="助播-结束直播">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.CloseLive"/>-->
<!-- </classes>-->
<!-- </test>-->
...
...
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