go和appengine的测试用例 [英] Test cases for go and appengine

查看:146
本文介绍了go和appengine的测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Go和Appengine,现在我想做一些测试用例。

我试过使用gos标准测试包,
Files(两个包hello):

  hello / http.go 
hello / http_test.go

问题:我无法执行 go test hello 。我得到的最接近的是 go test hello / http_test.go 如果我不对 http.go ,这是毫无意义的。 :)

解决方案

一个有趣的开发:从1.8.6开始,使用服务存根进行测试已经通过appengine / aetest包。这很大程度上像上面通过测试上下文一样工作。 更多信息


I am using Go and appengine, and now I would like to do some test cases.

I tried using gos standard test package, Files (both "package hello"):

hello/http.go
hello/http_test.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. :)

解决方案

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆