rillig / gobco

Measure branch coverage of golang tests
BSD 2-Clause "Simplified" License
68 stars 13 forks source link

Test Logging does not seem to work when tests are run via gobco #26

Closed KantarBruceAdams closed 2 years ago

KantarBruceAdams commented 2 years ago

I am able to debug tests by using Logf() statements E.g.

func (suite *FoobarTestSuite) TestFoobar1() {
    t := suite.T()

    t.Logf("foobar value: %s\n", someValue)
        ....
}

Giving output like:

=== RUN   TestFoobar/TestFoobar1
    foobar_test.go:31: foobar value: SNAFU

I am currently trying to use this to debug why my tests are failing under gobco (suspected environment issue not a gobco as they look for files in a location specified on either the test command line or via an environment var).

I note that when run under gobco the test output does not display (this is even adding -test -v to the command line).

  1. Does gobco redirect log statements somehow?
  2. Is there an alternative logging mechanism that would work with gobco (I can write directly to a file of course)
KantarBruceAdams commented 2 years ago

This seems to be a build issue. Despite several clean builds the added log statements were not picked up.