gotestyourself / gotestsum

'go test' runner with output optimized for humans, JUnit XML for CI integration, and a summary of the test results.
Apache License 2.0
2.03k stars 119 forks source link

Export elapsed time to the post-run environment #360

Closed afbjorklund closed 1 year ago

afbjorklund commented 1 year ago

For use with go-test-report and for completeness

afbjorklund commented 1 year ago

Thanks for the fix! Tried hardcoding 1ms first, but then sometimes it took 2ms instead

In retrospect, maybe the variable should have been called GOTESTSUM_ELAPSED ? I was just extending the existing variables, but maybe it is better with the program name.

The idea was to have the other program look for the exported variables, as defaults:

gotestsum --jsonfile test_report.json --post-run-command go-test-report

And then it looked a bit odd with a more generic "TESTS" being hardcoded, for that purpose... The end result anyway, would be a test_report.html with a proper executionTime and duration.