We can execute methods on our
System Under Test using a row in
Flow Mode.
when input is⇓
story test fixture |
check | plain test | 'sample class'
check count 0
'count method'
check count 1 | |
| 'sample class'
check count 0
'count method'
check count 1 | then output is | |
We can check return values and pass parameters.
when input is⇓
story test fixture |
check | plain test | 'sample class'
check 'method no parms' samplereturn
check 'method with parms' 'my value' 'samplemy value' | check | method no parms | samplereturn |
check | method with parms | my value | samplemy value |
|
| 'sample class'
check 'method no parms' samplereturn
check 'method with parms' 'my value' 'samplemy value' | then output is | check | method no parms | samplereturn |
check | method with parms | my value | samplemy value |
|
We can execute generic methods by adding the keyword '.of.' followed by the generic type name, after the method name.
when input is⇓
story test fixture |
check | plain test | 'sample class'
check 'generic method .of. System.Int32' 123 sample123 | check | generic method .of. System.Int32 | 123 | sample123 |
|
| 'sample class'
check 'generic method .of. System.Int32' 123 sample123 | then output is | check | generic method .of. System.Int32 | 123 | sample123 |
|
We can execute extension methods by adding the keyword '.in.' followed by the name of the extension class, after the method name.
when input is⇓
story test fixture |
check | plain test | 'sample class'
check 'count by' 2 2
check 'increase .in. sample extension' 2 4 | check | increase .in. sample extension | 2 | 4 |
|
| 'sample class'
check 'count by' 2 2
check 'increase .in. sample extension' 2 4 | then output is | check | increase .in. sample extension | 2 | 4 |
|
We can access properties, fields and indexers.
when input is⇓
story test fixture |
check | plain test | 'sample class'
set property something
check property something
set field else
check field else
check anything indexanything | check | anything | indexanything |
|
| 'sample class'
set property something
check property something
set field else
check field else
check anything indexanything | then output is | check | anything | indexanything |
|