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
e42426f3
Commit
e42426f3
authored
Apr 09, 2024
by
wdy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查看测试矩阵
parent
f5e6c9bc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
147 additions
and
5 deletions
+147
-5
ScenarioVO.java
...-review/src/main/java/com/ruoyi/domain/vo/ScenarioVO.java
+15
-0
TestTypeVO.java
...-review/src/main/java/com/ruoyi/domain/vo/TestTypeVO.java
+15
-0
UseCaseVO.java
...y-review/src/main/java/com/ruoyi/domain/vo/UseCaseVO.java
+29
-0
MatrixService.java
...review/src/main/java/com/ruoyi/service/MatrixService.java
+2
-0
MatrixServiceImpl.java
...c/main/java/com/ruoyi/service/impl/MatrixServiceImpl.java
+85
-4
MatrixController.java
...-review/src/main/java/com/ruoyi/web/MatrixController.java
+1
-1
No files found.
quality-review/src/main/java/com/ruoyi/domain/vo/ScenarioVO.java
0 → 100644
View file @
e42426f3
package
com
.
ruoyi
.
domain
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@ApiModel
(
description
=
"测试场景VO"
)
@Data
public
class
ScenarioVO
{
private
Long
id
;
private
String
name
;
}
quality-review/src/main/java/com/ruoyi/domain/vo/TestTypeVO.java
0 → 100644
View file @
e42426f3
package
com
.
ruoyi
.
domain
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@ApiModel
(
description
=
"测试方法(类型)VO"
)
@Data
public
class
TestTypeVO
{
private
Long
id
;
private
String
name
;
}
quality-review/src/main/java/com/ruoyi/domain/vo/UseCaseVO.java
0 → 100644
View file @
e42426f3
package
com
.
ruoyi
.
domain
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@ApiModel
(
description
=
"测试用例VO"
)
@Data
public
class
UseCaseVO
{
private
String
id
;
private
String
name
;
// 测试场景
private
String
scenario
;
// 测试方法
private
String
test_type
;
/**
* 返回用例在矩阵中的坐标
* @return
*/
public
String
getCoordinates
()
{
return
scenario
+
test_type
;
}
}
quality-review/src/main/java/com/ruoyi/service/MatrixService.java
View file @
e42426f3
...
@@ -6,4 +6,6 @@ public interface MatrixService {
...
@@ -6,4 +6,6 @@ public interface MatrixService {
MatrixResponse
getMatrix
();
MatrixResponse
getMatrix
();
MatrixResponse
getMatrixForUrl
();
}
}
quality-review/src/main/java/com/ruoyi/service/impl/MatrixServiceImpl.java
View file @
e42426f3
package
com
.
ruoyi
.
service
.
impl
;
package
com
.
ruoyi
.
service
.
impl
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.ruoyi.domain.TestScenario
;
import
com.ruoyi.domain.TestScenario
;
import
com.ruoyi.domain.TestType
;
import
com.ruoyi.domain.TestType
;
import
com.ruoyi.domain.TestUseCase
;
import
com.ruoyi.domain.TestUseCase
;
import
com.ruoyi.domain.vo.MatrixColumnVO
;
import
com.ruoyi.domain.vo.*
;
import
com.ruoyi.domain.vo.MatrixRowVO
;
import
com.ruoyi.service.ITestScenarioService
;
import
com.ruoyi.service.ITestScenarioService
;
import
com.ruoyi.service.ITestTypeService
;
import
com.ruoyi.service.ITestTypeService
;
import
com.ruoyi.service.MatrixService
;
import
com.ruoyi.service.MatrixService
;
...
@@ -13,8 +14,6 @@ import com.ruoyi.web.response.MatrixResponse;
...
@@ -13,8 +14,6 @@ import com.ruoyi.web.response.MatrixResponse;
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.time.format.TextStyle
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -47,6 +46,88 @@ public class MatrixServiceImpl implements MatrixService {
...
@@ -47,6 +46,88 @@ public class MatrixServiceImpl implements MatrixService {
return
response
;
return
response
;
}
}
@Override
public
MatrixResponse
getMatrixForUrl
()
{
//以post形式请求接口
String
result
=
HttpUtil
.
post
(
"https://10.12.48.78:8090/DescribeScenarioTestTypeList"
,
""
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
// 获取测试场景列表
List
<
ScenarioVO
>
scenarioList
=
jsonObject
.
getList
(
"scenario_list"
,
ScenarioVO
.
class
);
if
(
scenarioList
!=
null
&&
scenarioList
.
size
()
!=
0
)
{
for
(
int
i
=
0
;
i
<
scenarioList
.
size
();
i
++)
{
scenarioList
.
get
(
i
).
setId
((
long
)
i
);
}
}
// 获取测试方法列表
List
<
TestTypeVO
>
testTypeList
=
jsonObject
.
getList
(
"test_type_list"
,
TestTypeVO
.
class
);
if
(
testTypeList
!=
null
&&
testTypeList
.
size
()
!=
0
)
{
for
(
int
i
=
0
;
i
<
testTypeList
.
size
();
i
++)
{
testTypeList
.
get
(
i
).
setId
((
long
)
i
);
}
}
String
caseResult
=
HttpUtil
.
post
(
"https://10.12.48.78:8090/DescribeCaseList"
,
""
);
JSONObject
object
=
JSONObject
.
parseObject
(
caseResult
);
// 获取测试用例列表
List
<
UseCaseVO
>
caseList
=
object
.
getList
(
"case_list"
,
UseCaseVO
.
class
);
MatrixResponse
response
=
new
MatrixResponse
();
setHeaderName
(
response
,
testTypeList
);
setRowsName
(
response
,
scenarioList
,
testTypeList
,
caseList
);
return
response
;
}
private
void
setRowsName
(
MatrixResponse
response
,
List
<
ScenarioVO
>
scenarioList
,
List
<
TestTypeVO
>
testTypeList
,
List
<
UseCaseVO
>
caseList
)
{
List
<
Map
<
String
,
Object
>>
rows
=
new
ArrayList
();
for
(
ScenarioVO
scenario
:
scenarioList
)
{
Map
<
String
,
Object
>
row
=
new
HashMap
();
row
.
put
(
"name"
,
scenario
.
getName
());
for
(
TestTypeVO
type
:
testTypeList
)
{
String
column
=
type
.
getName
();
String
columnId
=
String
.
valueOf
(
type
.
getId
());
String
coordinates
=
scenario
.
getName
()
+
column
;
String
useCase
=
getUseCaseIdByCoordinatesName
(
caseList
,
coordinates
);
row
.
put
(
columnId
,
useCase
==
null
?
""
:
useCase
);
}
rows
.
add
(
row
);
}
response
.
setRows
(
rows
);
}
public
String
getUseCaseIdByCoordinatesName
(
List
<
UseCaseVO
>
caseList
,
String
coordinates
)
{
for
(
UseCaseVO
useCase
:
caseList
)
{
if
(
useCase
.
getCoordinates
().
equals
(
coordinates
))
{
return
useCase
.
getId
();
}
}
return
null
;
}
private
void
setHeaderName
(
MatrixResponse
response
,
List
<
TestTypeVO
>
testTypeList
)
{
List
<
MatrixColumnVO
>
columns
=
new
ArrayList
();
for
(
TestTypeVO
type
:
testTypeList
)
{
MatrixColumnVO
column
=
new
MatrixColumnVO
(
String
.
valueOf
(
type
.
getId
()),
type
.
getName
());
columns
.
add
(
column
);
}
response
.
setHeader
(
columns
);
}
private
void
setHeader
(
MatrixResponse
response
,
List
<
TestType
>
types
)
{
private
void
setHeader
(
MatrixResponse
response
,
List
<
TestType
>
types
)
{
List
<
MatrixColumnVO
>
columns
=
new
ArrayList
();
List
<
MatrixColumnVO
>
columns
=
new
ArrayList
();
...
...
quality-review/src/main/java/com/ruoyi/web/MatrixController.java
View file @
e42426f3
...
@@ -25,7 +25,7 @@ public class MatrixController {
...
@@ -25,7 +25,7 @@ public class MatrixController {
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/getInfo"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/getInfo"
)
public
R
<
MatrixResponse
>
getInfo
()
{
public
R
<
MatrixResponse
>
getInfo
()
{
return
R
.
ok
(
matrixService
.
getMatrix
());
return
R
.
ok
(
matrixService
.
getMatrix
ForUrl
());
}
}
}
}
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