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
12c5a235
Commit
12c5a235
authored
Sep 09, 2021
by
xiamengchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
直播中测试_manager
parent
048eea04
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
871 additions
and
910 deletions
+871
-910
EvaluationDetail.java
src/test/java/com/kjj/bean/manager/EvaluationDetail.java
+7
-0
EvaluationConf.java
...st/java/com/kjj/cases/live/liveConfig/EvaluationConf.java
+242
-0
LiveMaterial.java
...test/java/com/kjj/cases/live/liveConfig/LiveMaterial.java
+404
-697
SaveLive.java
src/test/java/com/kjj/cases/live/liveConfig/SaveLive.java
+2
-0
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+3
-0
liveTestNG.xml
src/test/liveTestNG.xml
+213
-213
No files found.
src/test/java/com/kjj/bean/manager/EvaluationDetail.java
View file @
12c5a235
...
@@ -6,6 +6,8 @@ import java.util.List;
...
@@ -6,6 +6,8 @@ import java.util.List;
@Data
@Data
public
class
EvaluationDetail
{
public
class
EvaluationDetail
{
private
String
backgroundPic
;
private
String
defaultResultPic
;
private
String
evaluationTitle
;
private
String
evaluationTitle
;
private
long
id
;
private
long
id
;
private
List
<
Questions
>
questions
;
private
List
<
Questions
>
questions
;
...
@@ -18,10 +20,12 @@ public class EvaluationDetail {
...
@@ -18,10 +20,12 @@ public class EvaluationDetail {
private
List
<
Options
>
options
;
private
List
<
Options
>
options
;
private
String
questionTitle
;
private
String
questionTitle
;
private
int
questionType
;
private
int
questionType
;
private
int
questionRequired
;
@Data
@Data
public
class
Options
{
public
class
Options
{
private
long
id
;
private
long
id
;
private
int
optionScore
;
private
String
optionTitle
;
private
String
optionTitle
;
private
long
questionId
;
private
long
questionId
;
}
}
...
@@ -29,7 +33,10 @@ public class EvaluationDetail {
...
@@ -29,7 +33,10 @@ public class EvaluationDetail {
@Data
@Data
public
class
Results
{
public
class
Results
{
private
int
endScore
;
private
long
evaluationId
;
private
long
evaluationId
;
private
long
id
;
private
long
id
;
private
String
resultPic
;
private
int
startScore
;
}
}
}
}
src/test/java/com/kjj/cases/live/liveConfig/EvaluationConf.java
0 → 100644
View file @
12c5a235
package
com
.
kjj
.
cases
.
live
.
liveConfig
;
import
com.kjj.bean.manager.EvaluationDetail
;
import
com.kjj.cases.admin.Authorization
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.JsonUtil
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
EvaluationConf
implements
Authorization
{
private
static
Map
<
String
,
Object
>
params
;
private
static
final
long
companyId
=
139
;
// 初始化params
public
static
Map
<
String
,
Object
>
initParams
()
{
params
=
new
HashMap
<>();
return
params
;
}
public
static
Map
<
String
,
Object
>
getPar
(){
return
params
;
}
public
static
List
<
Map
<
String
,
Object
>>
getQuesList
()
{
return
(
List
<
Map
<
String
,
Object
>>)
params
.
get
(
"questions"
);
}
public
static
List
<
Map
<
String
,
Object
>>
getOptList
(
String
quesTitle
)
{
for
(
Map
<
String
,
Object
>
ques
:
getQuesList
()){
if
(
ques
.
get
(
"questionTitle"
).
equals
(
quesTitle
)){
return
(
List
<
Map
<
String
,
Object
>>)
ques
.
get
(
"options"
);
}
}
return
null
;
}
public
static
List
<
Map
<
String
,
Object
>>
getResultList
()
{
return
(
List
<
Map
<
String
,
Object
>>)
params
.
get
(
"results"
);
}
public
static
void
addOpt
(
String
quesTitle
,
String
optTitle
,
int
optScore
)
{
Map
<
String
,
Object
>
option
=
new
HashMap
<>();
option
.
put
(
"optionTitle"
,
optTitle
);
option
.
put
(
"optionScore"
,
optScore
);
getOptList
(
quesTitle
).
add
(
option
);
}
// 根据索引删除选项
public
static
void
delOpt
(
String
quesTitle
,
int
optIndex
)
{
getOptList
(
quesTitle
).
remove
(
optIndex
);
}
public
static
void
changeScore
(
String
quesTitle
,
String
optTitle
,
int
optScore
){
for
(
Map
<
String
,
Object
>
option
:
getOptList
(
quesTitle
)){
if
(
option
.
get
(
"optionTitle"
).
equals
(
optTitle
)){
option
.
replace
(
"optionScore"
,
optScore
);
}
}
}
public
static
void
addQues
(
String
quesTitle
,
int
questionType
)
{
Map
<
String
,
Object
>
question
=
new
HashMap
<>();
question
.
put
(
"options"
,
new
ArrayList
<>());
question
.
put
(
"questionRequired"
,
1
);
question
.
put
(
"questionTitle"
,
quesTitle
);
question
.
put
(
"questionType"
,
questionType
);
getQuesList
().
add
(
question
);
addOpt
(
quesTitle
,
"这是个选项"
,
1
);
addOpt
(
quesTitle
,
"第二个选项"
,
2
);
}
// 根据索引删除题目
public
static
void
delQues
(
int
quesIndex
)
{
getQuesList
().
remove
(
quesIndex
);
}
public
static
void
changeQuesTitle
(
int
quesIndex
,
String
newQuesTitle
){
getQuesList
().
get
(
quesIndex
).
replace
(
"questionTitle"
,
newQuesTitle
);
}
public
static
void
changeOptTitle
(
String
quesTitle
,
int
optIndex
,
String
newOptTitle
){
getOptList
(
quesTitle
).
get
(
optIndex
).
replace
(
"optionTitle"
,
newOptTitle
);
}
public
static
void
addResult
(
int
score
,
String
pic
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"startScore"
,
score
);
result
.
put
(
"endScore"
,
score
);
result
.
put
(
"resultPic"
,
pic
);
getResultList
().
add
(
result
);
}
// 根据索引删除结果
public
static
void
delResult
(
int
resultIndex
)
{
getResultList
().
remove
(
resultIndex
);
}
// 根据索引修改分数段起止分数
public
static
void
changeScoreFraction
(
int
resultIndex
,
int
score
){
getResultList
().
get
(
resultIndex
).
replace
(
"startScore"
,
score
);
getResultList
().
get
(
resultIndex
).
replace
(
"endScore"
,
score
);
}
public
static
List
<
Integer
>
getScoreFraction
(
int
resultIndex
){
List
<
Integer
>
scoreFraction
=
new
ArrayList
<>();
scoreFraction
.
add
((
int
)
getResultList
().
get
(
resultIndex
).
get
(
"startScore"
));
scoreFraction
.
add
((
int
)
getResultList
().
get
(
resultIndex
).
get
(
"endScore"
));
return
scoreFraction
;
}
public
static
void
changeResultPic
(
int
resultIndex
,
String
pic
){
getResultList
().
get
(
resultIndex
).
replace
(
"resultPic"
,
pic
);
}
/**
* 除了setDefault,其他参数无需配置时传null
* @param evaTitle
* @param evaBGPic
* @param defaultResultPic
* @param setDefault
*/
public
static
void
setTitleAndPic
(
String
evaTitle
,
String
evaBGPic
,
String
defaultResultPic
,
boolean
setDefault
)
{
if
(
setDefault
){
setDefault
();
}
if
(
evaTitle
!=
null
){
params
.
put
(
"evaluationTitle"
,
evaTitle
);
}
if
(
evaBGPic
!=
null
){
params
.
put
(
"backgroundPic"
,
evaBGPic
);
}
if
(
defaultResultPic
!=
null
){
params
.
put
(
"defaultResultPic"
,
defaultResultPic
);
}
}
public
static
int
getScore
(
String
quesTitle
,
String
optTitle
){
for
(
Map
<
String
,
Object
>
option
:
getOptList
(
quesTitle
)){
if
(
option
.
get
(
"optionTitle"
).
equals
(
optTitle
)){
return
(
int
)
option
.
get
(
"optionScore"
);
}
}
return
0
;
}
private
static
void
setDefault
()
{
List
<
Map
<
String
,
Object
>>
questions
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
results
=
new
ArrayList
<>();
params
.
put
(
"questions"
,
questions
);
params
.
put
(
"results"
,
results
);
params
.
put
(
"companyId"
,
companyId
);
}
// 获取当前测试详情内容拼接为saveEnable接口的参数
public
static
Map
<
String
,
Object
>
getCurDetailToPar
(
long
evaluationId
,
long
companyId
)
{
Map
<
String
,
Object
>
CurDetails
=
new
HashMap
<>();
BaseUtils
.
ssoLogin
();
Map
<
String
,
Object
>
par
=
new
HashMap
<>();
par
.
put
(
"id"
,
evaluationId
);
Response
evaDetails
=
network
.
getResponse
(
par
,
BasicConfig
.
MANAGER_evaluation_detail
);
try
{
EvaluationDetail
evaluationDetail
=
JsonUtil
.
parseResponseToBean
(
evaDetails
,
EvaluationDetail
.
class
);
String
evaluationTitle
=
evaluationDetail
.
getEvaluationTitle
();
String
defaultResultPic
=
evaluationDetail
.
getDefaultResultPic
();
List
<
EvaluationDetail
.
Results
>
resultLists
=
evaluationDetail
.
getResults
();
List
<
EvaluationDetail
.
Questions
>
questionLists
=
evaluationDetail
.
getQuestions
();
String
backgroundPic
=
evaluationDetail
.
getBackgroundPic
();
List
<
Map
<
String
,
Object
>>
quesList
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
resuList
=
new
ArrayList
<>();
// 取出每个题目重新放在Map中
for
(
EvaluationDetail
.
Questions
question
:
questionLists
){
Map
<
String
,
Object
>
ques
=
new
HashMap
<>();
long
evaId
=
question
.
getEvaluationId
();
long
id
=
question
.
getId
();
List
<
Map
<
String
,
Object
>>
optionList
=
new
ArrayList
<>();
for
(
EvaluationDetail
.
Questions
.
Options
option
:
question
.
getOptions
()){
Map
<
String
,
Object
>
opt
=
new
HashMap
<>();
long
optId
=
option
.
getId
();
int
optScore
=
option
.
getOptionScore
();
String
optTitle
=
option
.
getOptionTitle
();
long
qId
=
option
.
getQuestionId
();
opt
.
put
(
"id"
,
optId
);
opt
.
put
(
"optionScore"
,
optScore
);
opt
.
put
(
"optionTitle"
,
optTitle
);
opt
.
put
(
"questionId"
,
qId
);
optionList
.
add
(
opt
);
}
String
quesTitle
=
question
.
getQuestionTitle
();
int
quesType
=
question
.
getQuestionType
();
int
quesRequired
=
question
.
getQuestionRequired
();
ques
.
put
(
"evaluationId"
,
evaId
);
ques
.
put
(
"id"
,
id
);
ques
.
put
(
"options"
,
optionList
);
ques
.
put
(
"questionTitle"
,
quesTitle
);
ques
.
put
(
"questionType"
,
quesType
);
ques
.
put
(
"questionRequired"
,
quesRequired
);
quesList
.
add
(
ques
);
}
// 取出每个结果重新放进Map中
for
(
EvaluationDetail
.
Results
result
:
resultLists
){
Map
<
String
,
Object
>
resu
=
new
HashMap
<>();
int
endScore
=
result
.
getEndScore
();
long
eId
=
result
.
getEvaluationId
();
long
rId
=
result
.
getId
();
String
rPic
=
result
.
getResultPic
();
int
startScore
=
result
.
getStartScore
();
resu
.
put
(
"endScore"
,
endScore
);
resu
.
put
(
"evaluationId"
,
eId
);
resu
.
put
(
"id"
,
rId
);
resu
.
put
(
"resultPic"
,
rPic
);
resu
.
put
(
"startScore"
,
startScore
);
resuList
.
add
(
resu
);
}
CurDetails
.
put
(
"evaluationTitle"
,
evaluationTitle
);
CurDetails
.
put
(
"companyId"
,
companyId
);
CurDetails
.
put
(
"defaultResultPic"
,
defaultResultPic
);
CurDetails
.
put
(
"results"
,
resuList
);
CurDetails
.
put
(
"questions"
,
quesList
);
CurDetails
.
put
(
"id"
,
evaluationId
);
CurDetails
.
put
(
"backgroundPic"
,
backgroundPic
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
Assert
.
fail
(
network
.
message
(
par
,
BasicConfig
.
MANAGER_evaluation_detail
,
"获取数据失败"
,
evaDetails
.
body
().
asString
()));
}
params
=
CurDetails
;
System
.
out
.
println
(
"params的值为: "
+
params
);
return
params
;
}
}
src/test/java/com/kjj/cases/live/liveConfig/LiveMaterial.java
View file @
12c5a235
This diff is collapsed.
Click to expand it.
src/test/java/com/kjj/cases/live/liveConfig/SaveLive.java
View file @
12c5a235
...
@@ -170,7 +170,9 @@ public class SaveLive implements Authorization {
...
@@ -170,7 +170,9 @@ public class SaveLive implements Authorization {
ids
.
add
(
new
Material
(
359L
,
0
));
ids
.
add
(
new
Material
(
359L
,
0
));
ids
.
add
(
new
Material
(
960L
,
0
));
ids
.
add
(
new
Material
(
960L
,
0
));
ids
.
add
(
new
Material
(
3384L
,
0
));
ids
.
add
(
new
Material
(
3384L
,
0
));
ids
.
add
(
new
Material
(
LiveMaterial
.
resourceId
,
0
));
// 直播添加测试权益资料
Params
.
put
(
"resourceList"
,
ids
);
Params
.
put
(
"resourceList"
,
ids
);
System
.
out
.
println
(
Params
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_saveAndUpdate_8
);
Response
response
=
network
.
postResponse
(
Params
,
BasicConfig
.
MANAGER_saveAndUpdate_8
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
response
.
body
().
asString
());
System
.
out
.
println
(
response
.
body
().
asString
());
...
...
src/test/java/com/kjj/config/BasicConfig.java
View file @
12c5a235
...
@@ -622,8 +622,11 @@ public class BasicConfig {
...
@@ -622,8 +622,11 @@ public class BasicConfig {
public
static
final
String
MANAGER_evaluation_list
=
MANAGER_HOST
+
"/kjy/manager/live/evaluation/list"
;
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_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_enable
=
MANAGER_HOST
+
"/kjy/manager/live/evaluation/enable"
;
public
static
final
String
MANAGER_evaluation_stop
=
MANAGER_HOST
+
"/kjy/manager/live/evaluation/stop"
;
public
static
final
String
MANAGER_evaluation_delete
=
MANAGER_HOST
+
"/kjy/manager/live/evaluation/delete"
;
public
static
final
String
MANAGER_evaluation_getEnable
=
MANAGER_HOST
+
"/kjy/manager/live/evaluation/searchByTitle"
;
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_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_teamList
=
MANAGER_HOST
+
"/kjy/manager/live/company/team/teamList"
;
public
static
final
String
MANAGER_teamList
=
MANAGER_HOST
+
"/kjy/manager/live/company/team/teamList"
;
...
...
src/test/liveTestNG.xml
View file @
12c5a235
This diff is collapsed.
Click to expand it.
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