Skip to content

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:

  1. Must be public
  2. Must have a parameterless constructor.
  3. You must tell StorEvil the assemblies that contain your context classes using the storevil.config or a command-line switch.

for example:


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:


public class ExampleContext  {
    public ExampleSubContext Given_some_precondition() {
        return new ExampleSubContext();
    }
}

internal class ExampleSubContext {
   ...
}

Lifespan of context classes

A context class will be reused only during the interpretation of one scenario.
(Or one example in the case of a scenario outline).

Clone this wiki locally