go 和 appengine 的测试用例 [英] Test cases for go and appengine
问题描述
我正在使用 Go 和 appengine,现在我想做一些测试用例.
I am using Go and appengine, and now I would like to do some test cases.
我尝试使用 gos 标准测试包,文件(都是包你好"):
I tried using gos standard test package, Files (both "package hello"):
hello/http.go
hello/http_test.go
问题:我无法运行go test hello
.我得到的最接近的是 go test hello/http_test.go
如果我不调用 http.go
就可以工作,这是毫无意义的.:)
Problem: I cannot run go test hello
. The closest I have got is go test hello/http_test.go
which works if I do not make any calls to http.go
, which is quite pointless. :)
推荐答案
一个有趣的发展:从 1.8.6 开始,使用服务存根进行测试已通过 appengine/aetest"
包.这在很大程度上类似于上面通过测试"上下文进行的工作.更多信息
An interesting development: as of 1.8.6 using service stubs for testing has been integrated into the SDK through the "appengine/aetest"
package. This works largely like the above via a "testing" context. More info
这篇关于go 和 appengine 的测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!