-
Notifications
You must be signed in to change notification settings - Fork 9
StorEvil Grammar
davidmfoley edited this page Sep 13, 2010
·
13 revisions
StorEvil interprets your plaintext specifications by matching them to methods, fields, and properties on your StorEvil Context Classes.
There are two different ways to interpret sentence fragments using StorEvil : by matching the names of the methods using reflection, or by using regular expressions to parse the text.
Although Regular Expression Matching is supported, Reflection Matching by is the preferred method.
You can also use tabular data to drive your scenarios.
The StorEvil plaintext language is fairly close to the Gherkin language
# this is a comment
As an actor
I want to do something
so that I can see a result
# scenarios are used to specify the test cases
Scenario: Scenario description goes here
Given some precondition
When I take some action
Then some expected result
Scenario: a scenario without the Given/When/Then syntax
In some state
Doing something
Results in some expectation
# an outline is a parameterized scenario
# it is executed once for each line in the table
Scenario Outline: addition of two numbers
Given <first> and <second>
I should expect <result>
|first|second|result|
|1 |2 |3 |
|10 |32 |42 |
# You can also use a table in a normal scenario for a set of data
Scenario: Tic-tac-toe example with table
Given the following board
|X|O|O|
|X|O|X|
| | | |
When X plays in the bottom left square
The winner should be X
Scenario: more advanced syntax examples
# everything after the ":" is treated as a single argument
# StorEvil supports parsing this into an array easily
Given the following set of numbers:1,2,3,4,5
# anything in double quotes is treated as a single argument
When I press the "Multiply the numbers" button
Then the result should be 120