SpecflowExtension.Storage 1.3.0

There is a newer version of this package available.
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                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SpecflowExtension.Storage" Version="1.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SpecflowExtension.Storage --version 1.3.0                
#r "nuget: SpecflowExtension.Storage, 1.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.4.0 753 12/16/2018
1.3.0 882 6/29/2018
1.2.0 905 6/29/2018
1.1.0 957 6/25/2018
1.0.0 898 6/25/2018

Initial release