如何運行單元測試,我在〜/應用程序的AppEngine我SDK/google_appengine應用服務引擎去項目
在Eclipse中,我有一個外部工具的配置運行開發服務器。它的指向:
〜/應用/ google_appengine/dev_appserver.py
在Eclipse(轉到首),我已經設置了GOROOT指向〜/應用/ google_appengine/GOROOT
而且
現在,我想爲我的項目運行一些單元測試。如果用我經常去安裝(不AppEngine上一個),我得到這個錯誤:
../../context/context.go:4:2: cannot find package "appengine" in any of:
/usr/local/go/src/pkg/appengine (from $GOROOT)
/Users/home/src/go/foodbox/src/appengine (from $GOPATH)
../../context/data.go:4:2: cannot find package "appengine/datastore" in any of:
/usr/local/go/src/pkg/appengine/datastore (from $GOROOT)
/Users/home/src/go/foodbox/src/appengine/datastore (from $GOPATH)
../../context/context.go:5:2: cannot find package "appengine/user" in any of:
/usr/local/go/src/pkg/appengine/user (from $GOROOT)
/Users/home/src/go/foodbox/src/appengine/user (from $GOPATH)
如果我使用AppEngine上走,我得到這個:
load cmd/cgo: package cmd/cgo: no Go source files in /Users/home/Application/google_appengine/goroot/src/cmd/cgo
這似乎是默認安裝無法找到appengine軟件包(我想這並不奇怪)。當我使用appengine go工具時,我不確定問題是什麼。任何人都可以告訴我如何讓這個工作?
謝謝!
看看http://stackoverflow.com/questions/7858711/how-to-run-unit-tests-for-code-that-uses-app-engine-services-in-go(特別是https: //github.com/icub3d/appenginetesting) – Intermernet
因此,無法使用開箱即用工具來測試appengine應用程序嗎?理論上,我應該能夠在appengine特定的庫上創建接口包裝器。我不能這樣做嗎? – Jordan
如果你想編寫接口包裝器arounnd appengine特定的庫,請參閱 - https://github.com/crhym3/aegot這不是我會推薦的,因爲你將被很多 – mzimmerman