tparse

CLI tool for analyzing and summarizing go test output. Pipe friendly. CI/CD friendly.

Github星跟蹤圖

tparse Actions Coverage

A command line tool for analyzing and summarizing go test output.

Don't forget to run go test with the -json flag.

Pass, Fail
:-------------------------:, :-------------------------:
,

By default, tparse will always return test failures and panics, if any, followed by a package-level summary table.

To get additional info on passed tests run tparse with -pass flag. Tests are grouped by package and sorted by elapsed time in descending order (longest to shortest).

But why?! for more info.

Installation

go get github.com/mfridman/tparse

Or download the latest pre-built binary here.

Usage

Once tparse is installed there are 2 ways to use it:

  1. Run go test as normal, but add -json flag and pipe output to tparse.
go test fmt -json, tparse -all
  1. Save the output of go test with -json flag into a file and call tparse with filename as an argument.
go test fmt -json > fmt.out
tparse -all fmt.out

Tip: run tparse -h to get usage and options.

But why?!

go test is awesome, but a bit verbose. Sometimes one just wants failures, grouped by package, printed with a dash of color and bubbled to the top.

tparse attempts to do just that; return failed tests and panics, if any, followed by a single package-level summary.

But, let's take it a bit further. With -all (-pass and -skip combined) can get additional info, such as which tests were skipped and elapsed time of each passed test.

tparse comes with a -dump flag to replay everything that would have otherwise been printed. Enabling users to retrieve original go test output. Eliminating the need for tee /dev/tty between pipes.

The default print order is:

  • go test output (if adding -dump flag)
  • passed/skipped table (if adding -all, -skip or -pass flag)
  • failed tests and panics
  • summary

The default print order can be reversed with -top flag.

For narrow displays the -smallscreen flag may be useful, dividing a long test name and making it vertical heavy:

TestSubtests/an_awesome_but_long/subtest_for_the/win

TestSubtests
 /an_awesome_but_long
 /subtest_for_the
 /win

tparse aims to be a simply alternative to one-liner bash functions.


P.S. tparse uses itself in GitHub actions:

主要指標

概覽
名稱與所有者mfridman/tparse
主編程語言Go
編程語言Go (語言數: 3)
平台
許可證MIT License
所有者活动
創建於2018-10-18 18:32:47
推送於2025-06-12 12:25:59
最后一次提交
發布數22
最新版本名稱v0.17.0 (發布於 2025-02-16 12:12:46)
第一版名稱v0.1.0 (發布於 )
用户参与
星數1.1k
關注者數4
派生數28
提交數178
已啟用問題?
問題數89
打開的問題數23
拉請求數50
打開的拉請求數0
關閉的拉請求數3
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?