In the standard mode of story test execution, each fixture processes a single table, with the fixture name in the first cell of the table.
|fixtureA|
|xxx|xxx|
|fixtureB|
|xxx|xxx|
Do Fixture and Sequence Fixture (and any fixture derived from Flow Fixture Base) can also operate in
Flow Mode, processing all the tables on the story test page without repeating the fixture name in each table. These fixtures are known as flow fixtures. When a flow fixture appears in the first cell of the first table, it operates in
Flow Mode.
|flowFixtureA|
|xxx|xxx|
|xxx|xxx|
If a flow fixture appears after the first table, it operates in standard mode.
|fixtureA|
|xxx|xxx|
|flowFixtureB|
|xxx|xxx|
|fixtureC|
|xxx|xxx|
A fixture can "hide" itself, so that a subsequent flow fixture will appear to be in the first table, and thus operate in
Flow Mode.
Import Fixture and
Fit Version Fixture are examples of hidden fixtures. The hidden fixture overrides the IsVisible property:
public class MyHiddenFixture: Fixture {
public override bool IsVisible { get { return false; } }
...}
|myHiddenFixture|
|xxx|xxx|
|flowFixtureA|
|xxx|xxx|
|xxx|xxx|
A flow fixture can use a different rule to determine when to operate in
Flow Mode, by overriding the IsInFlow metohd:
public class MyGreedyFixture: FlowFixtureBase {
public override bool IsInFlow(int tableCount) { return true; }
...}
|fixtureA|
|xxx|xxx|
|myGreedyFixture|
|xxx|xxx|
|xxx|xxx|
In the tables above, the fixture class name appears in the first cell. If this cell contains a class name that doesn't inherit from Fixture, then a
Do Fixture is created with the class as its
System Under Test.
|myDomainClass|
|xxx|xxx|
is a shorthand for
|do|
|start|myDomainClass|
|xxx|xxx|
If the first cell isn't a class name at all, a Do Fixture is still created. In this case, the first cell will have to be one of the
Flow Fixture Keywords or a procedure from a
Define Fixture in a Suite Set Up page.
|with|new|myDomainClass|xxx|xxx|
|xxx|xxx|
or
|myProcedure|xxx|xxx|
|xxx|xxx|
first cell in first table is class name, creates class instance, following rows in first table and all rows in rest of tables can execute methods on the instance and check results
when input is⇓
story test fixture |
check | plain test | 'simple sample'
check count 0
increment
check count 1 |
|
| 'simple sample'
check count 0
increment
check count 1 | then output is |
|
if the constructor has parameters
when input is⇓
story test fixture |
check | plain test | with new 'simple sample' 42
increment
check count 43 | with | new | simple sample | 42 |
|
| with new 'simple sample' 42
increment
check count 43 | then output is | with | new | simple sample | 42 |
|
fixture name first in any row,, processes rest of table
when input is⇓
story test fixture |
check | plain test | 'simple sample'
check count 0
'sample fixture'
some good stuff
'increment'
'sample fixture'
other good stuff
check count 1 |
|
| 'simple sample'
check count 0
'sample fixture'
some good stuff
'increment'
'sample fixture'
other good stuff
check count 1 | then output is |
|
class but not a fixture, processes rest of table (this is a bit odd?)
when input is⇓
story test fixture |
check | plain test | 'simple sample'
increment
'sample class'
check count 0
check count 1 |
|
| 'simple sample'
increment
'sample class'
check count 0
check count 1 | then output is |
|