The Name keyword is one of the
Flow Fixture Keywords. It assigns an object to a symbol name, which can be used to retrieve the object later with the
Use Fixture,
With Keyword or
Symbol Handlers.
- name <symbol-name> <method> <parameters>
- name <symbol-name> with <with-phrase>
A fixture can be saved and then used.
when test is⇓
| story test fixture |
| check | test result |
| sample do |
| name | savex | make sample do | xxx |
| name | savey | make sample do | yyy |
|
| sample do | | name | savex | make sample do | xxx | | name | savey | make sample do | yyy |
|
|
| sample do |
| name | savex | make sample do | xxx |
| name | savey | make sample do | yyy |
| then result is |
| sample do | | name | savex | make sample do | xxx | | name | savey | make sample do | yyy |
|
A domain object can be saved, and is wrapped in a Do fixture when used.
when test is⇓
| story test fixture |
| check | test result |
| do |
| name | savebob | with | new | sample domain | Bob |
|
| do |
| name | savebob | with | new | sample domain | Bob |
|
|
| do |
| name | savebob | with | new | sample domain | Bob |
| then result is |
| do |
| name | savebob | with | new | sample domain | Bob |
|
Errors are reported when the method is invalid or cells are missing.
when test is⇓
| story test fixture |
| check | test result |
|
name
Member 'garbage' with 0 parameter(s) not found for type 'fitlibrary.DoFixture'.
| stuff | garbage |
name
fitlibrary.exception.TableStructureException: This table is invalid for this fixture: missing cells for name.
| stuff |
name
fitlibrary.exception.TableStructureException: This table is invalid for this fixture: missing cells for name.
|
|
|
| then result is |
name
Member 'garbage' with 0 parameter(s) not found for type 'fitlibrary.DoFixture'.
| stuff | garbage |
name
fitlibrary.exception.TableStructureException: This table is invalid for this fixture: missing cells for name.
| stuff |
name
fitlibrary.exception.TableStructureException: This table is invalid for this fixture: missing cells for name.
|
|
Objects are assigned to symbols.
when test is⇓
| story test fixture |
| check | test result |
| sample do |
| name | savebob | with | new | sample domain | Bob |
| check | get name | <<savebob | Bob |
|
| sample do |
| name | savebob | with | new | sample domain | Bob |
| check | get name | <<savebob fit.Test.Double.SampleDomain | Bob |
|
|
| sample do |
| name | savebob | with | new | sample domain | Bob |
| check | get name | <<savebob | Bob |
| then result is |
| sample do |
| name | savebob | with | new | sample domain | Bob |
| check | get name | <<savebob fit.Test.Double.SampleDomain | Bob |
|