Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
K
kb
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • granite
  • kb
  • Wiki
    • Knowledge_share
  • 司法案件系统化测试_实践分享

司法案件系统化测试_实践分享 · Changes

Page history
add: 司法案件系统化测试_实践分享 authored Dec 15, 2022 by fanzx's avatar fanzx
Hide whitespace changes
Inline Side-by-side
Showing with 160 additions and 0 deletions
+160 -0
  • knowledge_share/司法案件系统化测试_实践分享.md knowledge_share/司法案件系统化测试_实践分享.md +160 -0
  • No files found.
knowledge_share/司法案件系统化测试_实践分享.md 0 → 100644
View page @ 87e5969a
# 司法案件系统化测试_实践分享
## 项目背景
```html
司法案件:
利用数据中的案号和前序案号构成的边关系,构造出数据之间的无向关系图,组成一个司法案件的完整数据。
```
| 数据id | 当前案号 | 前序案号 |
|----|----|----|
| 1 | A | B |
| 2 | A | G |
| 3 | A | F |
| 4 | B | C |
| 5 | C | D |
| 6 | E | F |
| 7 | E | G |
案号关系无向关系图
![avatar](sifa_automated_test/case_code_relate.png)
## 数据流程
```html
数据无向图关系处理
related_case_code_base(图关系主表)
related_case_code_pair(图关系的边存储主表)
related_case_code_pair_black(图关系的黑名单)
related_case_code_uuid(图关系的id)
处理结果的使用
judicial_program_docs(司法案件的具体底层数据)
judicial_program_docs_party(司法案件的具体底层数据的当人事)
judicial_program(司法案件的审理程序)
judicial_case(司法案件主表)
```
## 测试效果
测试通过:
![avatar](sifa_automated_test/sifa_test_pass.png)
测试不通过:
![avatar](sifa_automated_test/sifa_test_not_pass.png)
##
```
(collie) [collie@bdp-kapp-sifa-06201 jdt]$ cd /home/collie/project-collie-app/app_justizache/utils/jdt
(collie) [collie@bdp-kapp-sifa-06201 jdt]$ python jdt.py run -c 1.yaml -p product_fzx -t 100103,200102,200103,200202,200402
2022-12-15 14:52:50.243 | SUCCESS | suite:run:88 - 测试用例 100103 PASS
2022-12-15 14:52:56.355 | SUCCESS | suite:run:88 - 测试用例 200102 PASS
2022-12-15 14:53:02.624 | SUCCESS | suite:run:88 - 测试用例 200103 PASS
2022-12-15 14:53:09.202 | SUCCESS | suite:run:88 - 测试用例 200202 PASS
2022-12-15 14:53:15.565 | SUCCESS | suite:run:88 - 测试用例 200402 PASS
```
(collie) [collie@bdp-kapp-sifa-06201 jdt]$ cd /home/collie/project-collie-app/app_justizache/utils/jdt
(collie) [collie@bdp-kapp-sifa-06201 jdt]$ python jdt.py run -c 1.yaml -p product_fzx -t 200102
```json lines
{ suite.py:83
'断言': 1,
'运行结果': [{'use_flag': 10, 'std_sc_code': '(2022)沪0004民初0001号', 'std_sp_code': '(2022)沪0001民初0001号'}, {'use_flag': 0, 'std_sc_code': '(2022)沪0004民初0001号', 'std_sp_code': '(2022)沪0003民初0001号'}],
'预期结果': [{'use_flag': 0, 'std_sc_code': '(2022)沪0004民初0001号', 'std_sp_code': '(2022)沪0003民初0002号'}, {'use_flag': 10, 'std_sc_code': '(2022)沪0004民初0001号', 'std_sp_code': '(2022)沪0001民初0001号'}],
'差异': {'values_changed': {"root[0]['std_sp_code']": {'new_value': '(2022)沪0003民初0001号', 'old_value': '(2022)沪0003民初0002号'}}}
}
{ suite.py:83
'断言': 6,
'运行结果': [{'use_flag': 0, 'uuid_count': 1, 'pid_count': 2}, {'use_flag': 10, 'uuid_count': 1, 'pid_count': 1}],
'预期结果': [{'use_flag': 0, 'uuid_count': 1, 'pid_count': 1}, {'use_flag': 10, 'uuid_count': 1, 'pid_count': 1}],
'差异': {'values_changed': {"root[0]['pid_count']": {'new_value': 2, 'old_value': 1}}}
}
```
## 使用
```html
http://tech.pingansec.com/granite/project-collie-app/-/blob/master/app_justizache/utils/jdt/%E6%B5%8B%E8%AF%95%E7%94%A8%E4%BE%8B%E4%B8%8A%E7%BA%BF%E6%B5%8B%E8%AF%95.md
__product_fzx:
vars:
prefix: ""
test_input_path: "test" # 测试数据临时文件
suite:
path: "/home/collie/project-collie-app/app_justizache/utils/jdt/suite"
case:
- 200401
runner:
- exec: /home/collie/product/app_justizache/bdp_case_test/deploy/bdp_case_test.sh
args:
- __TEST_CASE_INPUT__ # 具体的一个测试文件 /home/collie/project-collie-app/app_justizache/utils/jdt/test/100103_1671087164.json
- __TEST_CASE__ # 测试用例的代码 200101
- fzx # 数据库的前缀
db_config_test:
host: "10.8.6.102"
port: 3810
user: "root"
password: "root123"
db: "fzx_test_case"
```
## 系统化测试的环境构成
```html
http://tech.pingansec.com/granite/project-collie-app/-/blob/master/app_justizache/utils/jdt/suite/200101/precondition_data.xlsx
```
## 系统化测试的输入
```html
http://tech.pingansec.com/granite/project-collie-app/-/blob/master/app_justizache/utils/jdt/suite/200101/input.json
```
## 系统化测试的断言组成
```
desc: >
assertion:
- name: 1
sql: "select count(1) num from related_case_code_pair where use_flag=0"
result:
- {"num": 1000 }
desc:
- name: 2
sql: "select count(1) num from related_case_code_pair_black where use_flag=0"
result:
- {"num": 2 }
desc:
- sql: "select count(distinct judicial_uuid) as uuid_count from related_case_code_uuid"
name: 2
result:
- { "uuid_count": 1 }
desc:
- sql: "select use_flag,count(distinct judicial_uuid) as uuid_count from judicial_case group by use_flag"
name: 3
result:
- { "use_flag": 0 ,"uuid_count": 1 }
desc:
- sql: "select use_flag,count(distinct judicial_uuid) as uuid_count,count(distinct program_id) as pid_count from judicial_program group by use_flag"
name: 4
result:
- { "use_flag": 0 , "uuid_count": 1, "pid_count": 1 }
desc:
- sql: "select use_flag,count(distinct judicial_uuid) as uuid_count,count(distinct program_id) as pid_count from judicial_program_docs group by use_flag"
name: 5
result:
- { "use_flag": 0 ,"uuid_count": 1, "pid_count": 1 }
- { "use_flag":10 ,"uuid_count": 1, "pid_count": 1 }
desc:
- sql: "select use_flag,count(distinct judicial_uuid) as uuid_count,count(distinct program_id) as pid_count from judicial_program_docs_party group by use_flag"
name: 6
result:
- { "use_flag": 0 ,"uuid_count": 1, "pid_count": 1 }
- { "use_flag":10 ,"uuid_count": 1, "pid_count": 1 }
desc:
```
## 系统化测试的测试用例分析
```
关联关系的测试:
https://pingansec.yuque.com/wbbfi2/tzung4/pb7cat
数据具体内容的测试:
https://pingansec.yuque.com/wbbfi2/tzung4/hzkzdl5knxmkscvq
```
Clone repository
  • README
  • basic_guidelines
  • basic_guidelines
    • basic_guidelines
    • dev_guide
    • project_build
    • 开发流程
  • best_practice
  • best_practice
    • AlterTable
    • RDS
    • azkaban
    • create_table
    • design
    • elasticsearch
    • elasticsearch
      • ES运维
    • logstash
View All Pages