tparse 分析和归纳
go test
输出的命令行工具
安装
go install github.com/mfridman/tparse@latest
tparse 能做什么
仅使用 go test -v
来显示测试结果,只是罗列了所有测试集合,没有归纳总结,不便于一眼明了。
➜ go test -race ./testtparse -v
=== RUN Test_sum
=== RUN Test_sum/return_2
--- PASS: Test_sum (0.00s)
--- PASS: Test_sum/return_2 (0.00s)
=== RUN Test_sub
=== RUN Test_sub/return_0
--- PASS: Test_sub (0.00s)
--- PASS: Test_sub/return_0 (0.00s)
PASS
ok code.byted.org/demo/testtparse 0.026s
使用 tparse
分析归纳 go test
的报告结论
➜ go test -race ./testtparse -json -cover | tparse -all
+--------+---------+-------------------+------------+
| STATUS | ELAPSED | TEST | PACKAGE |
+--------+---------+-------------------+------------+
| PASS | 0.00 | Test_sum | testtparse |
| PASS | 0.00 | Test_sum/return_2 | testtparse |
| PASS | 0.00 | Test_sub | testtparse |
| PASS | 0.00 | Test_sub/return_0 | testtparse |
+--------+---------+-------------------+------------+
+--------+---------+--------------------------------+--------+------+------+------+
| STATUS | ELAPSED | PACKAGE | COVER | PASS | FAIL | SKIP |
+--------+---------+--------------------------------+--------+------+------+------+
| PASS | 0.04s | code.byted.org/demo/testtparse | 100.0% | 4 | 0 | 0 |
+--------+---------+--------------------------------+--------+------+------+------+
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 [email protected]