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
accbf776
Commit
accbf776
authored
Sep 07, 2021
by
xiamengchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
直播中测试覆盖
parent
a5d6daf8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
826 additions
and
4 deletions
+826
-4
EvaluationDetail.java
src/test/java/com/kjj/bean/manager/EvaluationDetail.java
+35
-0
EvaluationList.java
src/test/java/com/kjj/bean/manager/EvaluationList.java
+10
-0
LiveMaterial.java
...test/java/com/kjj/cases/live/liveConfig/LiveMaterial.java
+775
-4
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+6
-0
No files found.
src/test/java/com/kjj/bean/manager/EvaluationDetail.java
0 → 100644
View file @
accbf776
package
com
.
kjj
.
bean
.
manager
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
EvaluationDetail
{
private
String
evaluationTitle
;
private
long
id
;
private
List
<
Questions
>
questions
;
private
List
<
Results
>
results
;
@Data
public
class
Questions
{
private
long
evaluationId
;
private
long
id
;
private
List
<
Options
>
options
;
private
String
questionTitle
;
private
int
questionType
;
@Data
public
class
Options
{
private
long
id
;
private
String
optionTitle
;
private
long
questionId
;
}
}
@Data
public
class
Results
{
private
long
evaluationId
;
private
long
id
;
}
}
src/test/java/com/kjj/bean/manager/EvaluationList.java
0 → 100644
View file @
accbf776
package
com
.
kjj
.
bean
.
manager
;
import
lombok.Data
;
@Data
public
class
EvaluationList
{
private
int
evaluationStatus
;
private
String
evaluationTitle
;
private
long
id
;
}
src/test/java/com/kjj/cases/live/liveConfig/LiveMaterial.java
View file @
accbf776
package
com
.
kjj
.
cases
.
live
.
liveConfig
;
import
com.alibaba.fastjson.JSON
;
import
com.kjj.bean.manager.VoteBean
;
import
com.kjj.bean.manager.VoteListBean
;
import
com.kjj.bean.manager.WelfareBean
;
import
com.kjj.bean.manager.WelfareListBean
;
import
com.kjj.bean.manager.*
;
import
com.kjj.bean.secondKill.KillGoodsList
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.cases.live.question.Question
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.JsonUtil
;
import
groovy.util.Eval
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
...
...
@@ -17,6 +16,11 @@ import org.testng.annotations.Test;
import
java.util.*
;
public
class
LiveMaterial
implements
Authorization
{
private
final
String
evaluationBGPhoto
=
"https://yun.dui88.com/kjy/image/20210907/1630997281863.png"
;
private
final
String
resultPhoto
=
"https://yun.dui88.com/kjy/image/20210907/1630997534648.jpg"
;
private
final
String
resourcePic
=
"https://yun.kjjcrm.com/kjy/image/20210907/1631015006914.jpeg"
;
private
final
long
companyId
=
101
;
private
long
evaluationId
;
@BeforeClass
public
void
setUp
()
{
...
...
@@ -353,6 +357,773 @@ public class LiveMaterial implements Authorization {
}
}
/**
* 新版直播中测试
* 配置测试
*/
@Test
(
description
=
"新增测试"
,
priority
=
15
)
public
void
新增测试
()
{
/**
* 配置题目
*/
List
<
Object
>
questions
=
new
ArrayList
<>();
Map
<
String
,
Object
>
question
=
new
HashMap
<>();
List
<
Object
>
options
=
new
ArrayList
<>();
Map
<
String
,
Object
>
option
=
new
HashMap
<>();
List
<
Object
>
results
=
new
ArrayList
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 第一题的第一个选项
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题的第二个选项
option
.
clear
();
System
.
out
.
println
(
option
);
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"单选题"
);
question
.
put
(
"questionType"
,
1
);
questions
.
add
(
question
);
// 第二题第一个选项
options
.
clear
();
option
.
clear
();
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
// 第二题第二个选项
option
.
clear
();
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
// 第二题
question
.
clear
();
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"多选题"
);
question
.
put
(
"questionType"
,
2
);
questions
.
add
(
question
);
// 第一个结果
result
.
put
(
"endScore"
,
1
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
1
);
results
.
add
(
result
);
// 第二个结果
result
.
clear
();
result
.
put
(
"endScore"
,
2
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
2
);
results
.
add
(
result
);
Map
<
String
,
Object
>
addEvaluationPar
=
new
HashMap
<>();
addEvaluationPar
.
put
(
"backgroundPic"
,
evaluationBGPhoto
);
addEvaluationPar
.
put
(
"companyId"
,
companyId
);
addEvaluationPar
.
put
(
"defaultResultPic"
,
resultPhoto
);
addEvaluationPar
.
put
(
"evaluationTitle"
,
"原测试标题"
);
addEvaluationPar
.
put
(
"questions"
,
questions
);
addEvaluationPar
.
put
(
"results"
,
results
);
Response
addEvaluationRes
=
network
.
postResponse
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
);
try
{
boolean
data
=
addEvaluationRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
,
"新增测试失败"
,
addEvaluationRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
,
"获取数据失败"
,
addEvaluationRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"获取测试列表"
,
priority
=
16
)
public
void
获取测试列表
()
{
Map
<
String
,
Object
>
evaListPar
=
new
HashMap
<>();
evaListPar
.
put
(
"companyId"
,
companyId
);
Response
evaListRes
=
network
.
getResponse
(
evaListPar
,
BasicConfig
.
MANAGER_evaluation_list
);
try
{
List
<
EvaluationList
>
evaluationLists
=
JsonUtil
.
parseResponseToPageBean
(
evaListRes
,
EvaluationList
.
class
);
// 判断测试列表排列顺序
boolean
isDesc
=
true
;
for
(
int
i
=
0
;
i
<
evaluationLists
.
size
()
-
1
;
i
++){
long
id
=
evaluationLists
.
get
(
i
).
getId
();
if
(
id
<=
evaluationLists
.
get
(
i
+
1
).
getId
()){
isDesc
=
false
;
}
}
if
(
isDesc
){
EvaluationList
evaluationList
=
evaluationLists
.
get
(
0
);
String
title
=
evaluationList
.
getEvaluationTitle
();
Assert
.
assertEquals
(
title
,
"原测试标题"
,
network
.
message
(
evaListPar
,
BasicConfig
.
MANAGER_evaluation_list
,
"新增测试标题有误"
,
evaListRes
.
body
().
asString
()));
int
status
=
evaluationList
.
getEvaluationStatus
();
Assert
.
assertEquals
(
status
,
1
,
network
.
message
(
evaListPar
,
BasicConfig
.
MANAGER_evaluation_list
,
"新增测试默认状态非已停用状态"
,
evaListRes
.
body
().
asString
()));
evaluationId
=
evaluationList
.
getId
();
}
else
{
Assert
.
fail
(
network
.
message
(
evaListPar
,
BasicConfig
.
MANAGER_evaluation_list
,
"测试列表排列顺序错误"
,
evaListRes
.
body
().
asString
()));
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
evaListPar
,
BasicConfig
.
MANAGER_evaluation_list
,
"获取数据错误"
,
evaListRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"启用前编辑测试"
,
priority
=
17
)
public
void
启用前编辑测试
()
{
/**
* 启用前测试可以修改题目、选项、结果数量
*/
List
<
Object
>
questions
=
new
ArrayList
<>();
Map
<
String
,
Object
>
question
=
new
HashMap
<>();
List
<
Object
>
options
=
new
ArrayList
<>();
Map
<
String
,
Object
>
option
=
new
HashMap
<>();
List
<
Object
>
results
=
new
ArrayList
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
option
.
clear
();
System
.
out
.
println
(
option
);
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题新增一个选项
option
.
clear
();
option
.
put
(
"optionScore"
,
3
);
option
.
put
(
"optionTitle"
,
"选项3"
);
options
.
add
(
option
);
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"单选题"
);
question
.
put
(
"questionType"
,
1
);
questions
.
add
(
question
);
options
.
clear
();
option
.
clear
();
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
option
.
clear
();
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
question
.
clear
();
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"多选题"
);
question
.
put
(
"questionType"
,
2
);
questions
.
add
(
question
);
// 新增一个题目
options
.
clear
();
option
.
clear
();
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
option
.
clear
();
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
question
.
clear
();
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"第三道题(单选)"
);
question
.
put
(
"questionType"
,
1
);
questions
.
add
(
question
);
result
.
put
(
"endScore"
,
1
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
1
);
results
.
add
(
result
);
result
.
clear
();
result
.
put
(
"endScore"
,
2
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
2
);
results
.
add
(
result
);
// 增加一个分数段(修改结果数量)
result
.
clear
();
result
.
put
(
"endScore"
,
3
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
3
);
results
.
add
(
result
);
// 修改测试标题(文案内容可修改)
Map
<
String
,
Object
>
addEvaluationPar
=
new
HashMap
<>();
addEvaluationPar
.
put
(
"backgroundPic"
,
evaluationBGPhoto
);
addEvaluationPar
.
put
(
"companyId"
,
companyId
);
addEvaluationPar
.
put
(
"defaultResultPic"
,
resultPhoto
);
addEvaluationPar
.
put
(
"evaluationTitle"
,
"启用前编辑标题"
);
addEvaluationPar
.
put
(
"questions"
,
questions
);
addEvaluationPar
.
put
(
"results"
,
results
);
Response
addEvaluationRes
=
network
.
postResponse
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
);
try
{
boolean
data
=
addEvaluationRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
,
"编辑测试失败"
,
addEvaluationRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
,
"获取数据失败"
,
addEvaluationRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"查看测试详情"
,
priority
=
17
)
public
void
查看测试详情
()
{
Map
<
String
,
Object
>
evaDetailPar
=
new
HashMap
<>();
evaDetailPar
.
put
(
"id"
,
evaluationId
);
Response
evaDetailRes
=
network
.
getResponse
(
evaDetailPar
,
BasicConfig
.
MANAGER_evaluation_detail
);
try
{
EvaluationDetail
evaluationDetail
=
JsonUtil
.
parseResponseToBean
(
evaDetailRes
,
EvaluationDetail
.
class
);
int
questionNum
=
evaluationDetail
.
getQuestions
().
size
();
Assert
.
assertEquals
(
questionNum
,
3
,
network
.
message
(
evaDetailPar
,
BasicConfig
.
MANAGER_evaluation_detail
,
"增加题目数量未成功"
,
evaDetailRes
.
body
().
asString
()));
EvaluationDetail
.
Questions
question1
=
evaluationDetail
.
getQuestions
().
get
(
0
);
int
optionNum
=
question1
.
getOptions
().
size
();
Assert
.
assertEquals
(
optionNum
,
3
,
network
.
message
(
evaDetailPar
,
BasicConfig
.
MANAGER_evaluation_detail
,
"增加选项数量失败"
,
evaDetailRes
.
body
().
asString
()));
int
resultNum
=
evaluationDetail
.
getResults
().
size
();
Assert
.
assertEquals
(
resultNum
,
3
,
network
.
message
(
evaDetailPar
,
BasicConfig
.
MANAGER_evaluation_detail
,
"增加结果数量失败"
,
evaDetailRes
.
body
().
asString
()));
String
title
=
evaluationDetail
.
getEvaluationTitle
();
Assert
.
assertEquals
(
title
,
"启用前编辑标题"
,
network
.
message
(
evaDetailPar
,
BasicConfig
.
MANAGER_evaluation_detail
,
"修改测试标题失败"
,
evaDetailRes
.
body
().
asString
()));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
evaDetailPar
,
BasicConfig
.
MANAGER_evaluation_detail
,
"获取数据失败"
,
evaDetailRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"启用测试"
,
priority
=
18
)
public
void
启用测试
()
{
Map
<
String
,
Object
>
evaEnablePar
=
new
HashMap
<>();
evaEnablePar
.
put
(
"id"
,
evaluationId
);
Response
evaEnableRes
=
network
.
postResponse
(
evaEnablePar
,
BasicConfig
.
MANAGER_evaluation_enable
);
try
{
boolean
data
=
evaEnableRes
.
jsonPath
().
getBoolean
(
"data"
);
Assert
.
assertTrue
(
data
,
network
.
message
(
evaEnablePar
,
BasicConfig
.
MANAGER_evaluation_enable
,
"启用测试失败"
,
evaEnableRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
evaEnablePar
,
BasicConfig
.
MANAGER_evaluation_enable
,
"获取数据失败"
,
evaEnableRes
.
body
().
asString
()));
}
}
/**
* 启用后编辑测试
*/
@Test
(
description
=
"启用后修改选项分数"
,
priority
=
19
)
public
void
启用后修改选项分数
()
{
List
<
Object
>
questions
=
new
ArrayList
<>();
Map
<
String
,
Object
>
question
=
new
HashMap
<>();
List
<
Object
>
options
=
new
ArrayList
<>();
Map
<
String
,
Object
>
option
=
new
HashMap
<>();
List
<
Object
>
results
=
new
ArrayList
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 第一题的第一个选项
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题的第二个选项
option
.
clear
();
System
.
out
.
println
(
option
);
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"单选题"
);
question
.
put
(
"questionType"
,
1
);
questions
.
add
(
question
);
// 第二题第一个选项
options
.
clear
();
option
.
clear
();
option
.
put
(
"optionScore"
,
10
);
// 改动选项分数
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
// 第二题第二个选项
option
.
clear
();
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
// 第二题
question
.
clear
();
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"多选题"
);
question
.
put
(
"questionType"
,
2
);
questions
.
add
(
question
);
// 第一个结果
result
.
put
(
"endScore"
,
1
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
1
);
results
.
add
(
result
);
// 第二个结果
result
.
clear
();
result
.
put
(
"endScore"
,
2
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
2
);
results
.
add
(
result
);
Map
<
String
,
Object
>
addEvaluationPar
=
new
HashMap
<>();
addEvaluationPar
.
put
(
"backgroundPic"
,
evaluationBGPhoto
);
addEvaluationPar
.
put
(
"companyId"
,
companyId
);
addEvaluationPar
.
put
(
"defaultResultPic"
,
resultPhoto
);
addEvaluationPar
.
put
(
"evaluationTitle"
,
"原测试标题"
);
addEvaluationPar
.
put
(
"questions"
,
questions
);
addEvaluationPar
.
put
(
"results"
,
results
);
Response
addEvaluationRes
=
network
.
postResponse
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
);
try
{
// boolean data = addEvaluationRes.jsonPath().getBoolean("data");
// Assert.assertTrue(data, network.message(addEvaluationPar, BasicConfig.MANAGER_evaluation_save, "新增测试失败", addEvaluationRes.body().asString()));
System
.
out
.
println
(
addEvaluationRes
.
body
().
asString
());
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
,
"获取数据失败"
,
addEvaluationRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"启用后修改选项数量"
,
priority
=
20
)
public
void
启用后修改选项数量
()
{
List
<
Object
>
questions
=
new
ArrayList
<>();
Map
<
String
,
Object
>
question
=
new
HashMap
<>();
List
<
Object
>
options
=
new
ArrayList
<>();
Map
<
String
,
Object
>
option
=
new
HashMap
<>();
List
<
Object
>
results
=
new
ArrayList
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 第一题的第一个选项(只保留一个选项)
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"单选题"
);
question
.
put
(
"questionType"
,
1
);
questions
.
add
(
question
);
// 第二题第一个选项
options
.
clear
();
option
.
clear
();
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
// 第二题第二个选项
option
.
clear
();
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
// 第二题
question
.
clear
();
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"多选题"
);
question
.
put
(
"questionType"
,
2
);
questions
.
add
(
question
);
// 第一个结果
result
.
put
(
"endScore"
,
1
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
1
);
results
.
add
(
result
);
// 第二个结果
result
.
clear
();
result
.
put
(
"endScore"
,
2
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
2
);
results
.
add
(
result
);
Map
<
String
,
Object
>
addEvaluationPar
=
new
HashMap
<>();
addEvaluationPar
.
put
(
"backgroundPic"
,
evaluationBGPhoto
);
addEvaluationPar
.
put
(
"companyId"
,
companyId
);
addEvaluationPar
.
put
(
"defaultResultPic"
,
resultPhoto
);
addEvaluationPar
.
put
(
"evaluationTitle"
,
"原测试标题"
);
addEvaluationPar
.
put
(
"questions"
,
questions
);
addEvaluationPar
.
put
(
"results"
,
results
);
Response
addEvaluationRes
=
network
.
postResponse
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
);
try
{
// boolean data = addEvaluationRes.jsonPath().getBoolean("data");
// Assert.assertTrue(data, network.message(addEvaluationPar, BasicConfig.MANAGER_evaluation_save, "新增测试失败", addEvaluationRes.body().asString()));
System
.
out
.
println
(
addEvaluationRes
.
body
().
asString
());
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
,
"获取数据失败"
,
addEvaluationRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"启用后修改题目数量"
,
priority
=
21
)
public
void
启用后修改题目数量
()
{
List
<
Object
>
questions
=
new
ArrayList
<>();
Map
<
String
,
Object
>
question
=
new
HashMap
<>();
List
<
Object
>
options
=
new
ArrayList
<>();
Map
<
String
,
Object
>
option
=
new
HashMap
<>();
List
<
Object
>
results
=
new
ArrayList
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 第一题的第一个选项
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题的第二个选项
option
.
clear
();
System
.
out
.
println
(
option
);
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"单选题"
);
question
.
put
(
"questionType"
,
1
);
questions
.
add
(
question
);
// ---只配置一个题目---
// 第一个结果
result
.
put
(
"endScore"
,
1
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
1
);
results
.
add
(
result
);
// 第二个结果
result
.
clear
();
result
.
put
(
"endScore"
,
2
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
2
);
results
.
add
(
result
);
Map
<
String
,
Object
>
addEvaluationPar
=
new
HashMap
<>();
addEvaluationPar
.
put
(
"backgroundPic"
,
evaluationBGPhoto
);
addEvaluationPar
.
put
(
"companyId"
,
companyId
);
addEvaluationPar
.
put
(
"defaultResultPic"
,
resultPhoto
);
addEvaluationPar
.
put
(
"evaluationTitle"
,
"原测试标题"
);
addEvaluationPar
.
put
(
"questions"
,
questions
);
addEvaluationPar
.
put
(
"results"
,
results
);
Response
addEvaluationRes
=
network
.
postResponse
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
);
try
{
// boolean data = addEvaluationRes.jsonPath().getBoolean("data");
// Assert.assertTrue(data, network.message(addEvaluationPar, BasicConfig.MANAGER_evaluation_save, "新增测试失败", addEvaluationRes.body().asString()));
System
.
out
.
println
(
addEvaluationRes
.
body
().
asString
());
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
,
"获取数据失败"
,
addEvaluationRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"启用后修改结果数量"
,
priority
=
22
)
public
void
启用后修改结果数量
(){
List
<
Object
>
questions
=
new
ArrayList
<>();
Map
<
String
,
Object
>
question
=
new
HashMap
<>();
List
<
Object
>
options
=
new
ArrayList
<>();
Map
<
String
,
Object
>
option
=
new
HashMap
<>();
List
<
Object
>
results
=
new
ArrayList
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 第一题的第一个选项
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题的第二个选项
option
.
clear
();
System
.
out
.
println
(
option
);
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"单选题"
);
question
.
put
(
"questionType"
,
1
);
questions
.
add
(
question
);
// 第二题第一个选项
options
.
clear
();
option
.
clear
();
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
// 第二题第二个选项
option
.
clear
();
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
// 第二题
question
.
clear
();
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"多选题"
);
question
.
put
(
"questionType"
,
2
);
questions
.
add
(
question
);
// 第一个结果
result
.
put
(
"endScore"
,
1
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
1
);
results
.
add
(
result
);
// 删除第二个结果
Map
<
String
,
Object
>
addEvaluationPar
=
new
HashMap
<>();
addEvaluationPar
.
put
(
"backgroundPic"
,
evaluationBGPhoto
);
addEvaluationPar
.
put
(
"companyId"
,
companyId
);
addEvaluationPar
.
put
(
"defaultResultPic"
,
resultPhoto
);
addEvaluationPar
.
put
(
"evaluationTitle"
,
"原测试标题"
);
addEvaluationPar
.
put
(
"questions"
,
questions
);
addEvaluationPar
.
put
(
"results"
,
results
);
Response
addEvaluationRes
=
network
.
postResponse
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
);
try
{
// boolean data = addEvaluationRes.jsonPath().getBoolean("data");
// Assert.assertTrue(data, network.message(addEvaluationPar, BasicConfig.MANAGER_evaluation_save, "新增测试失败", addEvaluationRes.body().asString()));
System
.
out
.
println
(
addEvaluationRes
.
body
().
asString
());
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
,
"获取数据失败"
,
addEvaluationRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"启用后修改分数段"
,
priority
=
23
)
public
void
启用后修改分数段
()
{
List
<
Object
>
questions
=
new
ArrayList
<>();
Map
<
String
,
Object
>
question
=
new
HashMap
<>();
List
<
Object
>
options
=
new
ArrayList
<>();
Map
<
String
,
Object
>
option
=
new
HashMap
<>();
List
<
Object
>
results
=
new
ArrayList
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 第一题的第一个选项
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题的第二个选项
option
.
clear
();
System
.
out
.
println
(
option
);
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"单选题"
);
question
.
put
(
"questionType"
,
1
);
questions
.
add
(
question
);
// 第二题第一个选项
options
.
clear
();
option
.
clear
();
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
// 第二题第二个选项
option
.
clear
();
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
// 第二题
question
.
clear
();
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"多选题"
);
question
.
put
(
"questionType"
,
2
);
questions
.
add
(
question
);
// 第一个结果
result
.
put
(
"endScore"
,
10
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
20
);
// 修改分数段
results
.
add
(
result
);
// 第二个结果
result
.
clear
();
result
.
put
(
"endScore"
,
2
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
2
);
results
.
add
(
result
);
Map
<
String
,
Object
>
addEvaluationPar
=
new
HashMap
<>();
addEvaluationPar
.
put
(
"backgroundPic"
,
evaluationBGPhoto
);
addEvaluationPar
.
put
(
"companyId"
,
companyId
);
addEvaluationPar
.
put
(
"defaultResultPic"
,
resultPhoto
);
addEvaluationPar
.
put
(
"evaluationTitle"
,
"原测试标题"
);
addEvaluationPar
.
put
(
"questions"
,
questions
);
addEvaluationPar
.
put
(
"results"
,
results
);
Response
addEvaluationRes
=
network
.
postResponse
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
);
try
{
// boolean data = addEvaluationRes.jsonPath().getBoolean("data");
// Assert.assertTrue(data, network.message(addEvaluationPar, BasicConfig.MANAGER_evaluation_save, "新增测试失败", addEvaluationRes.body().asString()));
System
.
out
.
println
(
addEvaluationRes
.
body
().
asString
());
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
,
"获取数据失败"
,
addEvaluationRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"启用后修改结果图"
,
priority
=
24
)
public
void
启用后修改结果图
()
{
List
<
Object
>
questions
=
new
ArrayList
<>();
Map
<
String
,
Object
>
question
=
new
HashMap
<>();
List
<
Object
>
options
=
new
ArrayList
<>();
Map
<
String
,
Object
>
option
=
new
HashMap
<>();
List
<
Object
>
results
=
new
ArrayList
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 第一题的第一个选项
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题的第二个选项
option
.
clear
();
System
.
out
.
println
(
option
);
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
System
.
out
.
println
(
options
);
// 第一题
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"单选题"
);
question
.
put
(
"questionType"
,
1
);
questions
.
add
(
question
);
// 第二题第一个选项
options
.
clear
();
option
.
clear
();
option
.
put
(
"optionScore"
,
1
);
option
.
put
(
"optionTitle"
,
"选项1"
);
options
.
add
(
option
);
// 第二题第二个选项
option
.
clear
();
option
.
put
(
"optionScore"
,
2
);
option
.
put
(
"optionTitle"
,
"选项2"
);
options
.
add
(
option
);
// 第二题
question
.
clear
();
question
.
put
(
"options"
,
options
);
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
"多选题"
);
question
.
put
(
"questionType"
,
2
);
questions
.
add
(
question
);
// 第一个结果
result
.
put
(
"endScore"
,
1
);
result
.
put
(
"resultPic"
,
evaluationBGPhoto
);
// 修改结果图
result
.
put
(
"startScore"
,
1
);
results
.
add
(
result
);
// 第二个结果
result
.
clear
();
result
.
put
(
"endScore"
,
2
);
result
.
put
(
"resultPic"
,
resultPhoto
);
result
.
put
(
"startScore"
,
2
);
results
.
add
(
result
);
Map
<
String
,
Object
>
addEvaluationPar
=
new
HashMap
<>();
addEvaluationPar
.
put
(
"backgroundPic"
,
evaluationBGPhoto
);
addEvaluationPar
.
put
(
"companyId"
,
companyId
);
addEvaluationPar
.
put
(
"defaultResultPic"
,
resultPhoto
);
addEvaluationPar
.
put
(
"evaluationTitle"
,
"原测试标题"
);
addEvaluationPar
.
put
(
"questions"
,
questions
);
addEvaluationPar
.
put
(
"results"
,
results
);
Response
addEvaluationRes
=
network
.
postResponse
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
);
try
{
// boolean data = addEvaluationRes.jsonPath().getBoolean("data");
// Assert.assertTrue(data, network.message(addEvaluationPar, BasicConfig.MANAGER_evaluation_save, "新增测试失败", addEvaluationRes.body().asString()));
System
.
out
.
println
(
addEvaluationRes
.
body
().
asString
());
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
addEvaluationPar
,
BasicConfig
.
MANAGER_evaluation_save
,
"获取数据失败"
,
addEvaluationRes
.
body
().
asString
()));
}
}
/**
* 配置权益关联测试
*/
@Test
(
description
=
"获取当前已启用测试"
,
priority
=
25
)
public
void
获取当前已启用测试
()
{
Map
<
String
,
Object
>
getEnablePar
=
new
HashMap
<>();
getEnablePar
.
put
(
"companyId"
,
companyId
);
Response
getEnableRes
=
network
.
getResponse
(
getEnablePar
,
BasicConfig
.
MANAGER_evaluation_getEnable
);
try
{
boolean
hasTarget
=
false
;
List
<
Map
<
String
,
Object
>>
evaEnableList
=
getEnableRes
.
jsonPath
().
getList
(
"data"
);
if
(
evaEnableList
.
size
()
>
0
){
for
(
Map
<
String
,
Object
>
evaEnable
:
evaEnableList
){
long
id
=
(
long
)
evaEnable
.
get
(
"id"
);
if
(
id
==
evaluationId
){
hasTarget
=
true
;
}
}
}
else
{
Assert
.
fail
(
network
.
message
(
getEnablePar
,
BasicConfig
.
MANAGER_evaluation_getEnable
,
"未获取到公司已启用测试"
,
getEnableRes
.
body
().
asString
()));
}
if
(!
hasTarget
){
Assert
.
fail
(
network
.
message
(
getEnablePar
,
BasicConfig
.
MANAGER_evaluation_getEnable
,
"未获取到全部已启用测试"
,
getEnableRes
.
body
().
asString
()));
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
getEnablePar
,
BasicConfig
.
MANAGER_evaluation_getEnable
,
"获取数据失败"
,
getEnableRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"添加测试权益"
,
priority
=
26
)
public
void
添加测试权益
()
{
Map
<
String
,
Object
>
addEvaResourcePar
=
new
HashMap
<>();
addEvaResourcePar
.
put
(
"companyId"
,
companyId
);
addEvaResourcePar
.
put
(
"evaluationId"
,
evaluationId
);
addEvaResourcePar
.
put
(
"resourceButtonTitle"
,
"这是按钮"
);
addEvaResourcePar
.
put
(
"resourceImg"
,
resultPhoto
);
addEvaResourcePar
.
put
(
"resourceSubTitle"
,
"这是描述内容"
);
addEvaResourcePar
.
put
(
"resourceTitle"
,
"测试权益"
);
Response
addEvaResourceRes
=
network
.
postResponse
(
addEvaResourcePar
,
BasicConfig
.
MANAGER_evaluation_saveEvaResource
);
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
()));
}
}
@Test
(
description
=
"获取权益列表"
,
priority
=
27
)
public
void
获取权益列表
()
{
// 查看添加结果
Map
<
String
,
Object
>
resourceListPar
=
new
HashMap
<>();
resourceListPar
.
put
(
"companyId"
,
companyId
);
resourceListPar
.
put
(
"resourceTypeList"
,
23
);
// 资料列表新增枚举类型23-直播测试,单独筛选测试权益结果
Response
resourceListRes
=
network
.
getResponse
(
resourceListPar
,
BasicConfig
.
MANAGER_resourceList
);
try
{
int
totalCount
=
resourceListRes
.
jsonPath
().
getInt
(
"data.totalCount"
);
Assert
.
assertTrue
(
totalCount
>
0
,
network
.
message
(
resourceListPar
,
BasicConfig
.
MANAGER_resourceList
,
"获取公司测试权益失败"
,
resourceListRes
.
body
().
asString
()));
List
<
Map
<
String
,
Object
>>
resources
=
resourceListRes
.
jsonPath
().
getList
(
"data.list"
);
Map
<
String
,
Object
>
resource
=
resources
.
get
(
0
);
// 新增测试添加在列表头部
int
type
=
(
int
)
resource
.
get
(
"resourceType"
);
Assert
.
assertEquals
(
type
,
23
,
network
.
message
(
resourceListPar
,
BasicConfig
.
MANAGER_resourceList
,
"该权益类型不是测试"
,
resourceListRes
.
body
().
asString
()));
String
title
=
(
String
)
resource
.
get
(
"resourceTitle"
);
Assert
.
assertEquals
(
title
,
"测试权益"
,
network
.
message
(
resourceListPar
,
BasicConfig
.
MANAGER_resourceList
,
"权益列表首行记录标题错误"
,
resourceListRes
.
body
().
asString
()));
}
catch
(
NullPointerException
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
resourceListPar
,
BasicConfig
.
MANAGER_resourceList
,
"获取数据失败"
,
resourceListRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"直播前_编辑测试权益"
,
priority
=
28
)
public
void
直播前
_
编辑测试权益
()
{
}
}
src/test/java/com/kjj/config/BasicConfig.java
View file @
accbf776
...
...
@@ -612,6 +612,12 @@ public class BasicConfig {
public
static
final
String
MANAGER_saveForm
=
MANAGER_HOST
+
"/kjy/manager/live/resource/saveOrUpdateForm"
;
public
static
final
String
MANAGER_saveFree
=
MANAGER_HOST
+
"/kjy/manager/live/resource/saveOrUpdateFree"
;
public
static
final
String
MANAGER_saveTest
=
MANAGER_HOST
+
"/kjy/manager/live/resource/saveOrUpdateTest"
;
public
static
final
String
MANAGER_evaluation_save
=
MANAGER_HOST
+
"/kjy/manager/live/evaluation/saveOrUpdate"
;
public
static
final
String
MANAGER_evaluation_list
=
MANAGER_HOST
+
"/kjy/manager/live/evaluation/list"
;
public
static
final
String
MANAGER_evaluation_detail
=
MANAGER_HOST
+
"/kjy/manager/live/evaluation/detail"
;
public
static
final
String
MANAGER_evaluation_enable
=
MANAGER_HOST
+
"/kjy/manager/live/evaluation/enable"
;
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_teamList
=
MANAGER_HOST
+
"/kjy/manager/live/company/team/teamList"
;
...
...
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