This question already has an answer here:
I'm developing a project which is using GAE/Go. In Java, you usually put all the test code in ${PROJECT_ROOT}/src/test/java
. In Rails, you put them in, for example, ${PROJECT_ROOT}/spec
.
Where do I put test codes for GAE/Go project? Is there any recommendation/convention?
</div>
Same as when you are creating the folder structure in java to put your tests in, in Go, it is not related to the fact that you have your application deployed in GAE. Go does not use a specific patch for the tests, but specific syntax for the test methods. Here there is a useful guide on how to get started with testing in Go including good practices, and also the official documentation related to testing, in which they specify
Package testing provides support for automated testing of Go packages. It is intended to be used in concert with the “go test” command, which automates execution of any function of the form
func TestXxx(*testing.T)
Well, if you're asking for the convention, you should put the file in the same package as the one being tested, as pointed out here. And 1 package means 1 directory.
You can have something like this:
rootdir/
main.go
main_test.go
feature/
feature.go
feature_test.go