gotestsum icon indicating copy to clipboard operation
gotestsum copied to clipboard

execution time of tests is not included when using input from --raw-command

Open kyoncal opened this issue 1 year ago • 1 comments

Hi,

We run a somewhat involved nightly test set up and use want to use gotestsum to generate coverage reports. We've been running into an issue where the execution time of the test is not included in the report. We run something similar to this:

$go test >  test.txt 
$(cat test.txt |  go tool test2json) > test.json 
$cat test.json | gotestsum --junitfile report.xml --raw-command -- cat

test.json includes the execution time of the tests.

kyoncal avatar Aug 29 '24 08:08 kyoncal

Thank you for raising this issue! Currently the time is based on runtime of the gotestsum command.

We could add a flag to use the timestamps in the json instead of wall clock time for cases like this. I think that would be a great addition.

As a workaround you could use run the tests with gotestsum --junitfile report.xml --jsonfile test.json possibly with --raw-command if you have a complicated command to run. That way you'll get the correct runtime and still get the JSON output to a file.

dnephin avatar Sep 05 '24 03:09 dnephin