go - 传达简单测试失败

标签 go goconvey

我是第一次尝试使用 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 测试。我将简单测试复制到它并运行测试。有用。

是否有可能配置错误的地方?这是同一台服务器并进行设置。

Screen shot of test

最佳答案

它可能与您的 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/

相关文章:

jenkins - Goconvey 在 Jenkins 上用 go routine 引起 panic

go - 无法解码值中包含空格的负载

go - 如何修复 Go 中的 "zip: not a valid zip file"错误?

linux - 如果 block 设备已经格式化,则退出 mkfs 命令

go - 为什么在结构中嵌入接口(interface)会导致接口(interface)方法集被定义为 nil 指针?

http - 为什么 `http`包需要地址引用?

Golang 无法在同一个包中进行测试