smartystreets / goconvey Goto Github PK
View Code? Open in Web Editor NEWGo testing in the browser. Integrates with `go test`. Write behavioral tests in Go.
Home Page: http://smartystreets.github.io/goconvey/
License: Other
Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.
Home Page: http://smartystreets.github.io/goconvey/
License: Other
After deleting a folder with tests the web UI reported that the build failed because it couldn't see the directory. This shouldn't happen because the watch list should be updated each time the tests are run...
Is there a difference between skip and ignore (and does it matter)?
The README is getting pretty long. Let's think about pulling most of it out into a wiki with more detail, split into different pages. It'd also be good to cover topics not already mentioned like set-up and clean-up. Maybe also how/why *testing.T only needs to be passed into the first/highest Convey()
closure.
Although goconvey-server doesn't seem to allow an external user to do much other than monitor the status of your tests it would be nice to bind the server's port explicitly to 127.0.0.1 so that nobody beyond the current system, who you can presumably trust, can access the server.
Perhaps this can be done by extending the existing "-port" parameter or adding a new "-host" parameter.
Another option is to use an environment variable such as "GOHOST" (or perhaps a more common one) so that the fully-qualified host name can be set once and used with other tools such as sirnewton01/godev or sirnewton01/godbg that have web front-ends.
Sort of like an integration test.
I'm not sure if I'm going crazy, but I think when I save a single file (just once!) in my watched directories, the page refreshes twice. Terminal output shows tests running twice, too...
Will probably output a json file with:
This json structure could then probably be templated using javascript.
It could be great if goconvey could generate tests from Gherkin files. Gherkin is standard in Ruby, PHP, and many other programming languages to describe software behaviour.
See https://github.com/cucumber/cucumber/wiki/Gherkin for more details.
Treat this issue as proposal only I don't know Go enough to implement this feature in your project.
So, I know that I have to get from goconvey to HTML somehow. The html has to have statistics, stories, filename and line numbers for everything, etc...
Here are the touch points:
So the big questions are:
Ideally:
Move the real code into another file. This will allow the documentation to stand but not clutter up the actual code.
This means messing with the GOPATH environment variable...
We also need to make sure the server adds ALL nested directories to the watch list.
What else should we check for?
Need to include a session with failures and skips.
Also, it would be nice to blow up if it's passed in anywhere else (right now the framework just hangs...).
When root is adjusted, the server still holds on to watches completely outside the new root.
I've opened an issue with fsnotify.
We may end up rolling our own "fsnotify" that works like somewhat like the python idle.py script (not sure if it would perform across lots of packages though...).
Not surprisingly, windows is lame.
fsnotify connects to lots of files and the bigger the watched scope, the more files. So, we should probably explain in the wiki that the user should set the file connection limit higher:
ulimit -n <really-high-number>
$ go get github.com/smartystreets/goconvey/convey
does not pull down the necessary dependencies. Neither does $ go get github.com/smartystreets/goconvey
-- oglematchers and fsnotify and ogletest are not cloned down.
Also, running these tests on Go 1.1.1 linux 386 gives this result, a build failed:
can't load package: package e/matt/go: cannot find package ...
(My $GOPATH is "/home/matt/go")
When running the server in the gopath.
Go provides a nice library for using websockets to do long-running communications with the browser (client). So, it looks like we could probably have a go http server that sets up a main "/" handler that serves the html page with some javascript that would setup websockets with another go handler which would serve json or something that would then get templated into the main html. Another goroutine in the server could use fsnotify to get notified of .go file changes in a specified directory and run tests recursively, grabbing (and transforming?) the output and sending it back to the client. Could that work?
From the web UI, we should be able to specify fully qualified package names to ignore in case large dependencies (or broken dependencies) start to get in the way or slow things down.
Use external stuff or build something in this project?
We noticed that the javascript didn't add newly created packages and tests (required a hard refresh).
Make it something like:
Expected: <expected_value>
Actual: <actual_value>
Then we can get rid of the "(but it didn't)" suffix.
When you have more than 3-4 packages in a project the web ui starts to get laggy--not because of the client side code, but because the server is running each test package in a synchronous, blocking fashion and not delivering the results to the client in a timely manner. Running each test package in a separate goroutine and aggregating the results would be killer.
This seems relevant:
Cool feature for the web report app.
Could be a script and/or web endpoint.
* /Users/mike/work/dev/liveaddress-zipapi/src/pkg.smartystreets.net/liveaddress-zipapi/index/index_test.go
Line 65:
Expected '{0 [] [] blank Blank lookup (you must provide a ZIP Code and/or City/State combination).}'
to resemble '{0 [] [] invalid_zipcode Invalid ZIP Code.}'
(but it didn't)!
Options:
When the parent scope is a Test... func, the top-level Convey() needs the t
pointer passed in as an argument.
But we probably should show how many assertions/scopes have been skipped.
Infinite loops things happen...
Requires registering a custom url scheme for sublime text:
https://github.com/asuth/subl-handler
MacVim comes with a url scheme built-in, as does textmate. The web app should support any of these schemes with some sort of setting.
Also, this deserves a page in the Wiki (setup instructions).
This is to drive out temporal couplings between tests. Technically, the setup and teardown methods should be enough to do this but you just never know...
I think this will be a command line option that is enabled by default and can be disabled (which is how some of the unit tests can avoid being broken by this new feature).
nil for pointers/interfaces or the "zero" value for everything else.
Get on the following places:
I assume most Gophers are using Linux or FreeBSD but Windows is probably still a common platform.
As soon as the goconvey server is started anywhere in the GOPATH this results:
Build Failed
can't load package: package rojects/gocode/src/lib/matrix:
cannot find package "rojects/gocode/src/lib/matrix" in any of:
You can see that the path separator char '' on Windows is not being handled correctly. It's also incorrectly prepending the path from the root to the GOPATH directory to the package source directory in its attempt to find the package.
Also it's appending the GOPATH to GOROOT ??? - where no user source exists anyway.
When writing some tests today I inserted some debug print statements and it broke the server.
We aren't making any attempt at capturing output from programs or tests and so it gets in the way when trying to deserialize json output in the parser. I think we should encapsulate the json in some sort of unique opening and closing delimiters and count anything else as captured output, which the web GUI could then show in a collapsed area.
This is a nitpick I am sure -- but if you want goconvey to live nicely next to other binaries (often named "server") it would if the testing webserver didn't take such a core name under bin by default. Maybe goconvey-server or something?
I'm wondering if--and this is a big i" depending upon the intention and best practices of the library--having the ability to condense the So statement down to a single line along with the parent Convey text. For example, it may be that there is a lot of assertion blocks that take the following form:
Convey("The value should be computed correctly", func() {
So(a, ShouldEqual, b)
})
Would it be possible to consolidate to rewrite the following in this way or something like it?
So(a, ShouldEqual, b, "The value should be computed correctly")
Perhaps this pollutes the DSL too much and perhaps it's mixing the concerns--that of conveyance of the intention and the underlying assertions. The only possible benefit is the slight reduction in code.
Thoughts?
github.com/jacobsa/oglematchers is a very thoroughly done project that tackles the assertion problem and in most cases does it much better than what I currently have. It shouldn't be too hard to integrate it with goconvey. The ogle branch has been created for this effort.
Could you please add the ability the run only a specific convey? This would eliminate the need to use SkipConvey on other sections. Perhaps it could be called OnlyConvey or something similar.
Wouldn't it be a great selling-point if our web UI could
show some sort of results for plain old go test functions?
This would make it much more appealing to port an existing package
that uses go test style unit tests into a goconvey style package.
And, (selfish reason) it would allow us to use the web UI to develop
GoConvey itself, which uses the go test style to bootstrap itself.
Right now, the server doesn't support parsing regular go test output
(and would probably fail miserably). We can't really say we integrate fully
with go test if we fail on that kind of test output.
It would mean invoking go test with both the "-json" AND "-v":
exec.Command("go", "test", "-v", "-json").Output()
That way we would get the individual method names for each StoryReport.
Not sure yet if this would require any changes to the reporting package.
According to this Golang-Nuts conversation, Go 1.1.2 is the minimum required version.
If this is confirmed to be the case, we should document that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.