Commit 0b746091 by sanshi

优化pytest类

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