Commit c9d15a74 by liangyan10
parents 2e756abc 836e63b5
...@@ -97,13 +97,12 @@ def send_dingding(product_name): ...@@ -97,13 +97,12 @@ def send_dingding(product_name):
if product_name == BmyConfig.name: if product_name == BmyConfig.name:
dingTalk_markdown_bmy(BaseConfig.bmy_group) # 给交委项目相关群发送钉钉 dingTalk_markdown_bmy(BaseConfig.bmy_group) # 给交委项目相关群发送钉钉
if product_name == SSOConfig.name: if product_name == SSOConfig.name:
pass dingTalk_markdown_sso(BaseConfig.sso_group)
# 交委 # 交委
if product_name == SafeTransportationConfig.name: if product_name == SafeTransportationConfig.name:
dingTalk_markdown_safe_transportation(BaseConfig.bmy_group) dingTalk_markdown_safe_transportation(BaseConfig.bmy_group)
def get_run(envrioment): def get_run(envrioment):
"""根据传入环境名字,来填入环境配置""" """根据传入环境名字,来填入环境配置"""
pass pass
\ No newline at end of file
...@@ -86,7 +86,7 @@ def dingTalk_markdown_bmy(group): ...@@ -86,7 +86,7 @@ def dingTalk_markdown_bmy(group):
"markdown": { "markdown": {
"title":"接口执行报告", "title":"接口执行报告",
"text": f"#### 接口自动化测试报告 \n> 本消息由Jenkins构建后自动发送\n> \ "text": f"#### 接口自动化测试报告 \n> 本消息由Jenkins构建后自动发送\n> \
![screenshot](https://aqjg.gyszhjt.com:60028/img/group1/M00/00/04/Cgs5XWD2NrOACeeHAAhEU1jS9Xc475.png)\n> ###### 点击查看 >> [安全运输](http://10.197.236.10:8080/job/bmy/allure/) \n" \n> ###### 点击查看 >> [企业云测试报告](http://10.197.236.10:8080/job/bmy/allure/) \n"
}, },
'at': {'isAtAll': False}} 'at': {'isAtAll': False}}
post_data = json.dumps(data) post_data = json.dumps(data)
...@@ -103,14 +103,34 @@ def dingTalk_markdown_safe_transportation(group): ...@@ -103,14 +103,34 @@ def dingTalk_markdown_safe_transportation(group):
"markdown": { "markdown": {
"title":"接口执行报告", "title":"接口执行报告",
"text": f"#### 接口自动化测试报告 \n> 本消息由Jenkins构建后自动发送\n> \ "text": f"#### 接口自动化测试报告 \n> 本消息由Jenkins构建后自动发送\n> \
![screenshot](https://img.banmago.com/group2/M00/06/BB/rBrpX2El37CASho8ABlIIu9o6i4942.png)\n> ###### 点击查看 >> [交委安全运输监管平台](http://10.197.236.10:8080/job/safe_transportation/allure/) \n" \n> ###### 点击查看 >> [交委安全运输监管平台](http://10.197.236.10:8080/job/safe_transportation/allure/) \n"
}, },
'at': {'isAtAll': False}} 'at': {'isAtAll': False}}
post_data = json.dumps(data) post_data = json.dumps(data)
requests.post(webhook, headers=BaseConfig.headers, data=post_data) requests.post(webhook, headers=BaseConfig.headers, data=post_data)
def dingTalk_markdown_sso(group):
for i in group:
"""发送消息到钉钉群(sso)"""
timestamp = str(round(time.time() * 1000))
sign=get_sign(i["secret"])
webhook=i["webhook"]+f"&timestamp={timestamp}&sign={sign}"
now_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M')
data = {'msgtype': 'markdown',
"markdown": {
"title":"接口执行报告",
"text": f"#### 接口自动化测试报告 \n> 本消息由Jenkins构建后自动发送\n> \
\n> ###### 点击查看 >> [统一登录平台](http://10.197.236.10:8080/job/sso/allure/) \n"
},
'at': {'isAtAll': False}}
post_data = json.dumps(data)
requests.post(webhook, headers=BaseConfig.headers, data=post_data)
# """ 通用 (未调试)""" # """ 通用 (未调试)"""
# (https://img.banmago.com/group2/M00/06/BB/rBrpX2El37CASho8ABlIIu9o6i4942.png)
# def dingTalk_markdown(group,picture,title,allureurl): # def dingTalk_markdown(group,picture,title,allureurl):
# for i in group: # for i in group:
# timestamp = str(round(time.time() * 1000)) # timestamp = str(round(time.time() * 1000))
...@@ -149,6 +169,6 @@ if __name__ == '__main__': ...@@ -149,6 +169,6 @@ if __name__ == '__main__':
{"secret": "SEC465015385218e70a94f107a16f72dd33d8fc118c3b2a631e0433685302f2fbb3", {"secret": "SEC465015385218e70a94f107a16f72dd33d8fc118c3b2a631e0433685302f2fbb3",
"webhook": "https://oapi.dingtalk.com/robot/send?access_token=229908a83825ed56abbf728d3382e446a4e8a90e9ad302c37a036bcbccbbf9ee", "webhook": "https://oapi.dingtalk.com/robot/send?access_token=229908a83825ed56abbf728d3382e446a4e8a90e9ad302c37a036bcbccbbf9ee",
"group": "自动化小组"}] "group": "自动化小组"}]
dingTalk_markdown_safe_transportation(bmy_group) dingTalk_markdown_bmy(test_group)
# dingTalk_markdown(test_group,"https://aqjg.gyszhjt.com:60028/img/group1/M00/00/04/Cgs5XWD2NrOACeeHAAhEU1jS9Xc475.png","交委项目","http://10.197.236.10:8080/job/bmc/allure/") # dingTalk_markdown(test_group,"https://aqjg.gyszhjt.com:60028/img/group1/M00/00/04/Cgs5XWD2NrOACeeHAAhEU1jS9Xc475.png","交委项目","http://10.197.236.10:8080/job/bmc/allure/")
\ No newline at end of file
...@@ -6,7 +6,7 @@ class BaseConfig(): ...@@ -6,7 +6,7 @@ class BaseConfig():
# 请求头 # 请求头
headers = {'Content-Type': 'application/json'} headers = {'Content-Type': 'application/json'}
# 当前运行的产品名 #auto # 当前运行的产品名 #auto
current_name = "sso" current_name = "sTransport"
test_case_dir = "test_case/" test_case_dir = "test_case/"
secs=0.1 # 测试用例间隔运行时间 secs=0.1 # 测试用例间隔运行时间
...@@ -32,6 +32,11 @@ class BaseConfig(): ...@@ -32,6 +32,11 @@ class BaseConfig():
"group": "测试序列"} "group": "测试序列"}
] ]
# 统一登录平台钉钉发送群
sso_group=[{"secret": "SEC7714672a0be0239dbff12083d6beca3961490f1f5384c616ea259015d7e71cd1",
"webhook": "https://oapi.dingtalk.com/robot/send?access_token=10baf66992f12849793666ee882569bf50d313e9c070ab1afbff25cb9ffcd567",
"group": "测试序列"}]
# 日志相关 # 日志相关
log_path = r'' # 日志路径 log_path = r'' # 日志路径
......
...@@ -35,4 +35,5 @@ urllib3==1.25.11; python_version >= '2.7' and python_version not in '3.0, 3.1, 3 ...@@ -35,4 +35,5 @@ urllib3==1.25.11; python_version >= '2.7' and python_version not in '3.0, 3.1, 3
xlrd==1.2.0 xlrd==1.2.0
zipp==3.4.1; python_version >= '3.6' zipp==3.4.1; python_version >= '3.6'
dict==2020.12.3 dict==2020.12.3
config==0.5.1
...@@ -91,7 +91,7 @@ class TestEnterpriseArchives(): ...@@ -91,7 +91,7 @@ class TestEnterpriseArchives():
assert res['code'] == expectData['code'] assert res['code'] == expectData['code']
@allure.story("关键指标风险明细") @allure.story("关键指标风险明细")
@allure.title("inData[testPoint]") @allure.title("{inData[testPoint]}")
@allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85272") @allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85272")
@allure.description("/enterprise-archives/keyIndicatorsRiskDetail") @allure.description("/enterprise-archives/keyIndicatorsRiskDetail")
@pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","enterpriseArchiveIndicatorsRisk")) @pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","enterpriseArchiveIndicatorsRisk"))
...@@ -106,7 +106,7 @@ class TestEnterpriseArchives(): ...@@ -106,7 +106,7 @@ class TestEnterpriseArchives():
assert res['code'] == expectData['code'] assert res['code'] == expectData['code']
@allure.story("关键指标信息") @allure.story("关键指标信息")
@allure.title("inData[testPoint]") @allure.title("{inData[testPoint]}")
@allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85321") @allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85321")
@allure.description("/enterprise-archives/safeProductionStat") @allure.description("/enterprise-archives/safeProductionStat")
@pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","enterpriseArchiveIndicators")) @pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","enterpriseArchiveIndicators"))
...@@ -121,7 +121,7 @@ class TestEnterpriseArchives(): ...@@ -121,7 +121,7 @@ class TestEnterpriseArchives():
assert res['code'] == expectData['code'] assert res['code'] == expectData['code']
@allure.story("关键指标变化趋势") @allure.story("关键指标变化趋势")
@allure.title("inData[testPoint]") @allure.title("{inData[testPoint]}")
@allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85335") @allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85335")
@allure.description("/enterprise-archives/keyIndicatorsTimeTrend") @allure.description("/enterprise-archives/keyIndicatorsTimeTrend")
@pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","enterpriseArchiveIndicatorsTrend")) @pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","enterpriseArchiveIndicatorsTrend"))
...@@ -136,7 +136,7 @@ class TestEnterpriseArchives(): ...@@ -136,7 +136,7 @@ class TestEnterpriseArchives():
assert res['code'] == expectData['code'] assert res['code'] == expectData['code']
@allure.story("关键指标统计报表") @allure.story("关键指标统计报表")
@allure.title("inData[testPoint]") @allure.title("{inData[testPoint]}")
@allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85328") @allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85328")
@allure.description("/enterprise-archives/keyIndicatorsReport") @allure.description("/enterprise-archives/keyIndicatorsReport")
@pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","enterpriseArchiveIndicatorsReport")) @pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","enterpriseArchiveIndicatorsReport"))
...@@ -152,7 +152,7 @@ class TestEnterpriseArchives(): ...@@ -152,7 +152,7 @@ class TestEnterpriseArchives():
@allure.story("关键指标风险详情") @allure.story("关键指标风险详情")
@allure.title("inData[testPoint]") @allure.title("{inData[testPoint]}")
@allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85342") @allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85342")
@allure.description("/enterprise-archives/riskDetail") @allure.description("/enterprise-archives/riskDetail")
@pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","enterpriseArchiveRisk")) @pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","enterpriseArchiveRisk"))
...@@ -168,7 +168,7 @@ class TestEnterpriseArchives(): ...@@ -168,7 +168,7 @@ class TestEnterpriseArchives():
@allure.story("获取风险类型") @allure.story("获取风险类型")
@allure.title("inData[testPoint]") @allure.title("{inData[testPoint]}")
@allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/67617") @allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/67617")
@allure.description("/dic/getRisk?fromStatPage=true") @allure.description("/dic/getRisk?fromStatPage=true")
@pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","enterpriseArchiveGetRisk")) @pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","enterpriseArchiveGetRisk"))
...@@ -183,7 +183,7 @@ class TestEnterpriseArchives(): ...@@ -183,7 +183,7 @@ class TestEnterpriseArchives():
assert res['code'] == expectData['code'] assert res['code'] == expectData['code']
@allure.story("驾驶人档案列表") @allure.story("驾驶人档案列表")
@allure.title("inData[testPoint]") @allure.title("{inData[testPoint]}")
@allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/69873") @allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/69873")
@allure.description("/driver-archives/query") @allure.description("/driver-archives/query")
@pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","driverArchivesQuery")) @pytest.mark.parametrize("inData",get_excelData(workBook,"全息档案","driverArchivesQuery"))
...@@ -198,7 +198,7 @@ class TestEnterpriseArchives(): ...@@ -198,7 +198,7 @@ class TestEnterpriseArchives():
assert res['code'] == expectData['code'] assert res['code'] == expectData['code']
@allure.story("驾驶人档案详情") @allure.story("驾驶人档案详情")
@allure.title("inData[testPoint]") @allure.title("{inData[testPoint]}")
@allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85384") @allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85384")
@allure.description("/drivers/page") @allure.description("/drivers/page")
@pytest.mark.parametrize("inData", get_excelData(workBook, "全息档案", "driverArchivesDrivers")) @pytest.mark.parametrize("inData", get_excelData(workBook, "全息档案", "driverArchivesDrivers"))
...@@ -213,7 +213,7 @@ class TestEnterpriseArchives(): ...@@ -213,7 +213,7 @@ class TestEnterpriseArchives():
assert res['code'] == expectData['code'] assert res['code'] == expectData['code']
@allure.story("驾驶人特征") @allure.story("驾驶人特征")
@allure.title("inData[testPoint]") @allure.title("{inData[testPoint]}")
@allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85307") @allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85307")
@allure.description("/driver-archives/driverFeatureStat") @allure.description("/driver-archives/driverFeatureStat")
@pytest.mark.parametrize("inData", get_excelData(workBook, "全息档案", "driverArchivesFeature")) @pytest.mark.parametrize("inData", get_excelData(workBook, "全息档案", "driverArchivesFeature"))
...@@ -228,7 +228,7 @@ class TestEnterpriseArchives(): ...@@ -228,7 +228,7 @@ class TestEnterpriseArchives():
assert res['code'] == expectData['code'] assert res['code'] == expectData['code']
@allure.story("驾驶人关联车辆") @allure.story("驾驶人关联车辆")
@allure.title("inData[testPoint]") @allure.title("{inData[testPoint]}")
@allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85314") @allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85314")
@allure.description("/driver-archives/associatedVehicle") @allure.description("/driver-archives/associatedVehicle")
@pytest.mark.parametrize("inData", get_excelData(workBook, "全息档案", "driverArchivesAssociatedVehicle")) @pytest.mark.parametrize("inData", get_excelData(workBook, "全息档案", "driverArchivesAssociatedVehicle"))
...@@ -243,7 +243,7 @@ class TestEnterpriseArchives(): ...@@ -243,7 +243,7 @@ class TestEnterpriseArchives():
assert res['code'] == expectData['code'] assert res['code'] == expectData['code']
@allure.story("驾驶人关联企业") @allure.story("驾驶人关联企业")
@allure.title("inData[testPoint]") @allure.title("{inData[testPoint]}")
@allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85293") @allure.testcase("http://yapi.hikcreate.com/project/336/interface/api/85293")
@allure.description("/vehicle-archives/driverAssociatedEnterprise") @allure.description("/vehicle-archives/driverAssociatedEnterprise")
@pytest.mark.parametrize("inData", get_excelData(workBook, "全息档案", "driverArchivesAssociatedEnterprise")) @pytest.mark.parametrize("inData", get_excelData(workBook, "全息档案", "driverArchivesAssociatedEnterprise"))
......
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