Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: Need some test case wide Setup and Cleanup method to avoid duplication code. #8340

gopherbot opened this issue Jul 8, 2014 · 1 comment


Copy link

gopherbot commented Jul 8, 2014

by kzjeef:

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  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.


What does 'go version' print?
go version go1.3 darwin/amd64


Testing require setup and tearDown function in test case file wide, 
like the test framework like
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.
Copy link

minux commented Jul 8, 2014

Comment 1:

Status changed to Duplicate.

Merged into issue #8202.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

2 participants