Closed ghost closed 10 years ago
@everdev - The href of that coverage link does look strange. When I run goconvey
at $GOPATH/src/github.com/smartystreets/goconvey/examples
here is what the coverage url for that package is:
http://localhost:8080/reports/github.com-smartystreets-goconvey-examples.html
So, the pattern for the url path should be /reports/import-path-with-hyphens-not-slashes.html
. It should not include any path elements above your project's import path (so in your case it should NOT include /Users/ever/Dev/go
).
Just to confirm, your GOPATH is:
/Users/ever/Dev/go
And your project is found at:
/src/forecast
I would actually expect your code to be here:
Users/ever/Dev/go/src/forecast
goconvey
from the examples package ($GOPATH/src/github.com/smartystreets/goconvey/examples
)?$GOPATH/src/forecast
It looks like the URL is being generated here: https://github.com/smartystreets/goconvey/blob/4c4f4172c0ec2894b0b5c850212ef370333bb8b0/web/client/index.html#L161
with the variable:
{{PackageName|boldPkgName}}
@everdev - Ok, here's something I'd like to have you try:
goconvey
servercurl http://localhost:8080/latest
PackageName
field for the package in question.For my own reference, I think the actual line that generates the coverage link is here:
There are two kinds of links being generated in the left side bar, coverage report links and little tiny scroll arrows. I'm still baffled to see an underscore in the path of the report link.
Here's the JSON output:
{"Packages":[{"PackageName":"forecast","Elapsed":0.011,"Coverage":3.7,"Outcome":"passed","BuildOutput":"","TestResults":[{"TestName":"TestUserName","Elapsed":0,"Passed":true,"Skipped":false,"File":"","Line":0,"Message":"","Error":"","Stories":[{"Title":"Given a name","File":"/Users/ever/dev/go/src/forecast/forecast_test.go","Line":18,"Depth":0,"Assertions":[],"Output":""},{"Title":"It should create an appropriate filename","File":"/Users/ever/dev/go/src/forecast/forecast_test.go","Line":16,"Depth":1,"Assertions":[{"File":"","Line":0,"Expected":"","Actual":"","Failure":"","Error":null,"StackTrace":"","Skipped":false}],"Output":""}]}]},{"PackageName":"forecast/csvs","Elapsed":0,"Coverage":-1,"Outcome":"no go code","BuildOutput":"can't load package: package forecast/csvs: no buildable Go source files in /Users/ever/dev/go/src/forecast/csvs","TestResults":[]}],"Revision":"2014-10-26 12:22:27.772210686 -0700 PDT","Paused":false}
@everdev - Hmm. The PackageName
is correct which surprises me--I thought for sure it would have that weird leading underscore in it. I'm stumped. If you run the commands manually which generate the coverage profile do you still see the leading underscore in the output file?
go test -cover -coverprofile out.txt
That worked! The URL is now:
http://localhost:8080/reports/forecast.html
And it remains correct even after restarting goconvey, so it looks to be fixed.
I've never run tests manually before on this project. I wonder if it needs to be executed once to establish the configuration or set the right permissions with goconvey.
In any event, thanks for helping. It's a great tool and quite impressive for a relatively new language. It's made learning Go a lot of fun.
@everdev - Phew! Glad it's working for you.
It appears like my agent is running without coverage, how can I enable this?
In the Web UI, the test coverage link is broken and points to: http://localhost:8080/reports/_-Users-ever-Dev-go-src-forecast.html
/Users/ever/Dev/go
is my $GOPATH and /src/forecast is where the project files are being stored, so somehow the link is grabbing my $GOPATH. If I edit the link to read: http://localhost:8080/forecast.html a good looking coverage report comes up, however it's outdated and looks like it was created on my very first project save, but not since then.If I go to
$GOPATH/src/github.com/smartysteets/goconvey/web/client/reports
I can see two files related to my project:This .txt file updates on every project file save and appears to be working correctly. In the WEB UI, when I hover over coverage, it says 16.7% test coverage which appears correct and in line with what the .txt file is reporting.
So, it looks like the UI link and .html report are broken, but the UI coverage % and .txt file are working.
A couple questions:
Version / Settings:
Mac / OS X Yosemite
Great tool by the way! Everything else has been super easy to use.