Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show separate summary with the slowest tests #17

Open
afbjorklund opened this issue May 2, 2021 · 0 comments
Open

Show separate summary with the slowest tests #17

afbjorklund opened this issue May 2, 2021 · 0 comments

Comments

@afbjorklund
Copy link
Contributor

afbjorklund commented May 2, 2021

The excellent gotestsum tool has a feature to show the slowest tests:

Usage:
    gotestsum tool slowest [flags]

Read a json file and print or update tests which are slower than threshold.
The json file may be created with 'gotestsum --jsonfile' or 'go test -json'.
If a TestCase appears more than once in the json file, it will only appear once
in the output, and the median value of all the elapsed times will be used.

[...]

Flags:
      --debug                enable debug logging.
      --jsonfile string      path to test2json output, defaults to stdin
      --skip-stmt string     add this go statement to slow tests, instead of printing the list of slow tests
      --threshold duration   test cases with elapsed time greater than threshold are slow tests (default 100ms)

It would be nice if this list was available on a separate tab/page, with links ?

Example output of tool, after make out/unittest.json and "DONE 899 tests, 2 skipped in 13.313s"
BTW: something is fishy here, go-test-report says 895 (not 899) "✓ Passed: 893 ‐ Skipped: 2 ✗ Failed: 0" ? --> filed Bug #19

$ gotestsum tool slowest < out/unittest.json
k8s.io/minikube/pkg/drivers/kic/oci TestRunCmdWarnSlowOnce 6.02s
k8s.io/minikube/pkg/minikube/perf TestTimeCommandLogs 4.03s
k8s.io/minikube/pkg/minikube/tunnel TestTunnelManagerDelayAndContext 1.1s
k8s.io/minikube/pkg/minikube/bootstrapper TestSetupCerts 1.09s
k8s.io/minikube/pkg/minikube/tunnel TestTunnelManagerEventHandling 420ms
k8s.io/minikube/pkg/minikube/tunnel TestTunnelManagerEventHandling/tunnel_always_quits_when_ctrl_c_is_pressed 420ms
k8s.io/minikube/pkg/util TestGenerateSignedCert 380ms
k8s.io/minikube/pkg/util TestGenerateSignedCert/valid_cert 270ms
k8s.io/minikube/cmd/minikube/cmd TestDeleteAllProfiles 270ms
k8s.io/minikube/cmd/minikube/cmd TestDeleteProfile 270ms
k8s.io/minikube/pkg/util TestGenerateCACert 230ms
k8s.io/minikube/cmd/minikube/cmd TestValidateImageRepository 140ms

So it shows all tests that ran slower than 100ms (slider?), sorted by duration...

Most of them run in "0s" (as they should), so this a nice way of finding culprits.

Web enhancements:

  • show inline bar of the times, for comparison
  • slider for dynamically choosing the threshold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant