Commit 71a4e837 authored by huangqiang's avatar huangqiang

修改执行的用例配置

parent 89397b26
...@@ -45,10 +45,10 @@ def get_time_name() -> list: ...@@ -45,10 +45,10 @@ def get_time_name() -> list:
# 读取配置文件 # 读取配置文件
def readconf(section, option): def readconf(section, option, config_path="config.conf"):
value = "" value = ""
cf = configparser.ConfigParser() cf = configparser.ConfigParser()
cf.read("config.conf", encoding="utf-8") cf.read(config_path, encoding="utf-8")
if cf.has_option(section, option): if cf.has_option(section, option):
value = cf.get(section, option) value = cf.get(section, option)
else: else:
...@@ -57,10 +57,10 @@ def readconf(section, option): ...@@ -57,10 +57,10 @@ def readconf(section, option):
# 获取执行的用例或用例路径 # 获取执行的用例或用例路径
def get_case_path(section): def get_case_path(section, config_path="run.conf"):
values = [] values = []
cf = configparser.ConfigParser() cf = configparser.ConfigParser()
cf.read("run.conf", encoding="utf-8") cf.read(config_path, encoding="utf-8")
if cf.has_section(section): if cf.has_section(section):
items = cf.items(section) items = cf.items(section)
for item in items: for item in items:
...@@ -72,12 +72,12 @@ def get_case_path(section): ...@@ -72,12 +72,12 @@ def get_case_path(section):
# 更新配置文件 # 更新配置文件
def update_conf(section, option, value): def update_conf(section, option, value, config_path="config.conf"):
cf = configparser.ConfigParser() cf = configparser.ConfigParser()
cf.read("config.conf", encoding="utf-8") cf.read(config_path, encoding="utf-8")
if cf.has_option(section, option): if cf.has_option(section, option):
cf.set(section, option, value) cf.set(section, option, value)
cf.write(open("config.conf", "w")) cf.write(open(config_path, "w"))
else: else:
print("section, option,value值错误:", section+" "+option+" "+value) print("section, option,value值错误:", section+" "+option+" "+value)
......
...@@ -9,10 +9,10 @@ reportpath = report/ ...@@ -9,10 +9,10 @@ reportpath = report/
web_hook = https://oapi.dingtalk.com/robot/send?access_token=94b76afb5b538437e9986e95bd9e4c882cfcf3c75e8c1b3a6f209cac403b8e00 web_hook = https://oapi.dingtalk.com/robot/send?access_token=94b76afb5b538437e9986e95bd9e4c882cfcf3c75e8c1b3a6f209cac403b8e00
[token] [token]
token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIyNTc0ODgiLCJ0ZXJtaW5hbCI6InBjIiwidXVpZCI6IjIwNDFlZmNjNWNmZjRlNTlhZTkzNWY0YjhkODQ3MzhlIiwidGltZXN0YW1wIjoxNTc0NjY2NjQwODU3fQ._G5B9sI238xlT6sAkJ3ou15Qj3HXUIleF4UhJ48YdeY token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIyNTc0ODgiLCJ0ZXJtaW5hbCI6InBjIiwidXVpZCI6ImMxZmYwYzM0NWU5OTRmZWJhZWRiZTE3YjY4YWE0YmZkIiwidGltZXN0YW1wIjoxNTc0NjY3NzUxMDM4fQ.TsobEylOLhkayoGSPWMXy9SrGCrRyFrQ-wgX9H7ROi0
[password] [password]
wan_neng_password = A0S7f14f94e7-dcc wan_neng_password =
[user] [user]
phone = 15300000000 phone = 15300000000
......
[test] [test]
student_new = reception/testsuites/apply_stuent_new.yml login = login/testsuites/login.yml
\ No newline at end of file #student_new = reception/testsuites/apply_stuent_new.yml
\ No newline at end of file
...@@ -21,7 +21,7 @@ def run(): ...@@ -21,7 +21,7 @@ def run():
# mapping=override_mapping # mapping=override_mapping
for test_case_path in path_or_testcases: for test_case_path in path_or_testcases:
runner.run(test_case_path) runner.run(test_case_path)
dingdingmessage.send_result_message(runner.summary) # dingdingmessage.send_result_message(runner.summary)
send_email = SendEmail() send_email = SendEmail()
subject = common.get_time_name()[0] + "接口测试报告" subject = common.get_time_name()[0] + "接口测试报告"
attachments = [] attachments = []
...@@ -35,8 +35,8 @@ if __name__ == "__main__": ...@@ -35,8 +35,8 @@ if __name__ == "__main__":
gd = getdata.GetData() gd = getdata.GetData()
phone = common.readconf("user", "phone") phone = common.readconf("user", "phone")
password = common.readconf("user", "password") password = common.readconf("user", "password")
gd.set_token(phone, password) # gd.set_token(phone, password)
# gd.set_wan_neng_password(phone, password) gd.set_wan_neng_password(phone, password)
run() run()
......
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