jeudi 26 mai 2016

Get Coverage stats when tests are in another package

My tests aren't in the same package as my code. I find this a less cluttered way of organising a codebase with a lot of test files, and I've read that it's a good idea in order to limit tests to interacting via the package's public api.

So looks something like this:

api_client:
    Client.go
    ArtistService.go
    ...
api_client_tests
    ArtistService.Events_test.go
    ArtistService.Info_test.go
    UtilityFunction.go
    ...

I can type go test bandsintown-api/api_client_tests -cover and see 0.181s coverage: 100.0% of statements. But that's actually just coverage over my UtilityFunction.go (as I say when I ran go test bandsintown-api/api_client_tests -cover=cover.out and go tool cover -html=cover.out)

Is there anyway to get the coverage for the actual api_client package under test, without bringing it all into the same package?

Aucun commentaire:

Enregistrer un commentaire