增加数据库校验示例

This commit is contained in:
leozhanggg 2021-03-12 17:31:57 +08:00
parent b4c8836af6
commit cce56cfed0
14 changed files with 219 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,32 @@
[
{
"summary": "addAudltCard",
"body": {
"params": {
"adultAddressregion": "3202000000",
"adultAddressdistrict": "AUTO99",
"adultCountryCode": "156",
"adultNationCode": "1001",
"adultNoType": "2",
"adultHabiCode": "32021100",
"unitCode": "3202112002",
"adultAccountCode": 1002,
"adultResiCode": 1,
"adultNo": "$RandInt(10000000,99999999)",
"adultName": "AUTO99",
"adultSex": "1",
"adultBirthday": "2015-03-03",
"adultMobile": "19999999999",
"adultHabiaddress": "AUTO99",
"adultArtimove": 0,
"adultIfdead": 0,
"adultHereCode": 1001,
"adultCreatesite": "3202112002",
"adultCreatemanName": "马山山",
"adultCreateman": "3202112002008",
"adultCreatesiteName": "马山社区"
},
"headtoken": "${headtoken}"
}
}
]

View File

@ -0,0 +1,100 @@
[
{
"summary": "addAudltCard",
"body": {
"callTime": "2021-03-12 10:05:01",
"code": null,
"data": {
"adultInforms": [],
"adultInquireBean": null,
"inocStationList": [],
"refuseinocList": [],
"tdAdult": {
"accountName": "本县",
"adultAccountCode": 1002,
"adultAccountStr": null,
"adultAddressdistrict": "AUTO99",
"adultAddressregion": "3202000000",
"adultAparetel": null,
"adultApptime": null,
"adultArtimove": 0,
"adultBirthday": "2015-03-03 00:00:00",
"adultBirthdaystr": null,
"adultCode": "3202112002815000002",
"adultCodeStr": null,
"adultCountryCode": "156",
"adultCreatedate": "2021-03-12 10:05:01",
"adultCreateman": "3202112002008",
"adultCreatemanName": "马山山",
"adultCreatemanNo": null,
"adultCreatesite": "3202112002",
"adultCreatesiteName": "马山社区",
"adultCurdepartment": "3202112002",
"adultCurdepartmentName": "马山社区",
"adultDeaddate": null,
"adultDelmark": 0,
"adultDeltime": null,
"adultEduCode": null,
"adultEwmCard": null,
"adultFatherno": null,
"adultFathernoType": null,
"adultGuard": null,
"adultHabiCode": "32021100",
"adultHabiStr": null,
"adultHabiaddress": "AUTO99",
"adultHereCode": 1001,
"adultHereStr": null,
"adultIfapp": 0,
"adultIfdead": 0,
"adultIfwxin": 0,
"adultJkdaCode": null,
"adultJobCode": null,
"adultLeavedate": "2021-03-12 10:05:01",
"adultLock": 0,
"adultMarry": null,
"adultMobile": "19999999999",
"adultMotherno": null,
"adultMothernoType": null,
"adultName": "AUTO99",
"adultNationCode": "1001",
"adultNo": "9999999999999",
"adultNoType": "2",
"adultRelCode": null,
"adultRemark": null,
"adultResiCode": 1,
"adultResiStr": null,
"adultSchCode": null,
"adultSchName": null,
"adultSex": "1",
"adultTypeCode": null,
"adultWxintime": null,
"age": 6,
"createDate": "2021-03-12 10:05:01",
"createManCode": "3202112002008",
"empCode": null,
"habiName": "滨湖区",
"hasRefInoc": 0,
"hereName": "在册",
"ifInform": null,
"ifInquire": null,
"isqr": 0,
"modifyDate": "2021-03-12 10:05:01",
"modifyManCode": "3202112002008",
"modifyUnitCode": "3202112002",
"moveDate": null,
"photoUrl": null,
"resiName": "常住",
"showPhotoUrl": null,
"sysEditDate": null,
"type": null,
"unitCode": null,
"unitSimpname": null
},
"tdAdultInoculation": [],
"varIndex": []
},
"msg": "返回成功",
"success": true
}
}
]

View File

@ -0,0 +1,48 @@
test_info:
title: perRelated
host: ${host}
scheme: http
method: POST
address: /api/perRelated/addAudltCard
mime_type: application/x-www-form-urlencoded
headers: ${headers}
timeout: 10
file: false
cookies: false
premise: false
test_case:
- summary: addAudltCard
describe: test_addAudltCard
parameter: addAudltCard_request.json
check_body:
check_type: check_json
expected_code: 200
expected_result: addAudltCard_response.json
check_db:
- check_type: mysql
execute_sql: select * from TD_ADULT where ADULT_CODE='${adultCode}'
expected_result:
- ADULT_CODE: ${adultCode}
ADULT_NAME: AUTO99
ADULT_SEX: 1
ADULT_BIRTHDAY: 2015-03-03
ADULT_MOBILE: 19999999999
- check_type: es
execute_sql: select * from adult where CHIL_NAME='AUTO99'
expected_result:
- CHIL_NAME: AUTO99
CHIL_SEX: 1
CHIL_MOBILE: 19999999999
- CHIL_NAME: AUTO99
CHIL_SEX: 1
CHIL_MOBILE: 19999999999
- check_type: solr
execute_sql: select * from adultsolr320000 where adultName='AUTO99'
expected_result:
- adultName: AUTO99
adultSex: 1
adultMobile: 19999999999
- check_type: hbase
execute_sql: select * from TD_ADULT_YZ where ADULT_CODE=3202112002803000001
expected_result:
- ADULT_CODE: 3202112002803000001

View File

@ -14,7 +14,7 @@ test_case:
- summary: addOrUpCurBact
describe: test_addOrUpCurBact
parameter: addOrUpCurBact_request.json
check:
check_body:
check_type: check_json
expected_code: 200
expected_result:

View File

@ -21,7 +21,7 @@ test_case:
pageSize: 10
page: 0
headtoken: ${headtoken}
check:
check_body:
check_type: check_json
expected_code: 200
expected_result:

View File

@ -21,7 +21,7 @@ test_case:
pageSize: 10
page: 0
headtoken: ${headtoken}
check:
check_body:
check_type: check_json
expected_code: 200
expected_result: getAdultCurbactList_response.json

View File

@ -14,7 +14,7 @@ test_case:
- summary: initCanSelInfo
describe: test_initCanSelInfo
parameter: initCanSelInfo_request.json
check:
check_body:
check_type: check_json
expected_code: 200
expected_result: initCanSelInfo_response.json

View File

@ -0,0 +1,29 @@
# -*- coding:utf-8 -*-
# @Time : 2021/2/2
# @Author : Leo Zhang
# @File : test_addAudltCard.py
# ****************************
import os
import allure
import pytest
from comm.utils.readYaml import read_yaml_data
from comm.unit.initializePremise import init_premise
from comm.unit.apiSend import send_request
from comm.unit.checkResult import check_result
case_yaml = os.path.realpath(__file__).replace('testcase', 'page').replace('.py', '.yaml')
case_path = os.path.dirname(case_yaml)
case_dict = read_yaml_data(case_yaml)
@allure.feature(case_dict["test_info"]["title"])
class TestPerrelated:
@pytest.mark.parametrize("case_data", case_dict["test_case"])
@allure.story("test_addAudltCard")
def test_addAudltCard(self, case_data):
# 初始化请求:执行前置接口+替换关联变量
test_info, case_data = init_premise(case_dict["test_info"], case_data, case_path)
# 发送当前接口
code, data = send_request(test_info, case_data)
# 校验接口返回
check_result(case_data, code, data)

View File

@ -10,7 +10,7 @@ from comm.utils.readYaml import read_yaml_data
from comm.unit.initializePremise import init_premise
from comm.unit.apiSend import send_request
from comm.unit.checkResult import check_result
case_yaml = os.path.realpath(__file__).replace('testcase', 'page').replace('py', 'yaml')
case_yaml = os.path.realpath(__file__).replace('testcase', 'page').replace('.py', '.yaml')
case_path = os.path.dirname(case_yaml)
case_dict = read_yaml_data(case_yaml)

View File

@ -10,7 +10,7 @@ from comm.utils.readYaml import read_yaml_data
from comm.unit.initializePremise import init_premise
from comm.unit.apiSend import send_request
from comm.unit.checkResult import check_result
case_yaml = os.path.realpath(__file__).replace('testcase', 'page').replace('py', 'yaml')
case_yaml = os.path.realpath(__file__).replace('testcase', 'page').replace('.py', '.yaml')
case_path = os.path.dirname(case_yaml)
case_dict = read_yaml_data(case_yaml)

View File

@ -10,7 +10,7 @@ from comm.utils.readYaml import read_yaml_data
from comm.unit.initializePremise import init_premise
from comm.unit.apiSend import send_request
from comm.unit.checkResult import check_result
case_yaml = os.path.realpath(__file__).replace('testcase', 'page').replace('py', 'yaml')
case_yaml = os.path.realpath(__file__).replace('testcase', 'page').replace('.py', '.yaml')
case_path = os.path.dirname(case_yaml)
case_dict = read_yaml_data(case_yaml)

View File

@ -10,7 +10,7 @@ from comm.utils.readYaml import read_yaml_data
from comm.unit.initializePremise import init_premise
from comm.unit.apiSend import send_request
from comm.unit.checkResult import check_result
case_yaml = os.path.realpath(__file__).replace('testcase', 'page').replace('py', 'yaml')
case_yaml = os.path.realpath(__file__).replace('testcase', 'page').replace('.py', '.yaml')
case_path = os.path.dirname(case_yaml)
case_dict = read_yaml_data(case_yaml)

View File

@ -28,7 +28,7 @@ if __name__ == '__main__':
elif RC['auto_switch'] == 1:
# 如果扫描路径为空在则取项目page目录
if not os.path.exists(RC['scan_dir']):
if not RC['scan_dir']:
RC['scan_dir'] = PAGE_DIR
logging.info("根据手工编写用例,自动生成测试脚本,然后运行测试!")
writeCase.write_case(RC['scan_dir'], auto_yaml=False)