Details
Description
In keeping with a more functional design (to prevent global mutable state) it would be nice to be able have some sort of "test context" shared between steps automatically by the test framework.
I imagine it working something like this:
@Given("we have a cat")
public void firstStep(TestContext testContext)
@When("the cat is fed")
public void secondStep(TestContext testContext)
@Then("the cat is happy")
public void thirdStep(TestContext testContext)
@Then("the cat ate dry food")
public void fourthStep(TestContext testContext)
Basically as the steps are called the test context builds up the state of the world from the previous step, and passes it to the next step. It would be nice if this happened automatically if, for example, any of the steps have a "TextContext" paramater defined.
By doing this it would avoid the need for global mutable state that can cause side effects between steps.
Please leave comments if you have any other questions. Feed your kitties.
Thanks.
Activity
Field | Original Value | New Value |
---|---|---|
Fix Version/s | 4.x [ 18279 ] |
An interesting proposition. For me the real interest would be to share state between steps classes, rather than steps in the same class (which of course this approach would also allow).
I'll earmark it for 4.0