goconvey icon indicating copy to clipboard operation
goconvey copied to clipboard

Display coverage in UI by package

Open gheibia opened this issue 8 years ago • 0 comments

The UI currently displays the coverage by the folder structure and not the package structure. Can this be changed?

Here is a bit more detail on the problem I'm facing:

Consider a file structure like this:

api --
     |_ routes.go
     |_ handler.go
impl--
     |_ impl.go
     |_ impl_test.go

The "impl" file contains internal implementation of REST APIs for which the handlers and routes are in "handler.go" and "route.go" files respectively.

As far as packaging goes, everything under "api" folder is in the "api" package. The code in "impl.go" is in "impl" package and the code in "impl_test" package is in "impl_test" package.

api -------
           |_ routes
           |_ handler functions
impl-------
           |_ impl functions
impl_test--
           |_ test functions

The test function starts a HTTP server listening to a local open port using the routes and handlers in the "api" package and then call the APIs.

In addition, I created a goconvey file in the "impl" folder (beside the test file) with the following content:

-coverpkg=git.company.com/project/api,git.company.com/project/impl

Without this file, the UI reports 0% coverage for the code in the "api" package. The "api" folder doesn't show up in the coverage. With it however, I can see the coverage for the "api" package under the "impl" folder. That is, when I click on the "impl" folder on UI to see the list of files, I can see the files from the "api" package, too. Meanwhile, the "api" folder still doesn't show up in the coverage list.

It seems the assumption here is that there should be a relationship between folder structure and packages.

gheibia avatar Jul 26 '17 23:07 gheibia