fitSharp
Fixture Wrapper
A Fixture Wrapper is a fixture that is created automatically to process a return value from Method Execution in Flow Mode. The new fixture processes the rest of the table with the wrapped value as its System Under Test.

Any enumerable return type is processed by an Array Fixture.

when input is
story test fixture
checkplain test|'sample domain'
'get people' Bob-Martin,Mike-Stockdale
'first name' 'last name'
Bob Martin
Mike Stockdale
sample domain
get people Bob-Martin,Mike-Stockdale
first name last name
Bob Martin
Mike Stockdale
|'sample domain'
'get people' Bob-Martin,Mike-Stockdale
'first name' 'last name'
Bob Martin
Mike Stockdale
then output is
sample domain
get people Bob-Martin,Mike-Stockdale
first name last name
Bob Martin
Mike Stockdale

To use a different fixture for an enumerable return type, use the Use Fixture.

when input is
story test fixture
checkplain test|'sample domain'
use set with 'get people' Mike-Stockdale,Bob-Martin
'first name' 'last name'
Bob Martin
Mike Stockdale
sample domain
use set with get people Mike-Stockdale,Bob-Martin
first name last name
Bob Martin
Mike Stockdale
|'sample domain'
use set with 'get people' Mike-Stockdale,Bob-Martin
'first name' 'last name'
Bob Martin
Mike Stockdale
then output is
sample domain
use set with get people Mike-Stockdale,Bob-Martin
first name last name
Bob Martin
Mike Stockdale

when input is
story test fixture
checkplain test|'sample domain'
use subset with 'get people' Mike-Stockdale,Bob-Martin
'first name' 'last name'
Bob Martin
sample domain
use subset with get people Mike-Stockdale,Bob-Martin
first name last name
Bob Martin
|'sample domain'
use subset with 'get people' Mike-Stockdale,Bob-Martin
'first name' 'last name'
Bob Martin
then output is
sample domain
use subset with get people Mike-Stockdale,Bob-Martin
first name last name
Bob Martin

A dictionary is wrapped in a Set Fixture. The dictionary values are checked.

when input is
story test fixture
checkplain test|'sample domain'
'make dictionary'
'first name' 'last name'
Mike Stockdale
Bob Martin
sample domain
make dictionary
first name last name
Mike Stockdale
Bob Martin
|'sample domain'
'make dictionary'
'first name' 'last name'
Mike Stockdale
Bob Martin
then output is
sample domain
make dictionary
first name last name
Mike Stockdale
Bob Martin

To check dictionary keys and values, we need a method to extract the key value pairs.

when input is
story test fixture
checkplain test|'sample domain'
'make key values'
key value
key1 value1
key2 value2
sample domain
make key values
key value
key1 value1
key2 value2
|'sample domain'
'make key values'
key value
key1 value1
key2 value2
then output is
sample domain
make key values
key value
key1 value1
key2 value2

A data table is wrapped in an Array Fixture.

when input is
story test fixture
checkplain test|'sample domain'
'make data table'
column1 column2
value1 value2
sample domain
make data table
column1 column2
value1 value2
|'sample domain'
'make data table'
column1 column2
value1 value2
then output is
sample domain
make data table
column1 column2
value1 value2

An XML document is wrapped in an Xml Fixture.

when input is
story test fixture
checkplain test|'sample domain'
'make xml'
root
'' child text
sample domain
make xml
root
child text
|'sample domain'
'make xml'
root
'' child text
then output is
sample domain
make xml
root
child text

If the return value is not a fixture, enumerable or a primitive type, it is wrapped in a Do Fixture.

when input is
story test fixture
checkplain test'sample do'
set name Mike

'make person with first' Bob 'and last' Martin
check 'first name' Bob
check 'last name' Martin

check name Mike
sample do
set name Mike

make person with first Bob and last Martin
check first name Bob
check last name Martin

check name Mike
'sample do'
set name Mike

'make person with first' Bob 'and last' Martin
check 'first name' Bob
check 'last name' Martin

check name Mike
then output is
sample do
set name Mike

make person with first Bob and last Martin
check first name Bob
check last name Martin

check name Mike

This wrapping can occur from within the wrapping fixture.

when input is
story test fixture
checkplain test'sample do'
'make person with first' Bob 'and last' Martin
'full name'
check first Bob
check last Martin
sample do
make person with first Bob and last Martin
full name
check first Bob
check last Martin
'sample do'
'make person with first' Bob 'and last' Martin
'full name'
check first Bob
check last Martin
then output is
sample do
make person with first Bob and last Martin
full name
check first Bob
check last Martin

© Copyright Syterra Software Inc. All rights reserved.