Kiwi uses blocks to define examples, as well as setup and teardown steps, of course, but there is (or was to me) an unexpected side effect to this arrangement. Although Kiwi copies blocks internally, all copies share the same set of block variables. So if one is not careful to explicitly set every block variable before using it, tests can interact unexpectedly.
In addition, this means that object references held in block variables are not released until either the start of the next example, or after all examples in the block have run.
In most cases, this is usually fine, but when there is an error at the release stage, the problem usually manifests itself at the start of the next example, which makes it much harder to understand and debug.
I'm not sure if there's any way to ameliorate this issue without overhauling the Kiwi spec DSL, but I'm leaving this note as a reminder for when I run into the issue again and maybe as a nudge to look into later.
Kiwi uses blocks to define examples, as well as setup and teardown steps, of course, but there is (or was to me) an unexpected side effect to this arrangement. Although Kiwi copies blocks internally, all copies share the same set of block variables. So if one is not careful to explicitly set every block variable before using it, tests can interact unexpectedly.
In addition, this means that object references held in block variables are not released until either the start of the next example, or after all examples in the block have run.
In most cases, this is usually fine, but when there is an error at the release stage, the problem usually manifests itself at the start of the next example, which makes it much harder to understand and debug.
I'm not sure if there's any way to ameliorate this issue without overhauling the Kiwi spec DSL, but I'm leaving this note as a reminder for when I run into the issue again and maybe as a nudge to look into later.