Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
774b6f92
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
774b6f92
编写于
4月 01, 2014
作者:
L
Lucas Meneghel Rodrigues
提交者:
Lucas Meneghel Rodrigues
4月 01, 2014
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7 from ruda/test_result
Add support for Test Results report.
上级
2309241b
d2cadfb0
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
86 addition
and
16 deletion
+86
-16
avocado/job.py
avocado/job.py
+8
-16
avocado/result.py
avocado/result.py
+78
-0
未找到文件。
avocado/job.py
浏览文件 @
774b6f92
...
...
@@ -10,6 +10,7 @@ from avocado.core import data_dir
from
avocado.core
import
output
from
avocado
import
test
from
avocado
import
sysinfo
from
avocado
import
result
JOB_STATUSES
=
{
"TEST_NA"
:
False
,
"ABORT"
:
False
,
...
...
@@ -108,24 +109,15 @@ class Job(object):
if
urls
is
None
:
urls
=
self
.
args
.
url
.
split
()
total_tests
=
len
(
urls
)
self
.
output_manager
.
start_file_logging
(
self
.
debuglog
,
self
.
loglevel
)
self
.
output_manager
.
log_header
(
"DEBUG LOG: %s"
%
self
.
debuglog
)
self
.
output_manager
.
log_header
(
"TOTAL TESTS: %s"
%
total_tests
)
self
.
output_mapping
=
{
'PASS'
:
self
.
output_manager
.
log_pass
,
'FAIL'
:
self
.
output_manager
.
log_fail
,
'TEST_NA'
:
self
.
output_manager
.
log_skip
,
'WARN'
:
self
.
output_manager
.
log_warn
}
test_result
=
result
.
TestResult
(
stream
=
self
.
output_manager
,
debuglog
=
self
.
debuglog
,
loglevel
=
self
.
loglevel
,
tests_total
=
len
(
urls
))
test_result
.
start_tests
()
for
url
in
urls
:
test_instance
=
self
.
run_test
(
url
)
output_func
=
self
.
output_mapping
[
test_instance
.
status
]
label
=
"(%s/%s) %s:"
%
(
self
.
test_index
,
total_tests
,
test_instance
.
tagged_name
)
output_func
(
label
,
test_instance
.
time_elapsed
)
self
.
test_index
+=
1
self
.
output_manager
.
stop_file_logging
()
test_result
.
check_test
(
test_instance
)
test_result
.
end_tests
()
class
TestModuleRunner
(
object
):
...
...
avocado/result.py
0 → 100644
浏览文件 @
774b6f92
"""Test result module."""
class
TestResult
(
object
):
"""
Test result class, holder for test result information.
"""
def
__init__
(
self
,
stream
,
debuglog
,
loglevel
,
tests_total
):
self
.
stream
=
stream
self
.
debuglog
=
debuglog
self
.
loglevel
=
loglevel
self
.
tests_run
=
0
self
.
tests_total
=
tests_total
self
.
total_time
=
0.0
self
.
passed
=
[]
self
.
failed
=
[]
self
.
skipped
=
[]
self
.
warned
=
[]
def
start_tests
(
self
):
'Called once before any tests are executed.'
self
.
stream
.
start_file_logging
(
self
.
debuglog
,
self
.
loglevel
)
self
.
stream
.
log_header
(
"DEBUG LOG: %s"
%
self
.
debuglog
)
self
.
stream
.
log_header
(
"TOTAL TESTS: %s"
%
self
.
tests_total
)
self
.
tests_run
+=
1
def
end_tests
(
self
):
'Called once after all tests are executed.'
self
.
stream
.
log_header
(
"TOTAL PASSED: %d"
%
len
(
self
.
passed
))
self
.
stream
.
log_header
(
"TOTAL FAILED: %d"
%
len
(
self
.
failed
))
self
.
stream
.
log_header
(
"TOTAL SKIPPED: %d"
%
len
(
self
.
skipped
))
self
.
stream
.
log_header
(
"TOTAL WARNED: %d"
%
len
(
self
.
warned
))
self
.
stream
.
log_header
(
"ELAPSED TIME: %.2f s"
%
self
.
total_time
)
self
.
stream
.
stop_file_logging
()
def
start_test
(
self
,
test
):
'Called when the given test is about to be run.'
self
.
test_label
=
'(%s/%s) %s: '
%
(
self
.
tests_run
,
self
.
tests_total
,
test
.
tagged_name
)
def
end_test
(
self
,
test
):
'Called when the given test has been run.'
self
.
tests_run
+=
1
self
.
total_time
+=
test
.
time_elapsed
def
add_pass
(
self
,
test
):
'Called when a test succeed.'
self
.
stream
.
log_pass
(
self
.
test_label
,
test
.
time_elapsed
)
self
.
passed
.
append
(
test
)
def
add_fail
(
self
,
test
):
'Called when a test fails.'
self
.
stream
.
log_fail
(
self
.
test_label
,
test
.
time_elapsed
)
self
.
failed
.
append
(
test
)
def
add_skip
(
self
,
test
):
'Called when a test is skipped.'
self
.
stream
.
log_skip
(
self
.
test_label
,
test
.
time_elapsed
)
self
.
skipped
.
append
(
test
)
def
add_warn
(
self
,
test
):
'Called when a test warns.'
self
.
stream
.
log_warn
(
self
.
test_label
,
test
.
time_elapsed
)
self
.
warned
.
append
(
test
)
def
check_test
(
self
,
test
):
'Called once for a test to check status and report.'
self
.
start_test
(
test
)
status_map
=
{
'PASS'
:
self
.
add_pass
,
'FAIL'
:
self
.
add_fail
,
'TEST_NA'
:
self
.
add_skip
,
'WARN'
:
self
.
add_warn
}
add
=
status_map
[
test
.
status
]
add
(
test
)
self
.
end_test
(
test
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录