Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaofang li
MeterSphere
Commits
57543877
Commit
57543877
authored
4 years ago
by
wenyann
Browse files
Options
Download
Email Patches
Plain Diff
fix:【github】测试跟踪 新建用例关联接口测试
parent
a03431e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
backend/src/main/java/io/metersphere/track/service/TestCaseService.java
+2
-2
...in/java/io/metersphere/track/service/TestCaseService.java
backend/src/main/java/io/metersphere/track/service/TestPlanService.java
+16
-13
...in/java/io/metersphere/track/service/TestPlanService.java
frontend/src/business/components/track/case/components/TestCaseEditOtherInfo.vue
+48
-8
...omponents/track/case/components/TestCaseEditOtherInfo.vue
with
66 additions
and
23 deletions
+66
-23
backend/src/main/java/io/metersphere/track/service/TestCaseService.java
+
2
-
2
View file @
57543877
...
...
@@ -1033,7 +1033,7 @@ public class TestCaseService {
TestCaseTest
test
=
new
TestCaseTest
();
selecteds
.
forEach
(
id
->
{
test
.
setTestType
(
id
.
get
(
0
));
test
.
setTestId
(
id
.
get
(
1
));
test
.
setTestId
(
id
.
get
(
id
.
size
()
-
1
));
test
.
setTestCaseId
(
request
.
getId
());
test
.
setCreateTime
(
System
.
currentTimeMillis
());
test
.
setUpdateTime
(
System
.
currentTimeMillis
());
...
...
@@ -1080,7 +1080,7 @@ public class TestCaseService {
TestCaseTest
test
=
new
TestCaseTest
();
selecteds
.
forEach
(
id
->
{
test
.
setTestType
(
id
.
get
(
0
));
test
.
setTestId
(
id
.
get
(
1
));
test
.
setTestId
(
id
.
get
(
id
.
size
()
-
1
));
test
.
setCreateTime
(
System
.
currentTimeMillis
());
test
.
setUpdateTime
(
System
.
currentTimeMillis
());
test
.
setTestCaseId
(
request
.
getId
());
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/service/TestPlanService.java
+
16
-
13
View file @
57543877
...
...
@@ -522,20 +522,23 @@ public class TestPlanService {
if
(
StringUtils
.
equals
(
l
.
getTestType
(),
TestCaseStatus
.
automation
.
name
()))
{
TestPlanApiScenario
t
=
new
TestPlanApiScenario
();
ApiScenarioWithBLOBs
testPlanApiScenario
=
apiScenarioMapper
.
selectByPrimaryKey
(
l
.
getTestId
());
t
.
setId
(
UUID
.
randomUUID
().
toString
());
t
.
setTestPlanId
(
request
.
getPlanId
());
t
.
setApiScenarioId
(
l
.
getTestId
());
t
.
setLastResult
(
testPlanApiScenario
.
getLastResult
());
t
.
setPassRate
(
testPlanApiScenario
.
getPassRate
());
t
.
setReportId
(
testPlanApiScenario
.
getReportId
());
t
.
setStatus
(
testPlanApiScenario
.
getStatus
());
t
.
setCreateTime
(
System
.
currentTimeMillis
());
t
.
setUpdateTime
(
System
.
currentTimeMillis
());
TestPlanApiScenarioExample
example
=
new
TestPlanApiScenarioExample
();
example
.
createCriteria
().
andTestPlanIdEqualTo
(
request
.
getPlanId
()).
andApiScenarioIdEqualTo
(
t
.
getApiScenarioId
());
if
(
testPlanApiScenarioMapper
.
countByExample
(
example
)
<=
0
)
{
testPlanApiScenarioMapper
.
insert
(
t
);
if
(
testPlanApiScenario
!=
null
)
{
t
.
setId
(
UUID
.
randomUUID
().
toString
());
t
.
setTestPlanId
(
request
.
getPlanId
());
t
.
setApiScenarioId
(
l
.
getTestId
());
t
.
setLastResult
(
testPlanApiScenario
.
getLastResult
());
t
.
setPassRate
(
testPlanApiScenario
.
getPassRate
());
t
.
setReportId
(
testPlanApiScenario
.
getReportId
());
t
.
setStatus
(
testPlanApiScenario
.
getStatus
());
t
.
setCreateTime
(
System
.
currentTimeMillis
());
t
.
setUpdateTime
(
System
.
currentTimeMillis
());
TestPlanApiScenarioExample
example
=
new
TestPlanApiScenarioExample
();
example
.
createCriteria
().
andTestPlanIdEqualTo
(
request
.
getPlanId
()).
andApiScenarioIdEqualTo
(
t
.
getApiScenarioId
());
if
(
testPlanApiScenarioMapper
.
countByExample
(
example
)
<=
0
)
{
testPlanApiScenarioMapper
.
insert
(
t
);
}
}
}
});
});
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/track/case/components/TestCaseEditOtherInfo.vue
+
48
-
8
View file @
57543877
...
...
@@ -15,11 +15,12 @@
</span>
</el-col>
<el-col
v-else
:span=
"7"
style=
"margin-top: 10px;"
>
<el-form-item
:label=
"$t('test_track.case.relate_test')"
:label-width=
"labelWidth"
>
<el-cascader
:options=
"sysList"
filterable
:placeholder=
"$t('test_track.case.please_select_relate_test')"
show-all-levels
<el-form-item
:label=
"$t('test_track.case.relate_test')"
>
<el-cascader
:options=
"sysList"
filterable
:placeholder=
"$t('test_track.case.please_select_relate_test')"
show-all-levels
v-model=
"form.selected"
:props=
"props"
:disabled=
"readOnly"
class=
"ms-case"
ref=
"cascade"
></el-cascader>
ref=
"cascade"
></el-cascader>
</el-form-item>
</el-col>
</el-tab-pane>
...
...
@@ -293,14 +294,48 @@ export default {
this
.
form
.
type
=
val
;
this
.
testOptions
=
[];
let
url
=
''
;
if
(
this
.
form
.
type
===
'
testcase
'
||
this
.
form
.
type
===
'
automation
'
)
{
if
(
this
.
form
.
type
===
'
testcase
'
)
{
url
=
'
/api/
'
+
this
.
form
.
type
+
'
/list/
'
+
this
.
projectId
;
if
(
!
url
)
{
return
;
}
this
.
buildValue
(
url
);
}
else
if
(
this
.
form
.
type
===
'
performance
'
||
this
.
form
.
type
===
'
api
'
)
{
url
=
'
/
'
+
this
.
form
.
type
+
'
/list/
'
+
this
.
projectId
;
if
(
!
url
)
{
return
;
}
this
.
buildValue
(
url
);
}
else
if
(
this
.
form
.
type
===
'
automation
'
)
{
//url = '/api/' + this.form.type + '/list/' + this.projectId;
url
=
'
/api/automation/module/list/
'
+
this
.
projectId
;
if
(
!
url
)
{
return
;
}
this
.
result
.
loading
=
true
;
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
$get
(
"
/api/automation/module/list/
"
+
this
.
projectId
,
response
=>
{
if
(
response
.
data
!=
undefined
&&
response
.
data
!=
null
)
{
this
.
buildTreeValue
(
response
.
data
);
}
this
.
result
.
loading
=
false
;
resolve
(
response
.
data
);
});
});
}
if
(
!
url
)
{
return
;
}
},
buildTreeValue
(
list
)
{
list
.
forEach
(
item
=>
{
item
.
value
=
item
.
id
,
item
.
label
=
item
.
name
,
item
.
leaf
=
true
;
if
(
item
.
children
)
{
this
.
buildTreeValue
(
item
.
children
);
}
});
},
buildValue
(
url
)
{
this
.
result
.
loading
=
true
;
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
$get
(
url
).
then
(
res
=>
{
...
...
@@ -315,7 +350,7 @@ export default {
reject
(
err
);
});
});
}
,
}
}
};
</
script
>
...
...
@@ -333,4 +368,9 @@ export default {
.remark-item
{
padding
:
0px
15px
;
}
.el-cascader
>>>
.el-input
{
cursor
:
pointer
;
width
:
300px
;
}
</
style
>
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