go - 传达简单测试失败
问题描述
我第一次尝试使用 Convey。我的真实测试由于未知原因而失败,所以我创建了这个非常简单的测试,它以同样的方式失败。
GO Convey
func TestSimple(t *testing.T) {
Convey("Given Simple Test", t, func() {
Convey("When Tested", func() {
Convey("There should be a result", func() {
i := 1
So(i, ShouldEqual, i)
})
})
})
}
我可能做错了什么,但是我不知所措
更新:我在另一个有效的应用程序中发现了一个旧的 Convey 测试。我将简单的测试复制到它并运行测试。有用。
有没有可能配置错误的东西?它是同一台服务器并进行设置。
解决方案
它可能与您的 Go 版本以及您的(过时的)Go Convey 版本及其一些依赖项有关。也许您已经有一些依赖项$GOPATH/src
,现在您更新到 Go 版本 1.12.*?
这发生在我从 Go 版本 1.10 更新到 Go 版本 1.12.6 时,我已经按照这里的详细信息,这帮助我修复了我的环境:https ://github.com/smartystreets/goconvey/issues/561#issuecomment -505525085
这些是我遵循的步骤:
cd $GOPATH/src/github.com/smartystreets/goconvey/ && git checkout master && git pull
- 这应该相当于:
go get github.com/smartystreets/goconvey
- 这应该相当于:
cd $GOPATH/src/github.com/smartystreets/assertions/ && git checkout master && git pull
- 这应该相当于:
go get github.com/smartystreets/assertions
- 这应该相当于:
go get -u golang.org/x/tools...
cd $GOPATH/src/github.com/jtolds/gls/ && git checkout master && git pull
- 这应该相当于:
go get github.com/jtolds/gls
- 这应该相当于:
推荐阅读
- midi - 同时播放和录制 MIDI 流
- c# - 接收输入,打印输出
- jquery - 如何一起选择特定的表格和班级和ID
- python - 使用 OpenAI Gym 构建 mujoco-py 失败的轮子
- javascript - Ajax同步post方法,从Node服务器端获取数据
- bash - 每次重启 AWS EC2 实例时执行脚本
- c# - 我遇到关于“Expr1000”的错误
- reactjs - 在 ReactJS 中路由后从子组件获取值
- oracle - PL/SQL 异常未捕获异常
- android - 在两个顺序 addToBackStack 之后,supportFragmentManager.fragments 大小为 1