go test
GoConvey supports Go's native testing
package. Neither the web UI nor the DSL are required; you can use either one independently.
Since GoConvey integrates with go test
, you can keep running tests in the terminal or use the auto-updating web UI for test results.
Though writing tests with Convey()
and So()
is optional, it's more expressive than t.Errorf()
.
$ go get github.com/smartystreets/goconvey
$ $GOPATH/bin/goconvey
Then open your browser to localhost:8080. Tests will be run from the working directory on down.
Simply save a .go
file or click the icon to execute tests. Your browser page will update automatically.
You can click a package name in the top-left corner to view Go's detailed HTML coverage report.
GoConvey comes with two themes built-in. (Toggle the theme on this page to try it!) You can also use third-party themes or roll your own.
You can pause auto-test execution and go through recent test history to see where, when, and why your code is breaking.
All higher-level Convey
scopes are run for each nested Convey
call.
Use Reset
to clean up when you're done.
Write tests your own way. There is no enforced vocabulary for defining tests: Convey("What your application should do", ...)
Here's a few to whet your appetite:
ShouldEqual
ShouldResemble
ShouldBeTrue
ShouldBeZeroValue
ShouldNotContainSubstring
ShouldPanic
ShouldNotHappenBefore
ShouldHappenWithin
Even more or make your own...
Turn notifications on with the web UI to get live feedback when you save your file. Know immediately if you just broke something.
Notifications automatically disappear after a few seconds and display only relevant information. They're off by default.
go test
Remember, the web UI and DSL are independent of each other, so it can still be everything you're used to: test results in the terminal.
You tell your program's story. The console output of go test
is easily readable by humans where the GoConvey DSL is used.
In the GoConvey Composer, don't worry about Go syntax. This tool helps you describe your program's behavior in a focused, distraction-free way.
Your test file is stubbed out for you as you type your program's story. The smart input box preserves your tabs and feels like a real text editor.
As you can see, the GoConvey UI is responsive, so feel free to squish it beside your editor to maximize your available screen space.
Get started with GoConvey and see if you'll ever go back
to writing code that's not under test.
$ go get github.com/smartystreets/goconvey
$ $GOPATH/bin/goconvey
Then open your browser to localhost:8080. Tests will be run from the working directory on down.