Thanks for your input.
Michael, I checked out GoConvey and it looks nice but still doesn't really
work for my situation where I have dozens of subpackages and I want to run
an entire suite of tests over all packages in the app. I do like the API to
Here is what I currently thinking.
If my binary is run with a tests flag, rather that run as normal (http
server), it runs tests. I've taken out the matchString() function from the
go test tool. In the app I have a map[string]fun(*testing.T) with all tests
defined. When the binary is run with that flag, I iterate through that map
while building a slice of testing.InternalTest. Then I call testing.Main()
with that slice. Now I can do whatever setup or teardown I need to before
or after the call to testing.Main().
By doing this I lose the ability to use go test since I can't put my tests
in "_test.go" files any more. I am also at the mercy of any changes to core
lib since matchString() from the go tool is not public and the
testing.Main() function and testing.InternalTest type are not meant to be
used externally. In my opinion these are low risk and is giving me a very
flexible testing environment.
On Friday, April 4, 2014 10:40:00 PM UTC-7, Michael Whatcott wrote:
> will run all your
tests for you, every time you save a file in your project. Just start it at
the root of your project and it will report all results (of testing all
packages in your project) to your web browser pointed at 127.0.0.1:8080(or wherever you specify using the command line flags).
$ go get -t github.com/smartystreets/goconvey
$ cd <your-project-root>
(open your browser to 127.0.0.1:8080 and start coding)
Any modification to existing files or deletion/creation of a file causes
GoConvey to re-run your entire test suite. GoConvey introduces an alternate
way to compose the body of test functions with a lot of convenient
"assertion" methods but that's completely optional. It is perfectly capable
of running traditional go test functions and report the results to the
browser. I use it all the time when I'm coding as it's really streamlined
my workflow, especially for large projects.
Disclosure: I'm one of the authors.
On Friday, April 4, 2014 2:44:04 PM UTC-6, Travis Beauvais wrote:
Does anyone have any advice for setting up testing for an entire app? I
have tests written for a lot of the submodules but running them all
individually isn't really an option. I'm using gocheck since it has
fixtures so thats nice. What I'd really like is something where I can run a
single script/command and it will run all the tests in the app. Being able
to define some setup and teardown (database setup, config loading, etc) for
the entire process would be nice.
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
For more options, visit https://groups.google.com/d/optout.