-
Notifications
You must be signed in to change notification settings - Fork 555
You're holding it wrong
When a customer emailed Steve Jobs about bad reception on the iPhone 4, Jobs replied and basically told him, you're holding it wrong.
Similarly, here are some of the wrong ways to "hold" GoConvey, some of which are not very obvious (and understandably so).
When using the web UI, Go files being tested must be in the GOPATH under the src
directory. The server expects the src
directory to be present after the GOPATH so it can determine the full package name.
Remember, top-level Conveys are executed once for each nested Convey. This could cause variables to be unexpectedly re-used or overwritten across different tests (uh oh!). But this is actually incredibly convenient (see the linked article for why).
Something like this:
Convey("Level 1", t, func() {
for i := 0; i < 3; i++ {
Convey("Level 2", func() {
Convey("Level 3", func() {
So(true, ShouldBeTrue)
})
})
}
})
won't produce as many assertions as you think. Want to try and figure out why?
Never, never, never call panic(nil)
because GoConvey can't recover the error (it thinks the Convey
passed) see issue 98 and especially this Stack Overflow question.