The With keyword is one of the
Flow Fixture Keywords. It sets the
System Under Test for the current fixture.
- with new <type> <parameters> - creates a new instance
- with type <type> - finds a type
- with <method> <parameters> - executes a method of the current fixture or System Under Test.
- with <symbol-name> - retrieves an object saved with the Name Keyword.
- with current - uses the current System Under Test. This is for Use Fixture.
Set the
System Under Test to a new instance.
when input is⇓
story test fixture |
check | plain test | with new 'sample domain adapter'
set name Bob
check 'lower case name' bob | with | new | sample domain adapter |
check | lower case name | bob |
|
| with new 'sample domain adapter'
set name Bob
check 'lower case name' bob | then output is | with | new | sample domain adapter |
check | lower case name | bob |
|
Set the
System Under Test to a new instance with parameters.
when input is⇓
story test fixture |
check | plain test | with new 'sample domain' Bob
check name Bob | with | new | sample domain | Bob |
|
| with new 'sample domain' Bob
check name Bob | then output is | with | new | sample domain | Bob |
|
Set the
System Under Test to the result of a method.
when input is⇓
story test fixture |
check | plain test | 'sample domain adapter'
with 'make sample domain' Joe
check name Joe | with | make sample domain | Joe |
|
| 'sample domain adapter'
with 'make sample domain' Joe
check name Joe | then output is | with | make sample domain | Joe |
|
Set the
System Under Test to a type.
when input is⇓
story test fixture |
check | plain test | with type 'sample domain'
check 'static method' hello | check | static method | hello |
|
| with type 'sample domain'
check 'static method' hello | then output is | check | static method | hello |
|
Set the
System Under Test to a named object.
when input is⇓
story test fixture |
check | plain test | with new 'sample domain' Joe
name joesname name
with joesname
check tolower joe | with | new | sample domain | Joe |
|
| with new 'sample domain' Joe
name joesname name
with joesname
check tolower joe | then output is | with | new | sample domain | Joe |
|
The enclosing fixture must provide a method.
when input is⇓
story test fixture |
check | plain test | use column with 'my method' | use
Member 'mymethod' with 0 parameter(s) not found for type 'fitSharp.Fit.Engine.DefaultFlowInterpreter'.
| column | with | my method |
|
| use column with 'my method' | then output is | use
Member 'mymethod' with 0 parameter(s) not found for type 'fitSharp.Fit.Engine.DefaultFlowInterpreter'.
| column | with | my method |
|
Errors are reported if information is missing.
when input is⇓
story test fixture |
check | plain test | with
with new
with type | with
This table is invalid for this fixture: missing cells for with.
|
with
This table is invalid for this fixture: missing cells for new.
| new |
with
This table is invalid for this fixture: missing cells for with.
| type |
|
| with
with new
with type | then output is | with
This table is invalid for this fixture: missing cells for with.
|
with
This table is invalid for this fixture: missing cells for new.
| new |
with
This table is invalid for this fixture: missing cells for with.
| type |
|