smartystreets / goconvey

Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.
http://smartystreets.github.io/goconvey/
Other
8.25k stars 555 forks source link

Coverage with multiple packages #240

Closed tgrosinger closed 9 years ago

tgrosinger commented 10 years ago

Is there a way to cause the coverage report calculate coverage of the whole project rather than by package?

For example, if I have unit tests on package A but A depends on and uses B, there is a good chance that part of package B is covered as well even if I have not explicitly written tests for it.

I believe this can be done using the cover tool, just not sure how it can be done in Convey.

mdwhatcott commented 10 years ago

@tgrosinger - Sounds like you're interested in the -coverpkg flag. It's something I've wanted as well. One purpose of the "profile" branch I've been working on is to enable custom coverage flags. It's possible that we'll be able to support this but I'm not exactly sure at the moment. I'll have to experiment with that...

For now, any custom coverage flags have to be invoked from the command line. :(

tgrosinger commented 10 years ago

Yea, I think @mdwhatcott is describing what I am looking for. Is it possible to use these flags when launching Convey or do I just have to run it completely separately right now?

Thanks

mdwhatcott commented 10 years ago

@tgrosinger - For now, it's completely separate. Basically, for any custom test flags, you have to open a separate command line and run the commands manually.

tgrosinger commented 10 years ago

Okay, well looking forward to the possibility of this being added. Thanks!

jonhoo commented 9 years ago

This is still an open feature request, so I don't think this issue should have been closed.

mdwhatcott commented 9 years ago

This is actually already supported and resolved--sorry, should have commented here when the profile feature was completed. See the assertions package profile for a working example.

cd $GOPATH/src/github.com/smartystreets/goconvey/convey/assertions
goconvey

Then open the browser to http://localhost:8080 and click on the coverage bar for the assertions package. The files dropdown will show all files in both the assertions package and the oglematchers package because they are both listed as values to the -coverpkg flag.

Enjoy!