GherkinSimpleParser 1.4.1

dotnet add package GherkinSimpleParser --version 1.4.1
                    
NuGet\Install-Package GherkinSimpleParser -Version 1.4.1
                    
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="GherkinSimpleParser" Version="1.4.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GherkinSimpleParser" Version="1.4.1" />
                    
Directory.Packages.props
<PackageReference Include="GherkinSimpleParser" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GherkinSimpleParser --version 1.4.1
                    
#r "nuget: GherkinSimpleParser, 1.4.1"
                    
#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.
#:package GherkinSimpleParser@1.4.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GherkinSimpleParser&version=1.4.1
                    
Install as a Cake Addin
#tool nuget:?package=GherkinSimpleParser&version=1.4.1
                    
Install as a Cake Tool

Description

Library that loads Gherkin syntax from a .feature file to an object in order to export it as formated text. This is not meant to interpret the language.

Parsing

How to use the library

var inputLines = new List<string>();
var gherkinObj = new GherkinObjectParser(inputLines).Parse();

// Replaces scenario outlines with one scenario per case in the "Examples"
// "Examples" markdown block is lost in the process
gherkinObj.TransformScenarioOutlineToClassicScenarioAndOverrideScenarioList();

Supports

  • One Feature per file
  • One Background per file
  • Scenario (multiple) (+ alias Example)
  • Given
  • And (given, multiple)
  • When
  • And (when, multiple)
  • Then
  • And (then, multiple)
  • * Alias for And
  • """ (Doc Strings) (for Given, When, Then, And)
  • | (Data Tables) (for Given, When, Then, And)
  • @ (Tags) (Before Scenario and Feature)
  • Scenario Outline (+ alias Scenario Template)
  • Examples (+ alias Scenarios)
  • Markdown after Feature, Background, Scenario, Scenario Outline and Examples

Ignores

  • Empty lines (except in Markdown blocks)
  • # (Comments)

DOES NOT support (will throw exception)

  • Guard clause for wrongly structured files and unexpected lines
  • Multiple Feature per file
  • Rule
  • But

Exports (extension, github only)

To be noted

The converter does not transform scenario outlines to classic scenarios before exporting.

The converter does not exports

  • Tags
  • Markdown blocks

Export as Excel using EPPlus Excel library

Using the applicaiton extension GherkinSimpleParser.Converter you have access to the class ExcelConverter that exports the GherkinObject to a predefined Excel TestPlan.

Export as CSV

To be noted

New lines and carriage return are removed from Doc strings (""") and from Data Tables (|).

Export as CSV for testplan with <speparator> for ANDs

Using the applicaiton extension GherkinSimpleParser.Converter you have access to the class CSVConverter that does the following:

GherkinObject gherkinObj = GherkinObject.Parse(inputLines));
string separator = "|";
List<string> CSVLines = gherkinObj.ExportAsCSV(separator));

Transforms

Feature: feature name
# As user
# I want to do test cases
# In order to test

	Background:
		Given Prerequisite_0.1
		And Prere"q"uisite_0.2

	Scenario: Test Case 1
		Given Prerequisite_1.1
		And �Prere"q"uisite_1.2
		When Action_1
		Then Result_1.1
		And Resu"l"t_1.2

	Scenario: Test Case 2
		Given Prerequisite_2.1
		And Prere"q"uisite_2.2
		When Action_2
		Then Result_2.1
		And Resu"l"t_2.2

into

"Number;GIVEN;WHEN;THEN",
";GENERAL PREREQUISITES:|Prerequisite_0.1|Prere"q"uisite_0.2;;",
"1;Test Case 1;;",
";Prerequisite_1.1|Prere"q"uisite_1.2;Action_1;Result_1.1|Resu"l"t_1.2",
"2;Test Case 2;;",
";Prerequisite_2.1|Prere"q"uisite_2.2;Action_2;Result_2.1|Resu"l"t_2.2"

More information and sources:
https://github.com/Servan42/GherkinSimpleParser

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

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.1 1,801 3/10/2024
1.4.0 140 2/27/2024
1.3.0 190 1/30/2024