-
Notifications
You must be signed in to change notification settings - Fork 7
StorEvil Context Classes
davidmfoley edited this page Sep 13, 2010
·
12 revisions
StorEvil instantiates classes that you create (Context Classes) in order to interpret specifications.
These Context classes are similar to Steps in Cucumber.
Your context classes must follow a few rules:
- Must be public and have the StoreEvil.Context attribute
- You must tell StorEvil the assemblies that contain your context classes using the storevil.config or a command-line switch.
for example:
[StorEvil.Context]
public class ExampleContext {
public void Given_some_precondition() {
}
}
Note that the types of any return values of context method for partial matches do not necessarily need to be public:
[StorEvil.Context]
public class ExampleContext {
public ExampleSubContext Given_some_precondition() {
return new ExampleSubContext();
}
}
internal class ExampleSubContext {
...
}
If you need to clean up some resources when a context is finished, implement IDisposable in your context class. It will be invoked when the scenario (or other lifetime, if set) is complete.
StorEvil supports contexts that depend on other contexts, or share context. For more information, see: Dependent Contexts.
See: Context Lifetimes