通过简单测试传达失败

时间:2019-05-22 15:46:25

标签: 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

1 个答案:

答案 0 :(得分:0)

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