testing: Need some test case wide Setup and Cleanup method to avoid duplication code. #8340
Before filing a bug, please check whether it has been fixed since the latest release. Search the issue tracker and check that you're running the latest version of Go: Run "go version" and compare against http://golang.org/doc/devel/release.html If a newer version of Go exists, install it and retry what you did to reproduce the problem. Thanks. What does 'go version' print? go version go1.3 darwin/amd64 Testing: Testing require setup and tearDown function in test case file wide, like the test framework like rspec(http://old.rspec.info/documentation/before_and_after.html) Each test case can have a setup method to allow do some setup stuff, like create a DB connection or start a HTTP server etc. After the test case, can have a function clear some up, so a lot of duplication setup in each test case can be avoid. I think rspec is really have a good point, but Golang can at least add some function like, TestSetup () and TestEnd() function in each test file to archive same propose.
The text was updated successfully, but these errors were encountered:
This issue was closed.