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.
| check | test result |
| do |
| with | new | sample domain adapter |
| set | name | Bob |
| check | lower case name | bob |
|
| do | | with | new | sample domain adapter | | set | name | Bob | | check | lower case name | bob |
|
Set the System Under Test to a new instance with parameters.
| check | test result |
| do |
| with | new | sample domain | Bob |
| check | name | Bob |
|
| do | | with | new | sample domain | Bob | | check | name | Bob |
|
Set the System Under Test to the result of a method.
| check | test result |
| do |
| with | new | sample domain adapter |
| with | make sample domain | Joe |
| check | name | Joe |
|
| do | | with | new | sample domain adapter | | with | make sample domain | Joe | | check | name | Joe |
|
Set the System Under Test to a type.
| check | test result |
| do |
| with | type | sample domain |
| check | static method | hello |
|
| do | | with | type | sample domain | | check | static method | hello |
|
Set the System Under Test to a named object.
| check | test result |
| do |
| with | new | sample domain | Joe |
| name | joesname | name |
| with | joesname |
| check | tolower | joe |
|
| do | | with | new | sample domain | Joe | | name | joesname | name | | with | joesname | | check | tolower | joe |
|
For named objects or methods, the enclosing fixture must be a flow fixture.
| check | test result |
|
use
fitlibrary.exception.TableStructureException: This table is invalid for this fixture: flow fixture required.
| column | with | my method |
|
Errors are reported if information is missing.
| check | test result |
|
with
fitlibrary.exception.TableStructureException: This table is invalid for this fixture: missing cells for with.
|
with
fitlibrary.exception.TableStructureException: This table is invalid for this fixture: missing cells for with.
| new |
with
fitlibrary.exception.TableStructureException: This table is invalid for this fixture: missing cells for with.
| type |
|