Column fixtures have a virtual Execute() method which is called before the first check operation in a given row. We can override this method to handle some processing after input/before check.
public class ExecuteExampleFixture : ColumnFixture {
public int IntField;
public override void Execute() { IntField = IntField*2; }
}
when test is⇓
story test fixture |
check | test result |
execute example |
int field | int field? |
1 | 2 |
2 | 4 |
|
execute example |
int field | int field? |
1 | 2 |
2 | 4 |
|
|
execute example |
int field | int field? |
1 | 2 |
2 | 4 |
| then result is |
execute example |
int field | int field? |
1 | 2 |
2 | 4 |
|
Column fixtures can use a
Domain Adapter.
when test is⇓
story test fixture |
check | test result |
use | column | with | new | sampledomainadapter |
name | lower case name? |
Bill | bill |
|
use | column | with | new | sampledomainadapter |
name | lower case name? |
Bill | bill |
|
|
use | column | with | new | sampledomainadapter |
name | lower case name? |
Bill | bill |
| then result is |
use | column | with | new | sampledomainadapter |
name | lower case name? |
Bill | bill |
|
To create objects, a column heading uses a "new" prefix. An object is created using the data cell as a constructor parameter. The newly-created object becomes the
System Under Test.
when test is⇓
story test fixture |
check | test result |
column |
new sample domain | name? |
Bob | Bob |
|
column |
new sample domain | name? |
Bob | Bob |
|
|
column |
new sample domain | name? |
Bob | Bob |
| then result is |
column |
new sample domain | name? |
Bob | Bob |
|
A member name beginning with "new" does not create a new object.
when test is⇓
story test fixture |
check | test result |
use | column | with | new | sample domain |
new name | new name? |
Ted | Ted |
|
use | column | with | new | sample domain |
new name | new name? |
Ted | Ted |
|
|
use | column | with | new | sample domain |
new name | new name? |
Ted | Ted |
| then result is |
use | column | with | new | sample domain |
new name | new name? |
Ted | Ted |
|