Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
8e2520da
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,发现更多精彩内容 >>
提交
8e2520da
编写于
8月 09, 2016
作者:
A
Ademar de Souza Reis Jr
提交者:
GitHub
8月 09, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1362 from clebergnu/json_pretty
JSON Result: output the result in pretty format
上级
d2f3ac55
e13734f5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
25 deletion
+27
-25
avocado/plugins/jsonresult.py
avocado/plugins/jsonresult.py
+4
-1
docs/source/ResultFormats.rst
docs/source/ResultFormats.rst
+23
-24
未找到文件。
avocado/plugins/jsonresult.py
浏览文件 @
8e2520da
...
...
@@ -52,7 +52,10 @@ class JSONResult(Result):
'failures'
:
result
.
failed
,
'skip'
:
result
.
skipped
,
'time'
:
result
.
tests_total_time
}
return
json
.
dumps
(
content
)
return
json
.
dumps
(
content
,
sort_keys
=
True
,
indent
=
4
,
separators
=
(
','
,
': '
))
def
render
(
self
,
result
,
job
):
if
not
(
hasattr
(
job
.
args
,
'json_job_result'
)
or
...
...
docs/source/ResultFormats.rst
浏览文件 @
8e2520da
...
...
@@ -114,57 +114,52 @@ json Avocado plugin outputs job information, similarly to the xunit output
plugin::
$ avocado run sleeptest.py failtest.py synctest.py --json -
{"tests": [{"status": "PASS", "url": "1-sleeptest.py:SleepTest.test", "logfile": "/home/medic/avocado/job-results/job-2016-05-04T14.51-74e01c8/test-results/1-sleeptest.py:SleepTest.test/debug.log", "whiteboard": "", "end": 1462366291.95844, "logdir": "/home/medic/avocado/job-results/job-2016-05-04T14.51-74e01c8/test-results/1-sleeptest.py:SleepTest.test", "start": 1462366290.957374, "test": "1-sleeptest.py:SleepTest.test", "fail_reason": "None", "time": 1.001065969467163}, {"status": "FAIL", "url": "2-failtest.py:FailTest.test", "logfile": "/home/medic/avocado/job-results/job-2016-05-04T14.51-74e01c8/test-results/2-failtest.py:FailTest.test/debug.log", "whiteboard": "", "end": 1462366291.980557, "logdir": "/home/medic/avocado/job-results/job-2016-05-04T14.51-74e01c8/test-results/2-failtest.py:FailTest.test", "start": 1462366291.977591, "test": "2-failtest.py:FailTest.test", "fail_reason": "This test is supposed to fail", "time": 0.0029659271240234375}, {"status": "PASS", "url": "3-synctest.py:SyncTest.test", "logfile": "/home/medic/avocado/job-results/job-2016-05-04T14.51-74e01c8/test-results/3-synctest.py:SyncTest.test/debug.log", "whiteboard": "", "end": 1462366294.713253, "logdir": "/home/medic/avocado/job-results/job-2016-05-04T14.51-74e01c8/test-results/3-synctest.py:SyncTest.test", "start": 1462366291.995889, "test": "3-synctest.py:SyncTest.test", "fail_reason": "None", "time": 2.7173640727996826}], "errors": 0, "job_id": "74e01c82c95009e7d126b4fd60d5e3c615aa7539", "skip": 0, "time": 3.721395969390869, "debuglog": "/home/medic/avocado/job-results/job-2016-05-04T14.51-74e01c8/job.log", "pass": 2, "failures": 1, "total": 3}
Alternatively human-readable version using `json.tool`::
$ avocado run sleeptest.py failtest.py synctest.py --json - | python -m json.tool
{
"debuglog": "/home/
medic/avocado/job-results/job-2016-05-04T14.51-74e01c8
/job.log",
"debuglog": "/home/
cleber/avocado/job-results/job-2016-08-09T13.53-10715c4
/job.log",
"errors": 0,
"failures": 1,
"job_id": "
74e01c82c95009e7d126b4fd60d5e3c615aa7539
",
"job_id": "
10715c4645d2d2b57889d7a4317fcd01451b600e
",
"pass": 2,
"skip": 0,
"tests": [
{
"end": 14
62366291.9584
4,
"end": 14
70761623.17695
4,
"fail_reason": "None",
"logdir": "/home/
medic/avocado/job-results/job-2016-05-04T14.51-74e01c8
/test-results/1-sleeptest.py:SleepTest.test",
"logfile": "/home/
medic/avocado/job-results/job-2016-05-04T14.51-74e01c8
/test-results/1-sleeptest.py:SleepTest.test/debug.log",
"start": 14
62366290.957374
,
"logdir": "/home/
cleber/avocado/job-results/job-2016-08-09T13.53-10715c4
/test-results/1-sleeptest.py:SleepTest.test",
"logfile": "/home/
cleber/avocado/job-results/job-2016-08-09T13.53-10715c4
/test-results/1-sleeptest.py:SleepTest.test/debug.log",
"start": 14
70761622.174918
,
"status": "PASS",
"test": "1-sleeptest.py:SleepTest.test",
"time": 1.00
106596946716
3,
"time": 1.00
2036094665527
3,
"url": "1-sleeptest.py:SleepTest.test",
"whiteboard": ""
},
{
"end": 14
62366291.980557
,
"end": 14
70761623.193472
,
"fail_reason": "This test is supposed to fail",
"logdir": "/home/
medic/avocado/job-results/job-2016-05-04T14.51-74e01c8
/test-results/2-failtest.py:FailTest.test",
"logfile": "/home/
medic/avocado/job-results/job-2016-05-04T14.51-74e01c8
/test-results/2-failtest.py:FailTest.test/debug.log",
"start": 14
62366291.977591
,
"logdir": "/home/
cleber/avocado/job-results/job-2016-08-09T13.53-10715c4
/test-results/2-failtest.py:FailTest.test",
"logfile": "/home/
cleber/avocado/job-results/job-2016-08-09T13.53-10715c4
/test-results/2-failtest.py:FailTest.test/debug.log",
"start": 14
70761623.192334
,
"status": "FAIL",
"test": "2-failtest.py:FailTest.test",
"time": 0.00
29659271240234375
,
"time": 0.00
11379718780517578
,
"url": "2-failtest.py:FailTest.test",
"whiteboard": ""
},
{
"end": 14
62366294.713253
,
"end": 14
70761625.656061
,
"fail_reason": "None",
"logdir": "/home/
medic/avocado/job-results/job-2016-05-04T14.51-74e01c8
/test-results/3-synctest.py:SyncTest.test",
"logfile": "/home/
medic/avocado/job-results/job-2016-05-04T14.51-74e01c8
/test-results/3-synctest.py:SyncTest.test/debug.log",
"start": 14
62366291.995889
,
"logdir": "/home/
cleber/avocado/job-results/job-2016-08-09T13.53-10715c4
/test-results/3-synctest.py:SyncTest.test",
"logfile": "/home/
cleber/avocado/job-results/job-2016-08-09T13.53-10715c4
/test-results/3-synctest.py:SyncTest.test/debug.log",
"start": 14
70761623.208165
,
"status": "PASS",
"test": "3-synctest.py:SyncTest.test",
"time": 2.
7173640727996826
,
"time": 2.
4478960037231445
,
"url": "3-synctest.py:SyncTest.test",
"whiteboard": ""
}
],
"time": 3.
721395969390869
,
"time": 3.
4510700702667236
,
"total": 3
}
...
...
@@ -231,7 +226,11 @@ stdout and the JSON result to output to a file::
</testsuite>
$ cat /tmp/result.json
{"tests": [{"status": "PASS", "url": "1-sleeptest.py:SleepTest.test",...
{
"debuglog": "/home/cleber/avocado/job-results/job-2016-08-09T13.55-1a94ad6/job.log",
"errors": 0,
...
}
But you won't be able to do the same without the --json flag passed to
the program::
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录