Golang 开源之 tparse 使用指南

  1. tparse 能做什么

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 |
+--------+---------+--------------------------------+--------+------+------+------+

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 nickchenyx@gmail.com

Title:Golang 开源之 tparse 使用指南

Count:177

Author:nickChen

Created At:2022-06-12, 18:14:13

Updated At:2023-05-08, 23:27:10

Url:http://nickchenyx.github.io/2022/06/12/golang-tparse-usage/

Copyright: 'Attribution-non-commercial-shared in the same way 4.0' Reprint please keep the original link and author.