2

I am attempting to use Convey for the first time. My real test fails for an unknown reason, so I created this very simple test and it fails the same way.

   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)
            })
        })
    })
}

I am probably doing something wrong, however I'm at a loss

UPDATE: I found an old Convey test in another app that works. I copied the simple test to it and ran tests. it works.

Is there something that is possibly configured wrong? It is the same server and go setup.

Screen shot of test

Donald French
  • 1,731
  • 1
  • 17
  • 30
  • Have you tried to run the unit test manually with `go test -v`? In theory it should pass. – Giulio Micheloni May 22 '19 at 22:07
  • Fails also with: panic: Top-level calls to Convey(...) need a reference to the *testing.T. Hint: Convey("description here", t, func() { /* notice that the second argument was the *testing.T (t)! */ }) I think it is set they way stated in the hint. – Donald French May 22 '19 at 23:59
  • Looks like you're missing the `t` in the second and third convey, you only have it in the first convey. – tzachs May 23 '19 at 16:58
  • 1
    According to the docs, it only belongs in the first. However, I made the change and it still failed. The simple test fails here and works when inserted into another old app with Convey. – Donald French May 23 '19 at 20:00

1 Answers1

0

It may be related to your version of Go combined with your (outdated) version of Go Convey and some of its dependencies. Perhaps you had some dependencies already in your $GOPATH/src and now you updated to Go version 1.12.*?

This happened to me when updating from Go version 1.10 to Go version 1.12.6, I've followed the details in here and this helped me fixing my environment: https://github.com/smartystreets/goconvey/issues/561#issuecomment-505525085

These are the steps I followed:

  • cd $GOPATH/src/github.com/smartystreets/goconvey/ && git checkout master && git pull
    • this should be equivalent to: go get github.com/smartystreets/goconvey
  • cd $GOPATH/src/github.com/smartystreets/assertions/ && git checkout master && git pull
    • this should be equivalent to: 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
    • this should be equivalent to: go get github.com/jtolds/gls
TPPZ
  • 4,447
  • 10
  • 61
  • 106