Closed bjeevan-ib closed 8 months ago
hey there,
You shouldn't put anything other than RunSpecs
in a TestX
function. The Describe
should be at the top level, no in a TestX
function. It will be registered in Ginkgo's suite when the test program begins and then run by Ginkgo.
~I suspect the difference you saw between ginkgo
and go test
is spurious and a red herring (in one case the TestAdd
function was called fore RunSpecs
, in the other it was called after).~ (sorry i just looked at your post more closely)
The issue you are seeing is that by invoking go test
and targeting the specific add test you are only registering the Describe
but not also invoking RunSpecs
. If you'd like to focus a particular test Ginkgo has lots of mechanisms for that.
Happy to add more context if you'd like, but if you drop the surrounding TestAdd
your tests should behave as expected. I'd also suggest skimming the first sections of the Ginkgo docs to learn more about how Ginkgo tests are structured.
hey there,
You shouldn't put anything other than
RunSpecs
in aTestX
function. TheDescribe
should be at the top level, no in aTestX
function. It will be registered in Ginkgo's suite when the test program begins and then run by Ginkgo.~I suspect the difference you saw between
ginkgo
andgo test
is spurious and a red herring (in one case theTestAdd
function was called foreRunSpecs
, in the other it was called after).~ (sorry i just looked at your post more closely)The issue you are seeing is that by invoking
go test
and targeting the specific add test you are only registering theDescribe
but not also invokingRunSpecs
. If you'd like to focus a particular test Ginkgo has lots of mechanisms for that.Happy to add more context if you'd like, but if you drop the surrounding
TestAdd
your tests should behave as expected. I'd also suggest skimming the first sections of the Ginkgo docs to learn more about how Ginkgo tests are structured.
Thank you for the quick response.
ginkgo/v2 newbie question:
I am calling Describe from within a TestAdd function and it seems to behave differently when I call it with ginkgo and go test.
Here is the code:
Running it with "ginkgo" fails as expected:
While running it using go test passes (without actually executing the describe funtion)
What is wrong in the way I am using go test? (please let me know if there is a better place to ask this question)