Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaofang li
MeterSphere
Commits
c62adcfc
Commit
c62adcfc
authored
4 years ago
by
chenjianxing
Browse files
Options
Download
Plain Diff
Merge branch 'v1.6' of
https://github.com/metersphere/metersphere
into v1.6
parents
aa53e696
ff0b2587
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java
+4
-0
.../io/metersphere/api/controller/ApiTestCaseController.java
backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java
+11
-0
...n/java/io/metersphere/api/service/ApiTestCaseService.java
backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml
+0
-6
...a/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
+10
-3
...java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanApiCaseMapper.xml
+1
-1
.../metersphere/base/mapper/ext/ExtTestPlanApiCaseMapper.xml
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml
+34
-17
...metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml
backend/src/main/java/io/metersphere/track/controller/TestPlanController.java
+1
-1
...a/io/metersphere/track/controller/TestPlanController.java
backend/src/main/java/io/metersphere/track/service/TestPlanService.java
+3
-2
...in/java/io/metersphere/track/service/TestPlanService.java
with
64 additions
and
30 deletions
+64
-30
backend/src/main/java/io/metersphere/api/controller/ApiTestCaseController.java
+
4
-
0
View file @
c62adcfc
...
...
@@ -103,4 +103,8 @@ public class ApiTestCaseController {
public
String
jenkinsRun
(
@RequestBody
RunCaseRequest
request
)
{
return
apiTestCaseService
.
run
(
request
);
}
@GetMapping
(
value
=
"/jenkins/exec/result/{id}"
)
public
String
getExecResult
(
@PathVariable
String
id
)
{
return
apiTestCaseService
.
getExecResult
(
id
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java
+
11
-
0
View file @
c62adcfc
...
...
@@ -13,6 +13,7 @@ import io.metersphere.api.dto.definition.request.MsThreadGroup;
import
io.metersphere.api.dto.definition.request.ParameterConfig
;
import
io.metersphere.api.jmeter.JMeterService
;
import
io.metersphere.base.domain.*
;
import
io.metersphere.base.mapper.ApiDefinitionExecResultMapper
;
import
io.metersphere.base.mapper.ApiDefinitionMapper
;
import
io.metersphere.base.mapper.ApiTestCaseMapper
;
import
io.metersphere.base.mapper.ApiTestFileMapper
;
...
...
@@ -68,6 +69,8 @@ public class ApiTestCaseService {
private
ApiDefinitionMapper
apiDefinitionMapper
;
@Resource
private
JMeterService
jMeterService
;
@Resource
private
ApiDefinitionExecResultMapper
apiDefinitionExecResultMapper
;
private
static
final
String
BODY_FILE_DIR
=
"/opt/metersphere/data/body"
;
...
...
@@ -406,6 +409,7 @@ public class ApiTestCaseService {
mapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
MsTestElement
element
=
mapper
.
readValue
(
testCaseWithBLOBs
.
getRequest
(),
new
TypeReference
<
MsTestElement
>()
{
});
element
.
setName
(
request
.
getCaseId
());
// 测试计划
MsTestPlan
testPlan
=
new
MsTestPlan
();
testPlan
.
setHashTree
(
new
LinkedList
<>());
...
...
@@ -434,4 +438,11 @@ public class ApiTestCaseService {
return
request
.
getReportId
();
}
public
String
getExecResult
(
String
id
){
ApiDefinitionExecResultExample
apidefinitionexecresultexample
=
new
ApiDefinitionExecResultExample
();
ApiDefinitionExecResultExample
.
Criteria
criteria
=
apidefinitionexecresultexample
.
createCriteria
();
criteria
.
andResourceIdEqualTo
(
id
);
String
status
=
apiDefinitionExecResultMapper
.
selectByExample
(
apidefinitionexecresultexample
).
get
(
0
).
getStatus
();
return
status
;
}
}
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml
+
0
-
6
View file @
c62adcfc
...
...
@@ -195,12 +195,6 @@
AND atc.api_definition_id = #{request.apiDefinitionId}
</if>
</where>
<if
test=
"request.orders != null and request.orders.size() > 0"
>
order by
<foreach
collection=
"request.orders"
separator=
","
item=
"order"
>
atc.${order.name} ${order.type}
</foreach>
</if>
</select>
<select
id=
"listSimple"
resultType=
"io.metersphere.api.dto.definition.ApiTestCaseDTO"
>
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
+
10
-
3
View file @
c62adcfc
...
...
@@ -320,21 +320,28 @@
</if>
</select>
<select
id=
"listByMethod"
resultType=
"io.metersphere.track.dto.TestCaseDTO"
>
SELECT id,name,
status,
project_id,"api" as type from api_test
SELECT id,name,project_id,"api" as type from api_test
<where>
<if
test=
"request.projectId!=null"
>
and project_id=#{request.projectId}
</if>
</where>
UNION ALL
select id,name,
status,
project_id,"perform" as type from load_test
select id,name,project_id,"perform" as type from load_test
<where>
<if
test=
"request.projectId!=null"
>
and project_id= #{request.projectId}
</if>
</where>
UNION ALL
select id,name,status,project_id,"scenario" as type from api_scenario
select id,name,project_id,"scenario" as type from api_scenario
<where>
<if
test=
"request.projectId!=null"
>
and project_id= #{request.projectId}
</if>
</where>
UNION ALL
select id,name,project_id,"definition" as type from api_test_case
<where>
<if
test=
"request.projectId!=null"
>
and project_id= #{request.projectId}
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanApiCaseMapper.xml
+
1
-
1
View file @
c62adcfc
...
...
@@ -23,7 +23,7 @@
from
test_plan_api_case t
inner join
api_test_case c
api_test_case c
on t.api_case_id = c.id
<if
test=
"request.planId != null and request.planId!=''"
>
and t.test_plan_id = #{request.planId}
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml
+
34
-
17
View file @
c62adcfc
...
...
@@ -106,18 +106,18 @@
resultType=
"io.metersphere.track.dto.TestCaseReportStatusResultDTO"
>
select count(t1.id) as `count`, t1.status
from test_plan_test_case t1
inner join test_case t2
inner join test_case t2
where t1.case_id = t2.id
and plan_id = #{planId}
and plan_id = #{planId}
group by t1.status;
</select>
<select
id=
"getExecutors"
resultType=
"java.lang.String"
parameterType=
"java.lang.String"
>
select distinct t1.executor
from test_plan_test_case t1
inner join test_case t2
inner join test_case t2
where t1.case_id = t2.id
and plan_id = #{planId};
and plan_id = #{planId};
</select>
<select
id=
"list"
resultType=
"io.metersphere.track.dto.TestPlanCaseDTO"
>
...
...
@@ -320,31 +320,46 @@
</select>
<select
id=
"get"
resultType=
"io.metersphere.track.dto.TestPlanCaseDTO"
>
select test_case.remark, test_plan_test_case.id as id, test_plan_test_case.*,test_case.*,test_case_node.name as model, project.name as projectName
select test_case.remark,
test_plan_test_case.id as id,
test_plan_test_case.*,
test_case.*,
test_case_node.name as model,
project.name as projectName
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id
=
test_case.node_id
inner join project on project.id = test_case.project_id
inner join test_case on test_plan_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id
=
test_case.node_id
inner join project on project.id = test_case.project_id
where test_plan_test_case.id = #{testPlanTestCaseId}
</select>
<select
id=
"getExecResultByPlanId"
resultType=
"java.lang.String"
>
select status
from
test_plan_test_case
where plan_id = #{planId}
select status
from test_plan_test_case
where plan_id = #{planId}
</select>
<select
id=
"listByPlanId"
resultType=
"io.metersphere.track.dto.TestPlanCaseDTO"
>
SELECT test_plan_api_case.api_case_id as id,"definition" as type,api_test_case.name,test_plan_api_case.status
from test_plan_api_case left join api_test_case on test_plan_api_case.api_case_id=api_test_case.id
from test_plan_api_case left join api_test_case on test_plan_api_case.api_case_id=api_test_case.id
inner join
api_definition a
on
api_test_case.api_definition_id = a.id
and a.status != 'Trash'
<where>
<if
test=
"request.planId != null"
>
and test_plan_api_case.test_plan_id = #{request.planId}
</if>
</where>
UNION ALL
SELECT test_plan_api_scenario.api_scenario_id as id,"scenario" as type,api_scenario.name,test_plan_api_scenario.status
from test_plan_api_scenario left join api_scenario on test_plan_api_scenario.api_scenario_id=api_scenario.id
SELECT test_plan_api_scenario.api_scenario_id as id,"scenario" as
type,api_scenario.name,test_plan_api_scenario.status
from test_plan_api_scenario
left join
api_scenario
on
test_plan_api_scenario.api_scenario_id=api_scenario.id
and api_scenario.status != 'Trash'
<where>
<if
test=
"request.planId != null"
>
and test_plan_api_scenario.test_plan_id = #{request.planId}
...
...
@@ -352,7 +367,7 @@
</where>
UNION ALL
SELECT test_case.test_id as id,test_case.type as type,test_case.name,test_plan_test_case.status
from test_plan_test_case
left join
test_case
on test_plan_test_case.case_id =test_case.id
from test_plan_test_case left join test_case on test_plan_test_case.case_id =test_case.id
<where>
<if
test=
"request.planId != null"
>
and test_plan_test_case.plan_id = #{request.planId}
...
...
@@ -377,6 +392,8 @@
</update>
<delete
id=
"deleteByTestCaseID"
parameterType=
"java.lang.String"
>
delete from test_plan_api_case where api_case_id = #{id,jdbcType=VARCHAR}
delete
from test_plan_api_case
where api_case_id = #{id,jdbcType=VARCHAR}
</delete>
</mapper>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/controller/TestPlanController.java
+
1
-
1
View file @
c62adcfc
...
...
@@ -46,7 +46,7 @@ public class TestPlanController {
/*jenkins测试计划*/
@GetMapping
(
"/list/all/{projectId}/{workspaceId}"
)
public
List
<
TestPlanDTO
>
listByProjectId
(
@PathVariable
String
projectId
,
@PathVariable
String
workspaceId
)
{
public
List
<
TestPlanDTO
WithMetric
>
listByProjectId
(
@PathVariable
String
projectId
,
@PathVariable
String
workspaceId
)
{
QueryTestPlanRequest
request
=
new
QueryTestPlanRequest
();
request
.
setWorkspaceId
(
workspaceId
);
request
.
setProjectId
(
projectId
);
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/service/TestPlanService.java
+
3
-
2
View file @
c62adcfc
...
...
@@ -379,8 +379,9 @@ public class TestPlanService {
return
testPlans
;
}
public
List
<
TestPlanDTO
>
listTestPlanByProject
(
QueryTestPlanRequest
request
)
{
return
extTestPlanMapper
.
planList
(
request
);
public
List
<
TestPlanDTOWithMetric
>
listTestPlanByProject
(
QueryTestPlanRequest
request
)
{
List
<
TestPlanDTOWithMetric
>
testPlans
=
extTestPlanMapper
.
list
(
request
);
return
testPlans
;
}
public
void
testPlanRelevance
(
PlanCaseRelevanceRequest
request
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help