Is it possible to have a variable number of test cases. Let's say I have a BeforeSuite function which calculates the values in the array.
Then based on the length of the array, I want to run one test per array element.
var _ = Describe("Outer", func() {
var stringArray []string
BeforeSuite(func() {
stringArray = []string{"a", "b", "c", "d", "e"} // can vary every time i run the suite
})
Describe("test 1", func() {
for _, s := range stringArray {
It("multiple tests", func() {
print(s)
Expect(s).ToNot(Equal("f"))
})
}
})
})
I do understand the way Ginkgo runs. It does 2 parses. First it run all the non-spec elements and then runs the spec elements.
There was an issue on github https://github.com/onsi/ginkgo/issues/462 which suits my use case, but the OP misunderstood and it took a different turn.