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
8b758343
Commit
8b758343
authored
Sep 11, 2021
by
xiamengchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
直播中测试完善
parent
cd75062f
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
503 additions
and
64 deletions
+503
-64
LiveVisitor.java
src/test/java/com/kjj/bean/resources/LiveVisitor.java
+1
-0
ResourceForm.java
src/test/java/com/kjj/bean/resources/ResourceForm.java
+1
-0
ResourceFree.java
src/test/java/com/kjj/bean/resources/ResourceFree.java
+1
-0
LiveVisitors.java
src/test/java/com/kjj/cases/live/anchor/LiveVisitors.java
+258
-25
EvaluationConf.java
...st/java/com/kjj/cases/live/liveConfig/EvaluationConf.java
+92
-5
LiveMaterial.java
...test/java/com/kjj/cases/live/liveConfig/LiveMaterial.java
+113
-10
SaveLive.java
src/test/java/com/kjj/cases/live/liveConfig/SaveLive.java
+2
-0
Lottery.java
src/test/java/com/kjj/cases/live/lottery/Lottery.java
+2
-2
LotteryCode.java
...test/java/com/kjj/cases/live/lotteryCode/LotteryCode.java
+2
-2
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+4
-0
IdMakeUtil.java
src/test/java/com/kjj/utils/IdMakeUtil.java
+2
-0
liveTestNG.xml
src/test/liveTestNG.xml
+25
-20
No files found.
src/test/java/com/kjj/bean/resources/LiveVisitor.java
View file @
8b758343
...
...
@@ -17,4 +17,5 @@ public class LiveVisitor {
private
String
testType
;
private
boolean
hasPasterOn
;
private
boolean
hasConfPaster
;
private
String
evaluationId
;
}
src/test/java/com/kjj/bean/resources/ResourceForm.java
View file @
8b758343
...
...
@@ -11,6 +11,7 @@ public class ResourceForm {
private
String
banner
;
private
List
<
FieldList
>
fieldList
;
private
String
received
;
private
String
evaluationId
;
@Data
public
static
class
FieldList
...
...
src/test/java/com/kjj/bean/resources/ResourceFree.java
View file @
8b758343
...
...
@@ -23,4 +23,5 @@ public class ResourceFree {
private
int
outLinkType
;
private
String
outLinkAppId
;
private
String
formBanner
;
private
String
evaluationId
;
}
src/test/java/com/kjj/cases/live/anchor/LiveVisitors.java
View file @
8b758343
...
...
@@ -2,21 +2,23 @@ package com.kjj.cases.live.anchor;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.kjj.bean.manager.EvaluationDetail
;
import
com.kjj.bean.resources.*
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.live.liveConfig.EvaluationConf
;
import
com.kjj.cases.live.liveConfig.LiveMaterial
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.constants.LiveConstants
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.IdMakeUtil
;
import
com.kjj.utils.JsonUtil
;
import
com.kjj.utils.ThreadSleepUtils
;
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
;
import
java.util.*
;
public
class
LiveVisitors
implements
Authorization
{
...
...
@@ -24,6 +26,10 @@ public class LiveVisitors implements Authorization
public
String
confId_form
;
public
String
confId_link
;
public
String
confId_free
;
public
String
confId_eva
;
public
String
confId_formWithEva
;
public
String
confId_freeWithEva
;
public
String
encodeEvaluationId
;
public
String
id
;
public
List
<
ResourcePushList
>
PushList
;
public
static
String
resourceReceiveRecordId
;
...
...
@@ -70,19 +76,32 @@ public class LiveVisitors implements Authorization
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_Resource
);
System
.
out
.
println
(
params
);
System
.
out
.
println
(
response
.
body
().
asString
());
encodeEvaluationId
=
IdMakeUtil
.
managerEncodingId
(
LiveMaterial
.
evaluationId
);
List
<
LiveVisitor
>
liveVisitors
=
JsonUtil
.
parseResponseToListBean
(
response
,
LiveVisitor
.
class
);
LiveVisitor
one
=
liveVisitors
.
get
(
0
);
System
.
out
.
println
(
one
.
getConfId
());
confId_imageText
=
one
.
getConfId
();
LiveVisitor
two
=
liveVisitors
.
get
(
2
);
LiveVisitor
two
=
liveVisitors
.
get
(
3
);
System
.
out
.
println
(
two
.
getConfId
());
confId_free
=
two
.
getConfId
();
LiveVisitor
three
=
liveVisitors
.
get
(
3
);
LiveVisitor
three
=
liveVisitors
.
get
(
4
);
System
.
out
.
println
(
three
.
getConfId
());
confId_form
=
three
.
getConfId
();
LiveVisitor
five
=
liveVisitors
.
get
(
4
);
LiveVisitor
five
=
liveVisitors
.
get
(
5
);
System
.
out
.
println
(
five
.
getConfId
());
confId_link
=
five
.
getConfId
();
LiveVisitor
seven
=
liveVisitors
.
get
(
7
);
String
evaId
=
seven
.
getEvaluationId
();
Assert
.
assertEquals
(
evaId
,
encodeEvaluationId
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_Resource
,
"测试权益关联测试ID错误"
,
response
.
body
().
asString
()));
confId_eva
=
seven
.
getConfId
();
LiveVisitor
eight
=
liveVisitors
.
get
(
8
);
String
evaId2
=
eight
.
getEvaluationId
();
Assert
.
assertEquals
(
evaId2
,
encodeEvaluationId
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_Resource
,
"关联测试表单权益关联测试ID错误"
,
response
.
body
().
asString
()));
confId_formWithEva
=
eight
.
getConfId
();
LiveVisitor
nine
=
liveVisitors
.
get
(
9
);
String
evaId3
=
nine
.
getEvaluationId
();
Assert
.
assertEquals
(
evaId3
,
encodeEvaluationId
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_Resource
,
"关联测试免费领权益关联测试ID错误"
,
response
.
body
().
asString
()));
confId_freeWithEva
=
nine
.
getConfId
();
System
.
out
.
println
(
liveVisitors
);
Assert
.
assertNotNull
(
liveVisitors
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_Resource
,
"查询权益列表失败"
,
response
.
body
().
asString
()));
}
...
...
@@ -173,8 +192,151 @@ public class LiveVisitors implements Authorization
resourceReceiveRecordId
=
response
.
jsonPath
().
getString
(
"data"
);
}
// @Test(description = "代理人参与测试", priority = 9)
// public void 代理人参与测试() {
// agentAuth();
//
// System.out.println(evaDetailRes.body().asString());
// }
/*访客端参与测试权益*/
@Test
(
description
=
"访客端获取测试权益详情"
,
priority
=
10
)
public
void
访客端获取测试权益详情
()
{
visitorAuth
();
Map
<
String
,
Object
>
evaDetailPar
=
new
HashMap
<>();
evaDetailPar
.
put
(
"confId"
,
confId_eva
);
evaDetailPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
evaDetailRes
=
network
.
getResponse
(
evaDetailPar
,
BasicConfig
.
MOBILE_evaluationDetail
);
System
.
out
.
println
(
evaDetailRes
.
body
().
asString
());
try
{
String
evaId
=
evaDetailRes
.
jsonPath
().
getString
(
"data.evaluationId"
);
Assert
.
assertEquals
(
evaId
,
encodeEvaluationId
,
network
.
message
(
evaDetailPar
,
BasicConfig
.
MOBILE_evaluationDetail
,
"测试权益关联测试ID错误"
,
evaDetailRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
evaDetailPar
,
BasicConfig
.
MOBILE_evaluationDetail
,
"获取数据失败"
,
evaDetailRes
.
body
().
asString
()));
}
}
/**
* 访客端提交测试结果
*/
@Test
(
description
=
"单选题提交多个选项"
,
priority
=
11
)
public
void
单选题提交多个选项
()
{
Map
<
String
,
Object
>
submitPar
=
getEvaSubmitPar
(
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()),
confId_eva
,
LiveMaterial
.
evaluationId
,
LiveMaterial
.
getEvaDetails
(
LiveMaterial
.
evaluationId
).
getQuestions
().
size
(),
2
,
false
,
true
);
Response
submitRes
=
network
.
postResponse
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
);
try
{
boolean
success
=
submitRes
.
jsonPath
().
getBoolean
(
"success"
);
System
.
out
.
println
(
submitRes
.
body
().
asString
());
Assert
.
assertFalse
(
success
,
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"提交错误答案成功"
,
submitRes
.
body
().
asString
()));
Assert
.
assertEquals
(
submitRes
.
jsonPath
().
getString
(
"desc"
),
"提交参数异常"
,
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"错误原因不符"
,
submitRes
.
body
().
asString
()));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"获取数据异常"
,
submitRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"未提交所有问题答案"
,
priority
=
12
)
public
void
未提交所有问题答案
()
{
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
submitPar
=
getEvaSubmitPar
(
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()),
confId_eva
,
LiveMaterial
.
evaluationId
,
LiveMaterial
.
getEvaDetails
(
LiveMaterial
.
evaluationId
).
getQuestions
().
size
()
-
1
,
1
,
false
,
true
);
Response
submitRes
=
network
.
postResponse
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
);
try
{
boolean
success
=
submitRes
.
jsonPath
().
getBoolean
(
"success"
);
System
.
out
.
println
(
submitRes
.
body
().
asString
());
Assert
.
assertFalse
(
success
,
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"提交错误答案成功"
,
submitRes
.
body
().
asString
()));
Assert
.
assertEquals
(
submitRes
.
jsonPath
().
getString
(
"desc"
),
"提交参数异常"
,
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"错误原因不符"
,
submitRes
.
body
().
asString
()));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"获取数据异常"
,
submitRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"提交不匹配的问题和答案"
,
priority
=
13
)
public
void
提交不匹配的问题和答案
()
{
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
submitPar
=
getEvaSubmitPar
(
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()),
confId_eva
,
LiveMaterial
.
evaluationId
,
LiveMaterial
.
getEvaDetails
(
LiveMaterial
.
evaluationId
).
getQuestions
().
size
(),
1
,
true
,
true
);
Response
submitRes
=
network
.
postResponse
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
);
try
{
boolean
success
=
submitRes
.
jsonPath
().
getBoolean
(
"success"
);
System
.
out
.
println
(
submitRes
.
body
().
asString
());
// Assert.assertFalse(success, network.message(submitPar, BasicConfig.MOBILE_evaluationSubmit, "提交错误答案成功", submitRes.body().asString()));
// Assert.assertEquals(submitRes.jsonPath().getString("desc"), "提交参数异常", network.message(submitPar, BasicConfig.MOBILE_evaluationSubmit, "错误原因不符", submitRes.body().asString()));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"获取数据异常"
,
submitRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"不提交选项"
,
priority
=
14
)
public
void
不提交选项
()
{
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
submitPar
=
getEvaSubmitPar
(
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()),
confId_eva
,
LiveMaterial
.
evaluationId
,
LiveMaterial
.
getEvaDetails
(
LiveMaterial
.
evaluationId
).
getQuestions
().
size
(),
1
,
false
,
false
);
Response
submitRes
=
network
.
postResponse
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
);
try
{
boolean
success
=
submitRes
.
jsonPath
().
getBoolean
(
"success"
);
System
.
out
.
println
(
submitRes
.
body
().
asString
());
Assert
.
assertFalse
(
success
,
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"提交错误答案成功"
,
submitRes
.
body
().
asString
()));
Assert
.
assertEquals
(
submitRes
.
jsonPath
().
getString
(
"desc"
),
"提交参数异常"
,
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"错误原因不符"
,
submitRes
.
body
().
asString
()));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"获取数据异常"
,
submitRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"正常提交答案"
,
priority
=
15
)
public
void
正常提交答案
()
{
ThreadSleepUtils
.
sleep
(
3000
);
Map
<
String
,
Object
>
submitPar
=
getEvaSubmitPar
(
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()),
confId_eva
,
LiveMaterial
.
evaluationId
,
LiveMaterial
.
getEvaDetails
(
LiveMaterial
.
evaluationId
).
getQuestions
().
size
(),
1
,
false
,
true
);
Response
submitRes
=
network
.
postResponse
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
);
try
{
Map
<
String
,
String
>
data
=
submitRes
.
jsonPath
().
getMap
(
"data"
);
String
result
=
data
.
get
(
"resultPic"
);
Assert
.
assertNotNull
(
result
,
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"返回结果为空"
,
submitRes
.
body
().
asString
()));
Assert
.
assertEquals
(
result
,
LiveMaterial
.
resultPhoto
,
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"返回结果图错误"
,
submitRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
submitPar
,
BasicConfig
.
MOBILE_evaluationSubmit
,
"获取数据失败"
,
submitRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客端获取关联测试表单权益详情"
,
priority
=
14
)
public
void
访客端获取关联测试表单权益详情
()
{
visitorAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"confId"
,
confId_formWithEva
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_Form
);
System
.
out
.
println
(
response
.
body
().
asString
());
try
{
ResourceForm
agentBeans
=
JsonUtil
.
parseResponseToBean
(
response
,
ResourceForm
.
class
);
String
evaId
=
agentBeans
.
getEvaluationId
();
Assert
.
assertEquals
(
evaId
,
encodeEvaluationId
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_Form
,
"表单权益关联测试ID错误"
,
response
.
body
().
asString
()));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
params
,
BasicConfig
.
MOBILE_Form
,
"获取数据失败"
,
response
.
body
().
asString
()));
}
}
@Test
(
description
=
"访客端获取关联测试免费领权益详情"
,
priority
=
15
)
public
void
访客端获取关联测试免费领权益详情
()
{
visitorAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"confId"
,
confId_free
);
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ResourceFindDetailByConfid
);
System
.
out
.
println
(
response
.
body
().
asString
());
try
{
ResourceFree
agentBeans
=
JsonUtil
.
parseResponseToBean
(
response
,
ResourceFree
.
class
);
String
evaId
=
agentBeans
.
getEvaluationId
();
Assert
.
assertEquals
(
evaId
,
encodeEvaluationId
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ResourceFindDetailByConfid
,
"免费领权益关联测试ID错误"
,
response
.
body
().
asString
()));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
params
,
BasicConfig
.
MOBILE_ResourceFindDetailByConfid
,
"获取数据失败"
,
response
.
body
().
asString
()));
}
}
/*访客端链接小程序资料-查询*/
@Test
(
description
=
"访客端链接资料查询"
,
priority
=
9
)
@Test
(
description
=
"访客端链接资料查询"
,
priority
=
16
)
public
void
访客端链接小程序资料查询
()
{
visitorAuth
();
...
...
@@ -188,7 +350,7 @@ public class LiveVisitors implements Authorization
}
/*访客端链接资料资料-领取*/
@Test
(
description
=
"访客端链接资料领取"
,
priority
=
1
0
)
@Test
(
description
=
"访客端链接资料领取"
,
priority
=
1
7
)
public
void
访客端链接小程序资料领取
()
{
visitorAuth
();
...
...
@@ -201,7 +363,7 @@ public class LiveVisitors implements Authorization
}
/*代理人端权益列表查询*/
@Test
(
description
=
"代理人端权益列表查询"
,
priority
=
1
1
)
@Test
(
description
=
"代理人端权益列表查询"
,
priority
=
1
8
)
public
void
代理人端权益列表查询
()
{
agentAuth
();
...
...
@@ -215,7 +377,7 @@ public class LiveVisitors implements Authorization
}
//代理人端图文资料查询
@Test
(
description
=
"代理人端图文资料查询"
,
priority
=
1
2
)
@Test
(
description
=
"代理人端图文资料查询"
,
priority
=
1
9
)
public
void
代理人端图文资料查询
()
{
agentAuth
();
...
...
@@ -229,7 +391,7 @@ public class LiveVisitors implements Authorization
}
//代理人端表单资料查询
@Test
(
description
=
"代理人端表单资料查询"
,
priority
=
13
)
@Test
(
description
=
"代理人端表单资料查询"
,
priority
=
20
)
public
ResourceForm
代理人端表单资料查询
()
{
agentAuth
();
...
...
@@ -243,7 +405,7 @@ public class LiveVisitors implements Authorization
}
/*代理人端免费领资料-查询*/
@Test
(
description
=
"代理人端免费领资料查询"
,
priority
=
14
)
@Test
(
description
=
"代理人端免费领资料查询"
,
priority
=
21
)
public
void
代理人端免费领资料查询
()
{
agentAuth
();
...
...
@@ -257,7 +419,7 @@ public class LiveVisitors implements Authorization
}
//代理人端小程序链接资料查询
@Test
(
description
=
"代理人端小程序链接资料查询"
,
priority
=
15
)
@Test
(
description
=
"代理人端小程序链接资料查询"
,
priority
=
22
)
public
void
代理人端小程序链接资料查询
()
{
agentAuth
();
...
...
@@ -271,7 +433,7 @@ public class LiveVisitors implements Authorization
}
//助播端编辑权益
@Test
(
description
=
"助播端编辑权益"
,
priority
=
16
)
@Test
(
description
=
"助播端编辑权益"
,
priority
=
23
)
public
void
助播端编辑权益
()
{
adminAuth
();
...
...
@@ -284,36 +446,37 @@ public class LiveVisitors implements Authorization
Assert
.
assertNotNull
(
list
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ResourceEdit
,
"编辑主播端权益列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"上架贴片"
,
priority
=
17
)
@Test
(
description
=
"上架贴片"
,
priority
=
24
)
public
void
上架贴片
()
{
adminAuth
();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
this
.
PushList
.
get
(
4
).
getConfId
());
params
.
put
(
"confId"
,
this
.
PushList
.
get
(
5
).
getConfId
());
Response
response
=
network
.
postResponse
(
params
,
BasicConfig
.
MOBILE_pasterOn
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_pasterOn
,
"贴片上架失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取推送列表"
,
priority
=
18
)
@Test
(
description
=
"获取推送列表"
,
priority
=
25
)
public
void
获取推送列表
()
{
adminAuth
();
ThreadSleepUtils
.
sleep
(
1000
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
params
.
put
(
"confId"
,
this
.
PushList
.
get
(
4
).
getConfId
());
params
.
put
(
"confId"
,
this
.
PushList
.
get
(
5
).
getConfId
());
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ResourceList
);
List
<
LiveVisitor
>
liveVisitors
=
JsonUtil
.
parseResponseToListBean
(
response
,
LiveVisitor
.
class
);
LiveVisitor
form
=
liveVisitors
.
get
(
4
);
System
.
out
.
println
(
liveVisitors
);
LiveVisitor
form
=
liveVisitors
.
get
(
5
);
boolean
isHasConfPaster
=
form
.
isHasConfPaster
();
System
.
out
.
println
(
response
.
body
().
asString
());
Assert
.
assertTrue
(
isHasConfPaster
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ResourceList
,
"获取列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"访客获取贴片信息"
,
priority
=
19
)
@Test
(
description
=
"访客获取贴片信息"
,
priority
=
26
)
public
void
访客获取贴片信息
()
{
ThreadSleepUtils
.
sleep
(
1000
);
...
...
@@ -325,7 +488,7 @@ public class LiveVisitors implements Authorization
Assert
.
assertNotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_pasterInfo
,
"访客未获取到贴片信息"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"贴片下架"
,
priority
=
2
0
)
@Test
(
description
=
"贴片下架"
,
priority
=
2
7
)
public
void
贴片下架
()
{
adminAuth
();
...
...
@@ -342,7 +505,7 @@ public class LiveVisitors implements Authorization
* 资料-我要咨询
*/
@Test
(
description
=
"资料咨询时客户标记同意"
,
priority
=
2
1
)
@Test
(
description
=
"资料咨询时客户标记同意"
,
priority
=
2
8
)
public
void
资料咨询时客户标记同意
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
...
...
@@ -357,7 +520,7 @@ public class LiveVisitors implements Authorization
}
@Test
(
description
=
"获取访客跟进机会同意状态"
,
priority
=
2
2
)
@Test
(
description
=
"获取访客跟进机会同意状态"
,
priority
=
2
9
)
public
void
获取访客跟进机会同意状态
()
{
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
...
...
@@ -370,7 +533,7 @@ public class LiveVisitors implements Authorization
}
@Test
(
description
=
"访客端获取直播间实时数据"
,
priority
=
23
)
@Test
(
description
=
"访客端获取直播间实时数据"
,
priority
=
30
)
public
void
访客端获取直播间实时数据
(){
Map
<
String
,
Object
>
clueInfoDataPar
=
new
HashMap
<>();
clueInfoDataPar
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
...
...
@@ -379,4 +542,74 @@ public class LiveVisitors implements Authorization
Object
data
=
clueInfoDataRes
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
clueInfoDataPar
,
BasicConfig
.
USER_clueInfoData
,
"获取直播间实时数据失败"
,
clueInfoDataRes
.
body
().
asString
()));
}
/**
*
* @param liveId 直播ID
* @param confId 测试关联的素材ID
* @param evaId 测试ID
* @param quesNum 要回答的题目数量
* @param optNum 该题目的选项数量
* @param toChange 是否需要题目-选项的不匹配对应
* @param hasOpt 为false时传null
* @return 可作为/clue/evaluation/submit接口的入参
*/
public
Map
<
String
,
Object
>
getEvaSubmitPar
(
String
liveId
,
String
confId
,
long
evaId
,
int
quesNum
,
int
optNum
,
boolean
toChange
,
boolean
hasOpt
)
{
// 获取所有的题目及对应选项
Map
<
String
,
List
<
String
>>
qAndA
=
new
HashMap
<>();
List
<
Map
<
String
,
Object
>>
userAnswers
=
new
ArrayList
<>();
try
{
EvaluationDetail
evaluationDetail
=
LiveMaterial
.
getEvaDetails
(
evaId
);
for
(
EvaluationDetail
.
Questions
questions
:
evaluationDetail
.
getQuestions
()){
List
<
String
>
opt
=
new
ArrayList
<>();
for
(
EvaluationDetail
.
Questions
.
Options
options
:
questions
.
getOptions
()){
opt
.
add
(
IdMakeUtil
.
managerEncodingId
(
options
.
getId
()));
}
qAndA
.
put
(
IdMakeUtil
.
managerEncodingId
(
questions
.
getId
()),
opt
);
}
// 构造目标答案
for
(
int
i
=
0
;
i
<
quesNum
;
i
++){
Map
<
String
,
Object
>
userAnswer
=
new
HashMap
<>();
List
<
Map
<
String
,
String
>>
answerContents
=
new
ArrayList
<>();
try
{
// 利用迭代器获取键值列表
List
<
String
>
quesLis
=
new
ArrayList
<>();
Iterator
it
=
qAndA
.
entrySet
().
iterator
();
while
(
it
.
hasNext
()){
Map
.
Entry
entry
=
(
Map
.
Entry
)
it
.
next
();
String
ques
=
(
String
)
entry
.
getKey
();
quesLis
.
add
(
ques
);
}
String
quesId
=
quesLis
.
get
(
i
);
List
<
String
>
opts
=
qAndA
.
get
(
quesId
);
if
(
toChange
){
opts
=
qAndA
.
get
(
quesLis
.
get
(
quesLis
.
size
()
-
i
-
1
));
}
for
(
int
z
=
0
;
z
<
optNum
;
z
++){
Map
<
String
,
String
>
answerContent
=
new
HashMap
<>();
answerContent
.
put
(
"optionId"
,
opts
.
get
(
z
));
answerContents
.
add
(
answerContent
);
}
if
(!
hasOpt
){
answerContents
=
null
;
}
userAnswer
.
put
(
"questionId"
,
quesId
);
userAnswer
.
put
(
"answerContents"
,
answerContents
);
userAnswers
.
add
(
userAnswer
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
Map
<
String
,
Object
>
evaSubmitPar
=
new
HashMap
<>();
evaSubmitPar
.
put
(
"liveId"
,
liveId
);
evaSubmitPar
.
put
(
"confId"
,
confId
);
evaSubmitPar
.
put
(
"answers"
,
userAnswers
);
System
.
out
.
println
(
evaSubmitPar
);
return
evaSubmitPar
;
}
}
src/test/java/com/kjj/cases/live/liveConfig/EvaluationConf.java
View file @
8b758343
...
...
@@ -7,15 +7,102 @@ import com.kjj.utils.BaseUtils;
import
com.kjj.utils.JsonUtil
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
public
class
EvaluationConf
implements
Authorization
{
private
static
final
String
resultPhoto
=
"https://yun.dui88.com/kjy/image/20210907/1630997534648.jpg"
;
private
static
Map
<
String
,
Object
>
params
;
private
static
final
long
companyId
=
139
;
private
static
final
long
companyId
=
101
;
/**
* 开启直播后修改权益关联测试ID
*/
@Test
(
description
=
"直播中修改权益关联测试ID"
,
priority
=
1
)
public
void
直播中修改权益关联测试
ID
()
{
// 测试
Map
<
String
,
Object
>
addEvaResourcePar
=
new
HashMap
<>();
addEvaResourcePar
.
put
(
"companyId"
,
companyId
);
addEvaResourcePar
.
put
(
"evaluationId"
,
92
);
// 修改测试ID
addEvaResourcePar
.
put
(
"id"
,
LiveMaterial
.
resourceId
);
addEvaResourcePar
.
put
(
"resourceButtonTitle"
,
"这是按钮"
);
addEvaResourcePar
.
put
(
"resourceImg"
,
resultPhoto
);
addEvaResourcePar
.
put
(
"resourceSubTitle"
,
"这是描述内容"
);
addEvaResourcePar
.
put
(
"resourceTitle"
,
"编辑后测试权益标题"
);
addEvaResourcePar
.
put
(
"resourceType"
,
23
);
Response
addEvaResourceRes
=
network
.
postResponse
(
addEvaResourcePar
,
BasicConfig
.
MANAGER_evaluation_saveEvaResource
);
System
.
out
.
println
(
addEvaResourceRes
.
body
().
asString
());
// try {
// boolean data = addEvaResourceRes.jsonPath().getBoolean("data");
// Assert.assertTrue(data, network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "编辑测试权益失败", addEvaResourceRes.body().asString()));
// }catch (NullPointerException e){
// e.printStackTrace();
// Assert.fail(network.message(addEvaResourcePar, BasicConfig.MANAGER_evaluation_saveEvaResource, "获取数据失败", addEvaResourceRes.body().asString()));
// }
// 表单
Map
<
String
,
Object
>
formParam
=
new
HashMap
<>();
formParam
.
put
(
"companyId"
,
companyId
);
formParam
.
put
(
"evaluationId"
,
92
);
formParam
.
put
(
"id"
,
LiveMaterial
.
termResourceId
);
formParam
.
put
(
"resourceTitle"
,
"表单关联测试"
);
formParam
.
put
(
"resourceButtonTitle"
,
"我要报名"
);
formParam
.
put
(
"resourcePicturesArr"
,
Arrays
.
asList
(
"https://yun.dui88.com/kjy/image/20210306/1615033326937.jpg"
));
formParam
.
put
(
"resourceImg"
,
"https://yun.dui88.com/kjy/image/20210306/1615033315608.jpeg"
);
formParam
.
put
(
"formBanner"
,
"https://yun.dui88.com/kjy/image/20210306/1615033326937.jpg"
);
formParam
.
put
(
"fieldIds"
,
"1,2"
);
Response
formRes
=
network
.
postResponse
(
formParam
,
BasicConfig
.
MANAGER_saveForm
);
System
.
out
.
println
(
formRes
.
body
().
asString
());
// 免费领
Map
<
String
,
Object
>
freeParam
=
new
HashMap
<>();
freeParam
.
put
(
"companyId"
,
companyId
);
freeParam
.
put
(
"evaluationId"
,
92
);
freeParam
.
put
(
"id"
,
LiveMaterial
.
freeResourceId
);
freeParam
.
put
(
"resourceTitle"
,
"免费领关联测试"
);
freeParam
.
put
(
"resourceButtonTitle"
,
"领取资料"
);
freeParam
.
put
(
"resourcePicturesArr"
,
Arrays
.
asList
(
"https://yun.dui88.com/kjy/image/20210306/1615033326937.jpg"
));
freeParam
.
put
(
"resourceImg"
,
"https://yun.dui88.com/kjy/image/20210306/1615033315608.jpeg"
);
freeParam
.
put
(
"resourcePictures"
,
"https://yun.dui88.com/kjy/image/20210306/1615039670425.jpg"
);
Response
FreeRes
=
network
.
postResponse
(
freeParam
,
BasicConfig
.
MANAGER_saveFree
);
System
.
out
.
println
(
FreeRes
.
body
().
asString
());
// 图文
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"companyId"
,
companyId
);
Params
.
put
(
"evaluationId"
,
92
);
Params
.
put
(
"id"
,
LiveMaterial
.
picResourceId
);
Params
.
put
(
"resourceTitle"
,
"图文资料2"
);
Params
.
put
(
"resourceButtonTitle"
,
"我要报名"
);
Params
.
put
(
"resourceImg"
,
"https://yun.dui88.com/kjy/image/20210306/1615023456356.jpeg"
);
Params
.
put
(
"resourcePictures"
,
"https://yun.dui88.com/kjy/image/20210306/1615023476770.jpeg"
);
Params
.
put
(
"resourcePicturesArr"
,
"https://yun.dui88.com/kjy/image/20210306/1615023476770.jpeg"
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_resource
);
System
.
out
.
println
(
response
.
body
().
asString
());
}
@Test
(
description
=
"删除权益"
,
priority
=
2
)
public
void
删除权益
()
{
for
(
int
resourceId
:
Arrays
.
asList
(
LiveMaterial
.
resourceId
,
LiveMaterial
.
termResourceId
,
LiveMaterial
.
freeResourceId
,
LiveMaterial
.
picResourceId
)){
System
.
out
.
println
(
resourceId
);
Map
<
String
,
Object
>
delResourceParam
=
new
HashMap
<>();
delResourceParam
.
put
(
"id"
,
resourceId
);
Response
delResourceRes
=
network
.
postResponse
(
delResourceParam
,
BasicConfig
.
MANAGER_delResource
);
try
{
boolean
data
=
delResourceRes
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
delResourceParam
,
BasicConfig
.
MANAGER_delResource
,
"删除权益失败"
,
delResourceRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
delResourceParam
,
BasicConfig
.
MANAGER_delResource
,
"获取数据失败"
,
delResourceRes
.
body
().
asString
()));
}
}
}
// 初始化params
public
static
Map
<
String
,
Object
>
initParams
()
{
...
...
src/test/java/com/kjj/cases/live/liveConfig/LiveMaterial.java
View file @
8b758343
...
...
@@ -14,10 +14,13 @@ import java.util.*;
public
class
LiveMaterial
implements
Authorization
{
private
static
final
String
evaluationBGPhoto
=
"https://yun.dui88.com/kjy/image/20210907/1630997281863.png"
;
private
static
final
String
resultPhoto
=
"https://yun.dui88.com/kjy/image/20210907/1630997534648.jpg"
;
private
final
long
companyId
=
139
;
private
long
evaluationId
;
public
static
int
resourceId
;
public
static
final
String
resultPhoto
=
"https://yun.dui88.com/kjy/image/20210907/1630997534648.jpg"
;
private
final
long
companyId
=
101
;
public
static
long
evaluationId
;
// 测试id
public
static
int
resourceId
;
// 测试权益ID
public
static
Integer
termResourceId
=
null
;
// 关联测试表单权益ID
public
static
Integer
freeResourceId
=
null
;
// 关联测试免费领权益ID
public
static
Integer
picResourceId
=
null
;
// 关联测试图文权益ID
@BeforeClass
public
void
setUp
()
{
...
...
@@ -261,6 +264,8 @@ public class LiveMaterial implements Authorization {
Assert
.
assertEquals
(
status
,
1
,
network
.
message
(
evaListPar
,
BasicConfig
.
MANAGER_evaluation_list
,
"新增测试默认状态非已停用状态"
,
evaListRes
.
body
().
asString
()));
evaluationId
=
evaluationList
.
getId
();
// System.out.println("evaluationList.getId():"+evaluationList.getId());
// System.out.println("evaluationId:"+evaluationId);
}
else
{
Assert
.
fail
(
network
.
message
(
evaListPar
,
BasicConfig
.
MANAGER_evaluation_list
,
"测试列表排列顺序错误"
,
evaListRes
.
body
().
asString
()));
}
...
...
@@ -528,7 +533,7 @@ public class LiveMaterial implements Authorization {
@Test
(
description
=
"获取当前已启用测试"
,
priority
=
27
)
public
void
获取当前已启用测试
()
{
Map
<
String
,
Object
>
getEnablePar
=
new
HashMap
<>();
getEnablePar
.
put
(
"companyId"
,
139
);
getEnablePar
.
put
(
"companyId"
,
companyId
);
Response
getEnableRes
=
network
.
getResponse
(
getEnablePar
,
BasicConfig
.
MANAGER_evaluation_getEnable
);
try
{
boolean
hasTarget
=
false
;
...
...
@@ -616,6 +621,20 @@ public class LiveMaterial implements Authorization {
}
}
@Test
(
description
=
"测试权益详情"
,
priority
=
31
)
public
void
测试权益详情
()
{
Map
<
String
,
Object
>
evaDetailPar
=
new
HashMap
<>();
evaDetailPar
.
put
(
"id"
,
resourceId
);
Response
evaDetailRes
=
network
.
getResponse
(
evaDetailPar
,
BasicConfig
.
MANAGER_resource_evaluationDetail
);
try
{
String
resourceTitle
=
evaDetailRes
.
jsonPath
().
getString
(
"data.resourceTitle"
);
Assert
.
assertEquals
(
resourceTitle
,
"编辑后测试权益标题"
,
network
.
message
(
evaDetailPar
,
BasicConfig
.
MANAGER_resource_evaluationDetail
,
"测试权益标题错误"
,
evaDetailRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
evaDetailPar
,
BasicConfig
.
MANAGER_resource_evaluationDetail
,
"获取数据失败"
,
evaDetailRes
.
body
().
asString
()));
}
}
/**
* 图文+表单+免费领可关联测试ID
*/
...
...
@@ -767,7 +786,7 @@ public class LiveMaterial implements Authorization {
WelfareBean
bean
=
data1
.
getList
().
get
(
0
);
Assert
.
assertNotNull
(
bean
,
network
.
message
(
form1Param
,
BasicConfig
.
MANAGER_resourceList
,
"查询免费领资料失败"
,
linkRes
.
body
().
asString
()));
//删除
表单
//删除
免费领
int
id
=
bean
.
getId
();
Map
<
String
,
Object
>
delResourceParam
=
new
HashMap
<>();
delResourceParam
.
put
(
"id"
,
id
);
...
...
@@ -778,8 +797,84 @@ public class LiveMaterial implements Authorization {
}
}
@Test
(
description
=
"创建关联测试的表单和免费领"
,
priority
=
38
)
public
void
创建关联测试的表单和免费领
()
{
// 表单
Map
<
String
,
Object
>
formParam
=
new
HashMap
<>();
formParam
.
put
(
"companyId"
,
companyId
);
formParam
.
put
(
"evaluationId"
,
evaluationId
);
formParam
.
put
(
"resourceTitle"
,
"表单关联测试"
);
formParam
.
put
(
"resourceButtonTitle"
,
"我要报名"
);
formParam
.
put
(
"resourcePicturesArr"
,
Arrays
.
asList
(
"https://yun.dui88.com/kjy/image/20210306/1615033326937.jpg"
));
formParam
.
put
(
"resourceImg"
,
"https://yun.dui88.com/kjy/image/20210306/1615033315608.jpeg"
);
formParam
.
put
(
"formBanner"
,
"https://yun.dui88.com/kjy/image/20210306/1615033326937.jpg"
);
formParam
.
put
(
"fieldIds"
,
"1,2"
);
Response
formRes
=
network
.
postResponse
(
formParam
,
BasicConfig
.
MANAGER_saveForm
);
Object
data
=
formRes
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
formParam
,
BasicConfig
.
MANAGER_saveForm
,
"新增表单失败"
,
formRes
.
body
().
asString
()));
// 免费领
Map
<
String
,
Object
>
freeParam
=
new
HashMap
<>();
freeParam
.
put
(
"companyId"
,
companyId
);
freeParam
.
put
(
"evaluationId"
,
evaluationId
);
freeParam
.
put
(
"resourceTitle"
,
"免费领关联测试"
);
freeParam
.
put
(
"resourceButtonTitle"
,
"领取资料"
);
freeParam
.
put
(
"resourcePicturesArr"
,
Arrays
.
asList
(
"https://yun.dui88.com/kjy/image/20210306/1615033326937.jpg"
));
freeParam
.
put
(
"resourceImg"
,
"https://yun.dui88.com/kjy/image/20210306/1615033315608.jpeg"
);
freeParam
.
put
(
"resourcePictures"
,
"https://yun.dui88.com/kjy/image/20210306/1615039670425.jpg"
);
System
.
out
.
println
(
freeParam
);
Response
FreeRes
=
network
.
postResponse
(
freeParam
,
BasicConfig
.
MANAGER_saveFree
);
Object
dataFree
=
FreeRes
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
dataFree
,
network
.
message
(
freeParam
,
BasicConfig
.
MANAGER_saveFree
,
"新增免费资料失败"
,
FreeRes
.
body
().
asString
()));
// 图文
Map
<
String
,
Object
>
Params
=
new
HashMap
<>();
Params
.
put
(
"companyId"
,
companyId
);
Params
.
put
(
"evaluationId"
,
evaluationId
);
Params
.
put
(
"resourceTitle"
,
"图文关联测试"
);
Params
.
put
(
"resourceButtonTitle"
,
"我要报名"
);
Params
.
put
(
"resourceImg"
,
"https://yun.dui88.com/kjy/image/20210306/1615023456356.jpeg"
);
Params
.
put
(
"resourcePictures"
,
"https://yun.dui88.com/kjy/image/20210306/1615023476770.jpeg"
);
Params
.
put
(
"resourcePicturesArr"
,
"https://yun.dui88.com/kjy/image/20210306/1615023476770.jpeg"
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_resource
);
Object
dataPic
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
Assert
.
assertNotNull
(
dataPic
,
network
.
message
(
Params
,
BasicConfig
.
MANAGER_resource
,
"新增图文权益失败"
,
response
.
body
().
asString
()));
// 拿到关联测试的表单/免费领/图文权益id
Map
<
String
,
Object
>
resourceListPar
=
new
HashMap
<>();
resourceListPar
.
put
(
"companyId"
,
companyId
);
resourceListPar
.
put
(
"resourceTypeList"
,
Arrays
.
asList
(
11
,
12
,
1
));
Response
resourceListRes
=
network
.
getResponse
(
resourceListPar
,
BasicConfig
.
MANAGER_resourceList
);
try
{
List
<
Map
<
String
,
Object
>>
resourceList
=
resourceListRes
.
jsonPath
().
getList
(
"data.list"
);
for
(
Map
<
String
,
Object
>
resource
:
resourceList
){
// 找到表单
if
(
resource
.
get
(
"resourceType"
).
equals
(
12
)){
if
(
resource
.
get
(
"resourceTitle"
).
equals
(
"表单关联测试"
)){
termResourceId
=
(
int
)
resource
.
get
(
"id"
);
}
}
else
if
(
resource
.
get
(
"resourceType"
).
equals
(
11
)){
if
(
resource
.
get
(
"resourceTitle"
).
equals
(
"免费领关联测试"
)){
freeResourceId
=
(
int
)
resource
.
get
(
"id"
);
}
}
else
if
(
resource
.
get
(
"resourceType"
).
equals
(
1
)){
if
(
resource
.
get
(
"resourceTitle"
).
equals
(
"图文关联测试"
)){
picResourceId
=
(
int
)
resource
.
get
(
"id"
);
}
}
}
Assert
.
assertNotNull
(
termResourceId
,
network
.
message
(
resourceListPar
,
BasicConfig
.
MANAGER_resourceList
,
"未获取到表单权益ID"
,
resourceListRes
.
body
().
asString
()));
Assert
.
assertNotNull
(
freeResourceId
,
network
.
message
(
resourceListPar
,
BasicConfig
.
MANAGER_resourceList
,
"未获取到表单权益ID"
,
resourceListRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
resourceListPar
,
BasicConfig
.
MANAGER_resourceList
,
"获取数据失败"
,
resourceListRes
.
body
().
asString
()));
}
}
// 删除测试
@Test
(
description
=
"停用测试"
,
priority
=
3
8
)
@Test
(
description
=
"停用测试"
,
priority
=
3
9
)
public
void
停用测试
()
{
Map
<
String
,
Object
>
stopEvaPar
=
new
HashMap
<>();
stopEvaPar
.
put
(
"id"
,
evaluationId
);
...
...
@@ -810,7 +905,7 @@ public class LiveMaterial implements Authorization {
}
}
@Test
(
description
=
"删除测试"
,
priority
=
39
)
@Test
(
description
=
"删除测试"
,
priority
=
40
)
public
void
删除测试
()
{
Map
<
String
,
Object
>
stopEvaPar
=
new
HashMap
<>();
stopEvaPar
.
put
(
"id"
,
evaluationId
);
...
...
@@ -824,12 +919,20 @@ public class LiveMaterial implements Authorization {
}
}
p
rivate
EvaluationDetail
getEvaDetails
(
long
evaluationId
)
{
p
ublic
static
EvaluationDetail
getEvaDetails
(
long
evaluationId
)
{
BaseUtils
.
ssoLogin
();
EvaluationDetail
evaluationDetail
=
null
;
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"id"
,
evaluationId
);
Response
evaDetails
=
network
.
getResponse
(
params
,
BasicConfig
.
MANAGER_evaluation_detail
);
EvaluationDetail
evaluationDetail
=
JsonUtil
.
parseResponseToBean
(
evaDetails
,
EvaluationDetail
.
class
);
try
{
evaluationDetail
=
JsonUtil
.
parseResponseToBean
(
evaDetails
,
EvaluationDetail
.
class
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
params
,
BasicConfig
.
MANAGER_evaluation_detail
,
"获取到的数据为空"
,
evaDetails
.
body
().
asString
()));
}
Assert
.
assertNotNull
(
evaluationDetail
,
network
.
message
(
params
,
BasicConfig
.
MANAGER_evaluation_detail
,
"获取到的数据为空"
,
evaDetails
.
body
().
asString
()));
return
evaluationDetail
;
}
}
...
...
src/test/java/com/kjj/cases/live/liveConfig/SaveLive.java
View file @
8b758343
...
...
@@ -171,6 +171,8 @@ public class SaveLive implements Authorization {
ids
.
add
(
new
Material
(
960L
,
0
));
ids
.
add
(
new
Material
(
3384L
,
0
));
ids
.
add
(
new
Material
(
LiveMaterial
.
resourceId
,
0
));
// 直播添加测试权益资料
ids
.
add
(
new
Material
(
LiveMaterial
.
termResourceId
,
0
));
// 直播添加表单关联测试权益
ids
.
add
(
new
Material
(
LiveMaterial
.
freeResourceId
,
0
));
// 直播添加免费领关联测试权益
Params
.
put
(
"resourceList"
,
ids
);
System
.
out
.
println
(
Params
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_saveAndUpdate_8
);
...
...
src/test/java/com/kjj/cases/live/lottery/Lottery.java
View file @
8b758343
...
...
@@ -68,7 +68,7 @@ public class Lottery implements Authorization {
Assert
.
assertTrue
(
success
,
network
.
message
(
connectSuccessParam
,
BasicConfig
.
USER_connectSuccess
,
"访客到场请求失败"
,
response
.
body
().
asString
()));
}
/*
@Test(description = "访客A抽奖查询抽奖活动弹层", priority = 5)
public void 访客A抽奖查询抽奖活动弹层() {
visitorAuth();
...
...
@@ -1473,7 +1473,7 @@ public class Lottery implements Authorization {
throw e;
}
}
*/
}
...
...
src/test/java/com/kjj/cases/live/lotteryCode/LotteryCode.java
View file @
8b758343
...
...
@@ -54,7 +54,7 @@ public class LotteryCode implements Authorization {
Assert
.
assertTrue
(
type
==
3
,
network
.
message
(
tokenParam
,
BasicConfig
.
MOBILE_Token
,
"未获取到绑定结果"
,
tokenRes
.
body
().
asString
()));
}
/*
@Test(description = "访客A获取直播所有的订阅消息模板", priority = 4)
public void 访客A获取直播所有的订阅消息模板() {
visitorAuth();
...
...
@@ -243,7 +243,7 @@ public class LotteryCode implements Authorization {
System.out.println(type);
Assert.assertTrue(type==3, network.message(tokenParam, BasicConfig.MOBILE_Token, "未获取到绑定结果", tokenRes.body().asString()));
}
*/
}
src/test/java/com/kjj/config/BasicConfig.java
View file @
8b758343
...
...
@@ -546,6 +546,8 @@ public class BasicConfig {
public
static
final
String
MOBILE_pasterInfo
=
MOBILE_HOST
+
"/clue/paster/info"
;
public
static
final
String
MOBILE_pasterOff
=
MOBILE_HOST
+
"/conf/live/push/pasterOff"
;
public
static
final
String
MOBILE_getShortUrl
=
MOBILE_HOST
+
"/kjy/live/share/short/getShortUrl"
;
public
static
final
String
MOBILE_evaluationDetail
=
MOBILE_HOST
+
"/clue/evaluation/detail"
;
public
static
final
String
MOBILE_evaluationSubmit
=
MOBILE_HOST
+
"/clue/evaluation/submit"
;
//投票
...
...
@@ -627,6 +629,8 @@ public class BasicConfig {
public
static
final
String
MANAGER_evaluation_getEnable
=
MANAGER_HOST
+
"/kjy/manager/live/evaluation/searchByTitle"
;
public
static
final
String
MANAGER_evaluation_saveEvaResource
=
MANAGER_HOST
+
"/kjy/manager/live/resource/saveOrUpdateEvaluation"
;
public
static
final
String
MANAGER_evaluation_saveEnable
=
MANAGER_HOST
+
"/kjy/manager/live/evaluation/updateEnabled"
;
public
static
final
String
MANAGER_resource_evaluationDetail
=
MANAGER_HOST
+
"/kjy/manager/live/resource/detailEvaluation"
;
public
static
final
String
MANAGER_resource_nonReceive
=
MANAGER_HOST
+
"/kjy/manager/live/resource/nonReceive"
;
//***************直播团队管理*****************
public
static
final
String
MANAGER_teamList
=
MANAGER_HOST
+
"/kjy/manager/live/company/team/teamList"
;
...
...
src/test/java/com/kjj/utils/IdMakeUtil.java
View file @
8b758343
...
...
@@ -56,7 +56,9 @@ public class IdMakeUtil implements Authorization {
BaseUtils
.
ssoLogin
();
Map
<
String
,
Object
>
ids
=
new
HashMap
<>();
ids
.
put
(
"code"
,
id
);
// System.out.println("input: "+id);
Response
encodeIdRes
=
network
.
getResponse
(
ids
,
BasicConfig
.
MANAGER_ID_ENCODE
);
// System.out.println("encodeIdRes: "+encodeIdRes.body().asString());
String
encodeId
=
encodeIdRes
.
jsonPath
().
getString
(
"data"
);
Assert
.
assertNotNull
(
encodeId
,
network
.
message
(
ids
,
BasicConfig
.
MANAGER_ID_ENCODE
,
"加密id失败"
,
encodeIdRes
.
body
().
asString
()));
return
encodeId
;
...
...
src/test/liveTestNG.xml
View file @
8b758343
...
...
@@ -41,11 +41,11 @@
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="资料贴片">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.live.liveConfig.Paster"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<test
preserve-order=
"true"
name=
"资料贴片"
>
<classes
>
<class
name=
"com.kjj.cases.live.liveConfig.Paster"
/
>
</classes
>
</test
>
<!-- <test preserve-order="true" name="代理人首页">-->
...
...
@@ -60,11 +60,11 @@
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="获取抽奖码校验">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.live.lotteryCode.LotteryCode"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<test
preserve-order=
"true"
name=
"获取抽奖码校验"
>
<classes
>
<class
name=
"com.kjj.cases.live.lotteryCode.LotteryCode"
/
>
</classes
>
</test
>
<!-- <test preserve-order="false" name="预告页">-->
<!-- <classes>-->
...
...
@@ -105,6 +105,11 @@
<class
name=
"com.kjj.cases.live.anchor.OpenLive"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"直播中编辑资料"
>
<classes>
<class
name=
"com.kjj.cases.live.liveConfig.EvaluationConf"
/>
</classes>
</test>
<!-- <test preserve-order="true" name="访客签到">-->
<!-- <classes>-->
...
...
@@ -118,11 +123,11 @@
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="直播中抽奖">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.live.lottery.Lottery"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<test
preserve-order=
"true"
name=
"直播中抽奖"
>
<classes
>
<class
name=
"com.kjj.cases.live.lottery.Lottery"
/
>
</classes
>
</test
>
<!-- <test preserve-order="true" name="秒杀互动">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.live.secondKill.SecondKill"/>-->
...
...
@@ -152,11 +157,11 @@
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="访客领取资料">--
>
<!-- <classes>--
>
<!-- <class name="com.kjj.cases.live.anchor.LiveVisitors"/>--
>
<!-- </classes>--
>
<!-- </test>--
>
<test
preserve-order=
"true"
name=
"访客领取资料"
>
<classes
>
<class
name=
"com.kjj.cases.live.anchor.LiveVisitors"
/
>
</classes
>
</test
>
<!-- <test preserve-order="true" name="红包领取">-->
<!-- <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