我是第一次尝试使用 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
- 这应该等同于:
关于go - 传达简单测试失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56260619/