Welcome to GoConvey, a yummy testing tool for gophers.

Documentation & tutorial

Main Features

  • Integrates with go test
  • Readable, colorized console output
  • Fully-automatic web UI
  • Huge suite of regression tests
  • Test code generator
    View a comprehensive table of all features compared to other Go testing tools.

Get going in 25 seconds

  • In your terminal:
  1. # make sure your GOPATH is set
  2.  
  3. $ cd <project path>
  4. $ go get github.com/smartystreets/goconvey
  5. $ $GOPATH/bin/goconvey
  6.  
  • In your browser:
  1. http://localhost:8080

If you have existing Go tests, they will run automatically and the results will appear in your browser.

Your first GoConvey test

Open any _test.go file and put this in it, customizing your package declaration:

  1. package package_name
  2.  
  3. import (
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7.  
  8. func TestIntegerStuff(t *testing.T) {
  9. Convey("Given some integer with a starting value", t, func() {
  10. x := 1
  11.  
  12. Convey("When the integer is incremented", func() {
  13. x++
  14.  
  15. Convey("The value should be greater by one", func() {
  16. So(x, ShouldEqual, 2)
  17. })
  18. })
  19. })
  20. }

Save the file, then glance over at your browser window, and you'll see that the new tests have already been run.

Change the assertion (the line with So()) to make the test fail, then see the output change in your browser.

You can also run tests from the terminal as usual, with go test. If you want the tests to run automatically in the terminal, check out the auto-test script.

Required Reading

If I could ensure that every GoConvey user read only one bit of code from this repository it would be the isolated execution tests. Those tests are the very best documentation for the GoConvey execution model.

Full Documentation

See the documentation index for details about assertions, writing tests, execution, etc.