Parses output of go test --json into a tibble for mrgvalidate to consume.

parse_golang_test_json(test_file, roll_up_ids = TRUE)

Arguments

test_file

Path to a .json file containing the output from go test --json

roll_up_ids

If TRUE, the default, will roll up any duplicated (non-NA) ID's so that they are unique and the passed/failed count reflects the total sums for a tests with a given ID. If FALSE, will leave duplicated Test ID's as is. Note: leaving this FALSE may cause strange outputs for subtests.

Value

A tibble formatted according to mrgvalidate::input_formats

Details

  • Any tests without Test Id's (correctly formatted in brackets) will be thrown out.

  • All tests and subtests with the same Test Id will be rolled up to a single row in the output tibble. The passed,failed counts will reflect the number of tests/subtests that were rolled up this way. The test names for a set of rolled up ID's must share a common prefix, which will be used as the new test name. Any trailing spaces, slashes, colons, or underscores will be removed from the extracted prefix.

  • Any test with more than one Test Id will have only the first Test Id extracted. Any subsequent Test Id's for that test will be ignored. Generally, the first Id will be the least specific, since subsequent Id's will likely have been added as part of subtests. Keep this in mind when adding Testd Id's in your Go test code.