Commit 2dfd039c authored by huangqiang's avatar huangqiang

修改执行方式

parent 07e35650
......@@ -19,7 +19,8 @@ def validate_ip(ip_str) -> bool:
# 更新配置文件的数据
def update_address(address: str):
def update_address(address: list):
if len(address) == 2:
if address == "geek.jkwljy.com":
update_conf("host", "host", address)
elif address:
......@@ -28,7 +29,10 @@ def update_address(address: str):
else:
print("IP地址错误:", address)
else:
print("未输入IP地址,使用默认IP地址:192.168.32.41:3000")
print("未输入IP地址,使用默认IP地址")
else:
print("未输入IP地址,使用默认IP地址")
# 获取时间格式名称
......@@ -53,6 +57,21 @@ def readconf(section, option):
return value
# 获取执行的用例或用例路径
def get_case_path(section):
values = []
cf = configparser.ConfigParser()
cf.read("config.conf", encoding="utf-8")
if cf.has_section(section):
items = cf.items(section)
for item in items:
value = item[1]
values.append(value)
else:
print("section值错误:", section)
return values
# 更新配置文件
def update_conf(section, option, value):
cf = configparser.ConfigParser()
......
......@@ -9,7 +9,7 @@ reportpath = report/
web_hook = https://oapi.dingtalk.com/robot/send?access_token=94b76afb5b538437e9986e95bd9e4c882cfcf3c75e8c1b3a6f209cac403b8e00
[token]
token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIyNTc0ODgiLCJ0ZXJtaW5hbCI6InBjIiwidXVpZCI6IjZhMTgxYmFmMDllNjRkZjQ5MDdhNDg3M2M5NDQ0NWNlIiwidGltZXN0YW1wIjoxNTc0MzE5NDEzNDE1fQ.FnymeuiIkTflj1UcCgfq3DxrDBeJ-TwcJz4pc_xIxdw
token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiIyNTc0ODgiLCJ0ZXJtaW5hbCI6InBjIiwidXVpZCI6Ijg2OTE0YzkzNDQwYjQ5OTE5NGNkOGZiNTI4NTE2MWQ3IiwidGltZXN0YW1wIjoxNTc0NDA4NjQ3MDIwfQ.zT32vh1ZIc7iwKnZAaS452-oyMjQB5JUAhTeyCo9PFM
[password]
wan_neng_password = A0S7f14f94e7-dcc
......@@ -19,6 +19,5 @@ phone = 15300000000
password = Abc123!
[test]
login = login/testsuites/
teach_manage = teach_manage/testsuites/
student_new = reception/testsuites/apply_stuent_new.yml
......@@ -79,7 +79,7 @@ def send_result_message(summary: str):
"teststep_errors": teststeps["errors"],
"teststep_skipped": teststeps["skipped"],
"start_datetime": time["start_datetime"],
"duration_time": time["duration"][:8]
"duration_time": (str(time["duration"])[:8])
}
markdown_template = string.Template(get_markdown_template())
markdown = markdown_template.safe_substitute(**messagedata)
......
......@@ -34,10 +34,12 @@ def get_student_data(attendSchool, schoolArea=3015, entrancePaper="", introducer
return student_data
def test(re):
print(dir(re))
print(type(re.text))
def is_skip():
flag = None
host = common.readconf("host", "host")
if host == "geek.jkwljy.com" or host == "132.232.15.12":
flag = True
else:
flag = False
return flag
......@@ -13,17 +13,20 @@ def run():
report_name = common.get_time_name()[1] + "_test.html"
runner = HttpRunner(report_dir=report_path, log_level="INFO",
log_file=log_path, report_file=report_name, failfast=True)
# 测试用例路径
path_or_testcases = "reception/testsuites/apply_stuent_new.yml"
dot_env_path = ""
path_or_testcases = common.get_case_path("test")
# dot_env_path = ""
# 变量映射,可用于对传入测试用例中的变量进行覆盖替换。
# mapping=override_mapping
runner.run(path_or_testcases)
for test_case_path in path_or_testcases:
runner.run(test_case_path)
# dingdingmessage.send_result_message(runner.summary)
if __name__ == "__main__":
common.update_address(sys.argv[1])
common.update_address(sys.argv)
gd = getdata.GetData()
phone = common.readconf("user", "phone")
password = common.readconf("user", "password")
......
......@@ -18,7 +18,7 @@ def get_token():
variables = {
"course_name" : "测试课程名称"
"course_name": "测试课程名称"
}
......
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