Contexts
A Context allows you to specify a set of conditions that are necessary for executing a given scenario.
You often need to bring your application to a certain state before executing the scenario. It is also necessary to return your application to the same state it was before execution of the test. Further, these activities may be common across multiple scenarios. Expressing these activities as part of the business workflow adds unnecessary noise to the scenarios and makes it difficult to understand the intent of the scenario. In Twist, Contexts are used to abstract these activities as logical steps that need to be executed before and after a scenario execution.
A Context has two parts:
- A setUp part which is executed before executing the scenario.
- A teardown part which gets executed after the execution of the scenario.
Contexts can be reused across Scenarios and a scenario can have more than one Contexts.
For example, if you are testing a GUI based application that requires a person to login first, the login process can be abstracted as a Context
"Context" in Twist works similar to the setUp/tearDown in JUnit.

