Commit 3dbd2714 by 文鑫

修改feature为数据源

parent 05746732
...@@ -7,20 +7,23 @@ import pytest ...@@ -7,20 +7,23 @@ import pytest
from common import getSourceId from common import getSourceId
from common.getData import DoExcelByPandas from common.getData import DoExcelByPandas
@allure.feature('系统设置') @allure.feature('数据源')
class TestSystem(): class TestSystem():
parametrize = DoExcelByPandas().get_data_for_pytest('./data/data.xlsx', 'Sheet1') parametrize = DoExcelByPandas().get_data_for_pytest('./data/data.xlsx', 'Sheet1')
@allure.title('{story}') @allure.title('{story}')
@pytest.mark.parametrize('id,url,data,story,method,severity,condition,except_result',parametrize) @pytest.mark.parametrize('id,url,data,story,method,severity,condition,except_result',parametrize)
def test(self,id,url,data,story,method,severity,condition,except_result): # test开头的测试函数 def test(self,id,url,data,story,method,severity,condition,except_result): # test开头的测试函数
url = url url = url
#测试删除数据源接口
if story == '删除mysql数据源' or story == '删除oracle数据源': if story == '删除mysql数据源' or story == '删除oracle数据源':
id = getSourceId.get_SourceId(data) id = getSourceId.get_SourceId(data)
url = url + id url = url + id
r = requests.post(url=url) r = requests.post(url=url)
#测试post接口
elif method == 'post': elif method == 'post':
json = eval(data) json = eval(data)
r = requests.post(url = url,json = json) r = requests.post(url = url,json = json)
#测试get接口
elif method == 'get': elif method == 'get':
r = requests.get(url=url) r = requests.get(url=url)
response = r.json() response = r.json()
......
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