Commit 55845ed0 by billchuan

新增一个用户的测试用例、测试数据

parent 7998a9e0
{
"认证接口": {
"登录系统": {
"LoginSuccess": {
"username": "admin",
"password": "MTIzNDU2"
},
"LoginErrorUsernameIsNone": {
"username": "",
"password": "MTIzNDU2"
},
"LoginErrorPasswordIsNone": {
"username": "admin",
"password": ""
},
"LoginErrorPasswordError": {
"username": "admin",
"password": "MTIzNDU222"
}
}
},
"维度管理": {
"添加维度": {
"AddDemSuccess": {
"code": "wbl_test_dem",
"description": "我的发测试维度",
"isDefault": 0,
"name": "我的发测试维度"
},
"AddDemErrorCodeIsNone": {
"code": "",
"description": "我的发测试维度",
"isDefault": 0,
"name": "我的发测试维度"
}
},
"根据维度编码获取维度信息": {
"GetDemMessageSuccess": {
"code": "wbl_test_dem"
}
}
},
"组织管理": {
"添加组织": {
"AddOrgSuccess": {
"code": "wdf_test_org",
"demId": "不知道",
"exceedLimitNum": 0,
"grade": "",
"limitNum": 0,
"name": "我的发测试组织",
"nowNum": 0,
"orderNo": 0,
"parentId": "0"
},
"AddOrgErrorCodeIsNone": {
"code": "",
"demId": "不知道",
"exceedLimitNum": 0,
"grade": "",
"limitNum": 0,
"name": "我的发测试组织",
"nowNum": 0,
"orderNo": 0,
"parentId": "0"
}
}
}
}
\ No newline at end of file
{
"认证接口": {
"登录系统": {
"LoginSuccess": {
"username": "超级管理",
"account": "admin",
"loginStatus": true
},
"LoginErrorUsernameIsNone": {
"state": false,
"message": "账号或密码错误"
},
"LoginErrorPasswordIsNone": {
"state": false,
"message": "账号或密码错误"
},
"LoginErrorPasswordError": {
"state": false,
"message": "账号或密码错误"
}
}
},
"维度管理": {
"添加维度": {
"AddDemSuccess": {
"state": true,
"message": "添加维度成功!"
},
"AddDemErrorCodeIsNone": {
"state": false,
"message": "添加维度信息失败,维度编码【code】必填!"
}
},
"根据维度编码获取维度信息": {
"GetDemMessageSuccess": {
"demCode": "wbl_test_dem",
"name": "我的发测试维度"
}
}
},
"组织管理": {
"添加组织": {
"AddOrgSuccess": {
"state": true,
"message": "添加组织成功!"
},
"AddOrgErrorCodeIsNone": {
"state": false,
"message": "添加组织失败,组织编码【code】不能为空!"
}
}
}
}
\ No newline at end of file
{
"维度管理": {
"添加维度": {
"AddDemSuccess": "DELETE FROM uc_demension WHERE `CODE_`=\"wbl_test_dem\";"
}
},
"组织管理": {
"添加组织": {
"AddOrgSuccess": {
"select": "SELECT ID_ from uc_demension WHERE `CODE_`=\"wbl_test_dem\";",
"delete": "DELETE FROM uc_org WHERE `CODE_`=\"wbl_test_org\";"
},
"AddOrgErrorCodeIsNone": {
"select": "SELECT ID_ from uc_demension WHERE `CODE_`=\"wbl_test_dem\";",
"delete": "DELETE FROM uc_org WHERE `CODE_`=\"wdf_test_org1\";"
}
}
}
}
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: __init__.py
# Author: xxxxxxx
# Datetime: 2023/11/4 15:37
# Description:
# ---------------------------------------------------------------------------
import pytest
from InterfaceAutoTest_V1.common.db import DB
from InterfaceAutoTest_V1.requests_method.requests_all import RequestsAll
@pytest.fixture(scope='session')
def req_fix():
req = RequestsAll()
yield req
@pytest.fixture(scope='session')
def db_fix():
db = DB()
yield db
db.close()
# def pytest_collection_modifyitems(items):
# # item表示每个测试用例,解决用例名称中文显示问题
# for item in items:
# item.name = item.name.encode("utf-8").decode("unicode-escape")
# item._nodeid = item._nodeid.encode("utf-8").decode("unicode-escape")
import allure
import pytest
from InterfaceAutoTest_v3.common import log
from InterfaceAutoTest_v3.common.read_excel import ReadExcel
class TestBpm:
@allure.epic('BPM系统测试-王菠萝')
@pytest.mark.parametrize(
'module_name,api_name,case_title,case_level,case_url, case_method, case_mime, case_data, expect_data,'
' sql_type,sql_data, update_key',
ReadExcel("BPM-wbl", "wbl/InterfaceAutoTest.xlsx", "wbl/case_data.json", "wbl/expect_data.json", "wbl/sql_data.json").get_data())
def test_bpm(self, db_fix, req_fix, module_name, api_name, case_title, case_level, case_url, case_method, case_mime,
case_data, expect_data, sql_type,
sql_data, update_key):
allure.dynamic.feature(module_name)
allure.dynamic.story(api_name)
allure.dynamic.title(case_title)
allure.dynamic.severity(case_level)
if sql_type == 'delete':
db_fix.delete(sql_data)
elif sql_type == 'select':
case_data[update_key] = db_fix.query(sql_data)
elif sql_type == 'select|delete' or sql_type == 'delete|select':
db_fix.delete(sql_data['delete'])
case_data[update_key] = db_fix.query(sql_data['select'])
res = req_fix.requests_all(req_method=case_method, req_url=case_url, req_mime=case_mime, case_data=case_data)
try:
for key in expect_data:
assert expect_data[key] == res.json()[key]
print('断言成功!!!')
except:
log.error("断言失败" + ",用例数据为:" + str(case_data) + ",期望数据为:" + str(
expect_data) + ",服务器返回的数据为:" + res.text)
raise AssertionError('断言失败!!!')
if __name__ == '__main__':
pytest.main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment