Skip to content

Commit

Permalink
Merge pull request #27 from guyingzhao/master
Browse files Browse the repository at this point in the history
1.修复html报告展示不正确的问题
2.修复报告中用例执行时间和超时时间显示错误
3.加载settings不打印堆栈,而是提示一行warning
  • Loading branch information
guyingzhao committed Jan 4, 2019
2 parents 7852381 + c9a692a commit 64e1b0e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
13 changes: 9 additions & 4 deletions statics/qta-report.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion test/test_testbase/test_report.py
Expand Up @@ -146,7 +146,6 @@ def test_html_report(self):
("TimeoutTest", "用例执行超时"),
("CrashTest", "App Crash"),
("QT4iTest", "run_test执行失败"),]
test_pairs = test_pairs[:1]

old_cwd = os.getcwd()
for test_name, reason in test_pairs:
Expand Down
10 changes: 4 additions & 6 deletions testbase/conf.py
Expand Up @@ -69,9 +69,8 @@ def _load(self):
#先加载一次项目配置
try:
pre_settings = self._load_proj_settings_module("testbase.conf.pre_settings")
except ImportError: #非测试项目情况下使用没有项目settings.py
stack = traceback.format_exc()
logger.warn("settings module not found:\n%s" % stack)
except ImportError as e: #非测试项目情况下使用没有项目settings.py
logger.warn("[WARNING]settings module not found: %s" % str(e))
pre_settings = None

mode = getattr(pre_settings, "PROJECT_MODE", getattr(qtaf_settings, 'PROJECT_MODE', None))
Expand All @@ -91,9 +90,8 @@ def _load(self):
modname = "%s.settings" % appname
try:
__import__(modname)
except ImportError:
stack = traceback.format_exc()
logger.warn("load library settings module \"%s\" failed:\n%s" % (modname, stack))
except ImportError as e:
logger.warn("[WARN]load library settings module \"%s\" failed: %s" % (modname, str(e)))
else:
self._load_setting_from_module(sys.modules[modname])

Expand Down
3 changes: 2 additions & 1 deletion testbase/testresult.py
Expand Up @@ -629,6 +629,7 @@ def __init__(self, testcase):
"owner": testcase.owner,
"priority": testcase.priority,
"status": testcase.status,
"timeout": testcase.timeout,
"steps": self._steps
}
self._translated_name = translate_test_name(testcase.test_name)
Expand Down Expand Up @@ -661,7 +662,7 @@ def handle_test_end(self, passed ):
'''
self._data["succeed"] = passed
self._data["start_time"] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(self.begin_time)),
self._data["end_time"] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(self.begin_time)),
self._data["end_time"] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(self.end_time)),

def handle_step_begin(self, msg ):
'''处理一个测试步骤的开始
Expand Down

0 comments on commit 64e1b0e

Please sign in to comment.