Commit 0b746091 by sanshi

优化pytest类

parent 90b1365a
......@@ -76,6 +76,7 @@
<w>wechat</w>
<w>zabbix</w>
<w>zmops</w>
<w>zmpos</w>
</words>
</dictionary>
</component>
\ No newline at end of file
......@@ -7,7 +7,7 @@
class CaseBase:
def __init__(self):
# self.base_path = "D:\\TestZmpos\\WorkCase"
self.base_path = "D:\\TestZmpos\\WorkCase"
self.environment = {
# "host": "http://10.0.0.12:7070",
......
......@@ -58,7 +58,7 @@ class UtilsCmd:
environment = None
path = None
try:
opts, args = getopt.getopt(sys.argv[1:], "hv:e:p;")
opts, args = getopt.getopt(sys.argv[1:], "hv:e:p:")
for op, value in opts:
if op == "-v":
version = value
......@@ -66,6 +66,7 @@ class UtilsCmd:
environment = value
elif op == "-p":
path = value.replace("/", "\\")
# path = value
elif op == "-h":
# 帮助信息
self.usage()
......@@ -75,8 +76,11 @@ class UtilsCmd:
except getopt.GetoptError as e:
self.log.error("出现ERROR:")
self.log.error(e)
return {
_json = {
"version": version,
"environment": environment,
"path": path
}
self.log.info(_json)
return _json
......@@ -11,6 +11,7 @@ import os
from datetime import datetime
from WorkBase import WorkBase
from WorkCase import CaseBase
from WorkUtils.UtilsLog import UtilsLog
......@@ -29,6 +30,7 @@ class UtilsPyTest:
self.case = case
self.version = self.case["version"]
self.case_path = CaseBase().base_path
self.case_info = case_info
self.xml_path = ""
......@@ -51,7 +53,7 @@ class UtilsPyTest:
self.xml_path = WorkBase().report_path + self.version + "\\" + str(self.case_name)[0:-3] + "\\" + self.create_time + "\\"
else:
self.log.debug("多个用例文件运行模式")
self.case_name = self.case["path"]
self.case_name = self.case_path + self.case["path"]
self.log.debug("测试路径:%s" % self.case_name)
self.xml_path = WorkBase().report_path + self.version + "\\" + "Zmpos" + "\\" + self.create_time + "\\"
......
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