square/KIF — Issue #97: Steps not being initialized for skipped scenarios
Author: lawrence-forooghian
Created: 2011-11-28 10:17:17+00:00
State: open

In our KIF tests, we make heavy use of reusing scenarios as a building block for another scenario. For example, we might have a scenario `scenarioHomeScreenShowsLoginScreenWhenLoginButtonPressed`. Our tests of the login functionality, e.g. `scenarioLoginScreenShowsRegisterScreenWhenRegisterButtonPressed` would then call this method and add some more steps to it. However, say we wanted to only run the tests for the login screen, so we'd set `KIF_SCENARIO_FILTER` to something like `"Test that the login screen"`. However, because `skippedByFilter` for `scenarioHomeScreenShowsLoginScreenWhenButtonPressed` is true, its `_initializeStepsIfNeeded` method doesn't bother initializing its `steps` array, so when we try to add steps to `scenarioHomeScreenShowsLoginScreenWhenLoginButtonPressed`, it ends up not working properly - `addStep` does nothing, and `addStepsFromArray` blows up. It seems to me like `_initializeStepsIfNeeded` shouldn't be doing this check of `skippedByFilter`, but it might just be that we're not using KIF in the way it was intended. It would be good to hear someone's thoughts.

(tl;dr - Using a skipped scenario inside a non-skipped scenario doesn't seem to work.)