SpecflowExtension.Storage
1.3.0
See the version list below for details.
dotnet add package SpecflowExtension.Storage --version 1.3.0
NuGet\Install-Package SpecflowExtension.Storage -Version 1.3.0
<PackageReference Include="SpecflowExtension.Storage" Version="1.3.0" />
paket add SpecflowExtension.Storage --version 1.3.0
#r "nuget: SpecflowExtension.Storage, 1.3.0"
// Install SpecflowExtension.Storage as a Cake Addin #addin nuget:?package=SpecflowExtension.Storage&version=1.3.0 // Install SpecflowExtension.Storage as a Cake Tool #tool nuget:?package=SpecflowExtension.Storage&version=1.3.0
Specflow.Storage
When using the Field,Value table syntax in specflow, we are not able to store certain values from a specfic TableRow. This package offers a TableParser and a simple key-value-storage to perform following actions:
Scenario: Store message parameters
Given the following message is generated
Field | Value |
---|---|
MessageType | TestMessage ⇒ $MessageType$ |
Destination | Destination1 ⇒$Destination$ |
IntValue | 1=> $IntValue$ |
Then the storage has the following entries
Field | Value |
---|---|
MessageType | TestMessage |
Destination | Destination1 |
IntValue | 1 |
Based on the "=>$xyz$" syntax you are able to store the given value. We're also able to inject beforehand stored values (base on the "<=$xyz$" syntax):
When the following message is generated
Field | Value |
---|---|
MessageType | ⇐ $MessageType$ |
Destination | ⇐ $Destination$ |
IntValue | ⇐$IntValue$ |
Then the message contains
Field | Value |
---|---|
MessageType | TestMessage |
Destination | Destination1 |
IntValue | 1 |
Based on that this module offers two main objects:
- Storage, simple key-value-storage
- TableParser, entrypoint to inject or store data to or from a table.
Store data from a table
[Given(@"blabla")]
public void SomeGivenStep(Table table)
{
var tableParser = new TableParser();
// Store values from table -> _storage is property of the Steps objects
tableParser.StoreValues.From(table).In(_storage).Store();
_message = new Message();
foreach(var row in table.Rows)
{
if (!tableParser.RawHasTablePersistorOnlyData(row)) // Ignore rows that have only data for the TableParser
{
_message.Parameters[row[ColumnNames.Field]] = row[ColumnNames.Value];
}
}
}
Inject data from a storage to a table
[Then(@"blablabla")]
public void SomeThanStep(Table table)
{
var tableParser = new TableParser();
tableParser.InjectValues.From(_storage).To(table).Inject();
// Move on here
}
For further examples see https://github.com/moerwald/Specflow.Storage/blob/master/Moerwald.Specflow.Extension.Storage.Test/StoreValueFromTable.feature
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- SpecFlow (>= 2.3.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release