Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
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
王飞
vehicle-quality-review
Commits
c441b357
Commit
c441b357
authored
Apr 08, 2024
by
盖献康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车型试验开始子任务时所需 测试场景以及场景-用例
parent
2fc4cbcb
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
144 additions
and
8 deletions
+144
-8
ITestScenarioService.java
...src/main/java/com/ruoyi/service/ITestScenarioService.java
+6
-1
TestUseCaseService.java
...w/src/main/java/com/ruoyi/service/TestUseCaseService.java
+18
-0
TestScenarioServiceImpl.java
.../java/com/ruoyi/service/impl/TestScenarioServiceImpl.java
+30
-0
TestUseCaseServiceImpl.java
...n/java/com/ruoyi/service/impl/TestUseCaseServiceImpl.java
+42
-0
TestScenarioController.java
...w/src/main/java/com/ruoyi/web/TestScenarioController.java
+10
-5
TestUserCaseController.java
...w/src/main/java/com/ruoyi/web/TestUserCaseController.java
+12
-2
TestUseCaseByScenarioRequest.java
...a/com/ruoyi/web/request/TestUseCaseByScenarioRequest.java
+26
-0
No files found.
quality-review/src/main/java/com/ruoyi/service/ITestScenarioService.java
View file @
c441b357
...
@@ -2,7 +2,6 @@ package com.ruoyi.service;
...
@@ -2,7 +2,6 @@ package com.ruoyi.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.ruoyi.domain.TestScenario
;
import
com.ruoyi.domain.TestScenario
;
import
com.ruoyi.domain.TestType
;
import
com.ruoyi.web.request.TestScenarioRequest
;
import
com.ruoyi.web.request.TestScenarioRequest
;
import
java.util.List
;
import
java.util.List
;
...
@@ -16,4 +15,10 @@ public interface ITestScenarioService extends IService<TestScenario> {
...
@@ -16,4 +15,10 @@ public interface ITestScenarioService extends IService<TestScenario> {
* @return 测试场景库集合
* @return 测试场景库集合
*/
*/
public
List
<
TestScenario
>
selectTestScenarioList
(
TestScenarioRequest
testScenarioRequest
);
public
List
<
TestScenario
>
selectTestScenarioList
(
TestScenarioRequest
testScenarioRequest
);
/**
* 获取测试场景列表(科恩)
* @return
*/
public
List
<
String
>
selectScenarioList
();
}
}
quality-review/src/main/java/com/ruoyi/service/TestUseCaseService.java
View file @
c441b357
package
com
.
ruoyi
.
service
;
package
com
.
ruoyi
.
service
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.ruoyi.domain.TestUseCase
;
import
com.ruoyi.domain.TestUseCase
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.ruoyi.web.request.TestUseCaseByScenarioRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author wangfei
* @author wangfei
...
@@ -27,4 +30,19 @@ public interface TestUseCaseService extends IService<TestUseCase> {
...
@@ -27,4 +30,19 @@ public interface TestUseCaseService extends IService<TestUseCase> {
* @return
* @return
*/
*/
List
<
String
>
selectCaseIdList
(
TestUseCaseIdListRequest
request
);
List
<
String
>
selectCaseIdList
(
TestUseCaseIdListRequest
request
);
/**
* 通过测试场景获取所绑定的测试用例
* @param request
* @return
*/
List
<
String
>
selectCaseByScenario
(
TestUseCaseByScenarioRequest
request
);
/**
* 调用第三方接口
* @param url
* @param map
* @return
*/
JSONObject
callThirdPartyInterface
(
String
url
,
Map
<
String
,
Object
>
map
);
}
}
quality-review/src/main/java/com/ruoyi/service/impl/TestScenarioServiceImpl.java
View file @
c441b357
package
com
.
ruoyi
.
service
.
impl
;
package
com
.
ruoyi
.
service
.
impl
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.domain.TestScenario
;
import
com.ruoyi.domain.TestScenario
;
import
com.ruoyi.mapper.TestScenarioMapper
;
import
com.ruoyi.mapper.TestScenarioMapper
;
import
com.ruoyi.service.ITestScenarioService
;
import
com.ruoyi.service.ITestScenarioService
;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.web.request.TestScenarioRequest
;
import
com.ruoyi.web.request.TestScenarioRequest
;
import
lombok.Data
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
@Service
@Transactional
@Transactional
...
@@ -18,6 +22,11 @@ public class TestScenarioServiceImpl extends ServiceImpl<TestScenarioMapper, Tes
...
@@ -18,6 +22,11 @@ public class TestScenarioServiceImpl extends ServiceImpl<TestScenarioMapper, Tes
@Autowired
@Autowired
private
TestScenarioMapper
testScenarioMapper
;
private
TestScenarioMapper
testScenarioMapper
;
@Autowired
private
TestUseCaseService
testUseCaseService
;
private
static
String
url
=
"https://10.12.48.78:8090/DescribeScenarioTestTypeList"
;
@Override
@Override
public
List
<
TestScenario
>
selectTestScenarioList
(
TestScenarioRequest
testScenarioRequest
){
public
List
<
TestScenario
>
selectTestScenarioList
(
TestScenarioRequest
testScenarioRequest
){
if
(
testScenarioRequest
.
getTestScenario
()
!=
null
&&
(
testScenarioRequest
.
getTestScenario
().
contains
(
"%"
)
||
testScenarioRequest
.
getTestScenario
().
contains
(
"_"
)
)){
if
(
testScenarioRequest
.
getTestScenario
()
!=
null
&&
(
testScenarioRequest
.
getTestScenario
().
contains
(
"%"
)
||
testScenarioRequest
.
getTestScenario
().
contains
(
"_"
)
)){
...
@@ -25,4 +34,25 @@ public class TestScenarioServiceImpl extends ServiceImpl<TestScenarioMapper, Tes
...
@@ -25,4 +34,25 @@ public class TestScenarioServiceImpl extends ServiceImpl<TestScenarioMapper, Tes
}
}
return
testScenarioMapper
.
selectTestScenarioList
(
testScenarioRequest
);
return
testScenarioMapper
.
selectTestScenarioList
(
testScenarioRequest
);
}
}
/**
* 获取测试场景列表(科恩)
* @return
*/
@Override
public
List
<
String
>
selectScenarioList
()
{
JSONObject
jsonObject
=
testUseCaseService
.
callThirdPartyInterface
(
url
,
null
);
List
<
String
>
scenarioList
=
jsonObject
.
getList
(
"scenario_list"
,
Scenario
.
class
)
.
stream
()
.
map
(
Scenario:
:
getName
)
.
collect
(
Collectors
.
toList
());
return
scenarioList
;
}
@Data
public
class
Scenario
{
private
String
name
;
}
}
}
quality-review/src/main/java/com/ruoyi/service/impl/TestUseCaseServiceImpl.java
View file @
c441b357
package
com
.
ruoyi
.
service
.
impl
;
package
com
.
ruoyi
.
service
.
impl
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.domain.TestUseCase
;
import
com.ruoyi.domain.TestUseCase
;
import
com.ruoyi.domain.vo.CaseResultVO
;
import
com.ruoyi.domain.vo.TestUsecaseVO
;
import
com.ruoyi.domain.vo.TestUsecaseVO
;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.mapper.TestUseCaseMapper
;
import
com.ruoyi.mapper.TestUseCaseMapper
;
import
com.ruoyi.web.request.TestUseCaseByScenarioRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -23,6 +30,8 @@ import java.util.stream.Collectors;
...
@@ -23,6 +30,8 @@ import java.util.stream.Collectors;
@Transactional
@Transactional
public
class
TestUseCaseServiceImpl
extends
ServiceImpl
<
TestUseCaseMapper
,
TestUseCase
>
implements
TestUseCaseService
{
public
class
TestUseCaseServiceImpl
extends
ServiceImpl
<
TestUseCaseMapper
,
TestUseCase
>
implements
TestUseCaseService
{
private
String
describeCaseList
=
"https://10.12.48.78:8090/DescribeCaseList"
;
@Autowired
@Autowired
private
TestUseCaseMapper
testUseCaseMapper
;
private
TestUseCaseMapper
testUseCaseMapper
;
...
@@ -46,6 +55,39 @@ public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestU
...
@@ -46,6 +55,39 @@ public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestU
return
list
.
stream
().
map
(
TestUsecaseVO:
:
getCaseId
).
collect
(
Collectors
.
toList
());
return
list
.
stream
().
map
(
TestUsecaseVO:
:
getCaseId
).
collect
(
Collectors
.
toList
());
}
}
/**
* 通过测试场景获取所绑定的测试用例
* @param request
* @return
*/
@Override
public
List
<
String
>
selectCaseByScenario
(
TestUseCaseByScenarioRequest
request
)
{
// 根据场景名遍历查询所绑定用例
List
<
String
>
resultList
=
new
ArrayList
<>();
request
.
getScenarioNameList
()
.
forEach
(
scenarioName
->
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"scenario"
,
scenarioName
);
JSONObject
jsonObject
=
callThirdPartyInterface
(
describeCaseList
,
map
);
List
<
String
>
list
=
jsonObject
.
getList
(
"case_list"
,
CaseResultVO
.
class
)
.
stream
().
map
(
CaseResultVO:
:
getId
).
collect
(
Collectors
.
toList
());
resultList
.
addAll
(
list
);
});
return
resultList
;
}
/**
* 调用第三方接口
* @param url
* @param map
* @return
*/
@Override
public
JSONObject
callThirdPartyInterface
(
String
url
,
Map
<
String
,
Object
>
map
)
{
String
result
=
HttpUtil
.
post
(
url
,
JSONObject
.
toJSONString
(
map
));
return
JSONObject
.
parseObject
(
result
);
}
}
}
...
...
quality-review/src/main/java/com/ruoyi/web/TestScenarioController.java
View file @
c441b357
...
@@ -3,7 +3,6 @@ package com.ruoyi.web;
...
@@ -3,7 +3,6 @@ package com.ruoyi.web;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.domain.Sample
;
import
com.ruoyi.domain.TestScenario
;
import
com.ruoyi.domain.TestScenario
;
import
com.ruoyi.service.ITestScenarioService
;
import
com.ruoyi.service.ITestScenarioService
;
import
com.ruoyi.web.request.TestScenarioRequest
;
import
com.ruoyi.web.request.TestScenarioRequest
;
...
@@ -14,10 +13,7 @@ import org.apache.skywalking.apm.toolkit.trace.Tags;
...
@@ -14,10 +13,7 @@ import org.apache.skywalking.apm.toolkit.trace.Tags;
import
org.apache.skywalking.apm.toolkit.trace.Trace
;
import
org.apache.skywalking.apm.toolkit.trace.Trace
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.List
;
...
@@ -54,4 +50,13 @@ public class TestScenarioController extends BaseController {
...
@@ -54,4 +50,13 @@ public class TestScenarioController extends BaseController {
return
R
.
ok
(
testScenarioService
.
selectTestScenarioList
(
testScenarioRequest
));
return
R
.
ok
(
testScenarioService
.
selectTestScenarioList
(
testScenarioRequest
));
}
}
/**
* 获取测试场景列表(科恩)
*/
@ApiOperation
(
"查询测试场景(科恩)"
)
@PostMapping
(
"/getScenarioList"
)
public
R
<
List
<
String
>>
getScenarioList
(){
return
R
.
ok
(
testScenarioService
.
selectScenarioList
());
}
}
}
quality-review/src/main/java/com/ruoyi/web/TestUserCaseController.java
View file @
c441b357
package
com
.
ruoyi
.
web
;
package
com
.
ruoyi
.
web
;
import
com.ruoyi.common.annotation.Anonymous
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.domain.TestUseCase
;
import
com.ruoyi.domain.TestUseCase
;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.web.request.TestUseCaseByScenarioRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -41,10 +41,20 @@ public class TestUserCaseController extends BaseController{
...
@@ -41,10 +41,20 @@ public class TestUserCaseController extends BaseController{
* @param request
* @param request
* @return
* @return
*/
*/
@Anonymous
@ApiOperation
(
"根据场景查询用例ID集合"
)
@ApiOperation
(
"根据场景查询用例ID集合"
)
@PostMapping
(
"/getCaseIdList"
)
@PostMapping
(
"/getCaseIdList"
)
public
R
<
List
<
String
>>
getCaseIdList
(
@Validated
@RequestBody
TestUseCaseIdListRequest
request
)
{
public
R
<
List
<
String
>>
getCaseIdList
(
@Validated
@RequestBody
TestUseCaseIdListRequest
request
)
{
return
R
.
ok
(
testUseCaseService
.
selectCaseIdList
(
request
));
return
R
.
ok
(
testUseCaseService
.
selectCaseIdList
(
request
));
}
}
/**
* 通过测试场景获取所绑定的测试用例
* @param request
* @return
*/
@ApiOperation
(
"根据场景查询用例ID集合(科恩)"
)
@PostMapping
(
"/getCaseByScenario"
)
public
R
<
List
<
String
>>
getCaseByScenario
(
@Validated
@RequestBody
TestUseCaseByScenarioRequest
request
)
{
return
R
.
ok
(
testUseCaseService
.
selectCaseByScenario
(
request
));
}
}
}
quality-review/src/main/java/com/ruoyi/web/request/TestUseCaseByScenarioRequest.java
0 → 100644
View file @
c441b357
package
com
.
ruoyi
.
web
.
request
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
* 通过测试场景获取测试用例ID集合 DTO
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
"通过测试场景获取测试用例ID集合 DTO"
)
public
class
TestUseCaseByScenarioRequest
{
@ApiModelProperty
(
"测试场景名称集合"
)
private
List
<
String
>
scenarioNameList
;
}
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