I have updated SpecSalad with a new feature today, ApplicationRoles is now a base class which all roles must inherit from, this base class contains the functionality to save and retrieve values. This will allow a task to store important values within the scenario context for later use, using the traditional key value pair.
So a feature
Scenario: Save a value
Given I am a specified role
When I attempt to store: the value '3'
Then I should retrieve the answer '3'
Given I am a specified role
When I attempt to store: the value '3'
Then I should retrieve the answer '3'
Can call a task, telling the role to store a value
- public class Store : ApplicationTask
- {
- public override object Perform_Task()
- {
- Role.StoreValue("the_value", Details.Value_Of("the_value"));
- return null;
- }
- }
and later in the scenario retrieve the value, in this case returning it to do the scenario assert.
- public class RetrieveTheAnswer : ApplicationTask
- {
- public override object Perform_Task()
- {
- return Role.Retrieve("the_value");
- }
- }
I have also added a new feature to show the use of the background: scenario step, and updated the readme file.
These updates are available in SpecSalad version 1.2 on the Nuget gallery.