Jaxx.Net.IterationParser 1.0.1.15-pre

This is a prerelease version of Jaxx.Net.IterationParser.
dotnet add package Jaxx.Net.IterationParser --version 1.0.1.15-pre
                    
NuGet\Install-Package Jaxx.Net.IterationParser -Version 1.0.1.15-pre
                    
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="Jaxx.Net.IterationParser" Version="1.0.1.15-pre" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Jaxx.Net.IterationParser" Version="1.0.1.15-pre" />
                    
Directory.Packages.props
<PackageReference Include="Jaxx.Net.IterationParser" />
                    
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 Jaxx.Net.IterationParser --version 1.0.1.15-pre
                    
#r "nuget: Jaxx.Net.IterationParser, 1.0.1.15-pre"
                    
#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.
#addin nuget:?package=Jaxx.Net.IterationParser&version=1.0.1.15-pre&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Jaxx.Net.IterationParser&version=1.0.1.15-pre&prerelease
                    
Install as a Cake Tool

Jaxx.Net.IterationParser

This library will split a (multiline) text by a given line delimiter into an array of strings. Than each of the strings (lines) will be parsed by a regular expression.

The parser could be configured in a json file.

Basic Usage

IGenericParser parser = new GenericParser();
var config = new JsonFileGenericRegExSelector("config.json")
List<Dictionary<string,string> = parser.ParseTestResult(input, config.RegExSelectors);

The result will be a List<Dictionary<string ,string>. The key returns the "Name" tag from configuration, the value returns the matching regular expression.

Configuration (Json)

Configuration is loaded into JsonFileGenericRegExSelector class. The configuration uses the RegExSelector model.

With "SingleLineSelector" you could define the line delimiter which will be used to split the input string into the lines. This option has no name and no match group property.

In the "RegExSelectors" array you could define the names and the regular expression which will be used int the result dictionary.

{
  "RegularExpressionFilters": {
    "SingleLineSelector": {
      "RegExSelector": {
        "Selector": "\r\n"
      }
    },
    "RegExSelectors": [
      {
        "Name": "IterationCount",
        "Selector": "^.*?TL( |)(\\d{1,2}).*?;",
        "SelectedMatchGroup": "2"
      },
      {
        "Name": "IterationDate",
        "Selector": "^.*?;.*?(\\d{2}.\\d{2}.(20\\d{2}|\\d{2}))",
        "SelectedMatchGroup": "1"
      },
      {
        "Name": "IterationResult",
        "Selector": "^.*?;.*?;(.*?)$",
        "SelectedMatchGroup": "1"
      },
      {
        "Name": "IterationType",
        "Selector": "^(.+?);",
        "SelectedMatchGroup": "1"
      },

      {
        "Name": "IterationLine",
        "Selector": "^(.+?)$",
        "SelectedMatchGroup": "1"
      }
    ]
  }
}

The example above will parse the follwing input string

QA TL1;01.01.2019;FAILED
QA TL2;03.03.2019;PASSED

into

List<Dictionary<string,string>>
{
  Dictionary<string,string>
  {
    { Key = "IterationCount", Value = "1" },
    { Key = "IterationDate", Value = "01.01.2019" },
    { Key = "IterationResult", Value = "FAILED" },
    { Key = "IterationType", Value = "QA TL1" },
    { Key = "IterationLine", Value = "QA TL1;01.01.2019;FAILED" },
  },
  Dictionary<string,string>
  {
    { Key = "IterationCount", Value = "2" },
    { Key = "IterationDate", Value = "03.03.2019" },
    { Key = "IterationResult", Value = "PASSED" },
    { Key = "IterationType", Value = "QA TL2" },
    { Key = "IterationLine", Value = "QA TL2;03.03.2019;PASSED" }
  }
}

Typed Result

IterationParser is orginally intented to parse test iteration results from a single field in an issue tracking tool. Instead of using the generic Dictionary approach from above, you can parse the text into a List<IterationModel>.

public class IterationModel
{
    public DateTime IterationDate { get; set; }
    public string IterationType { get; set; }
    public int IterationCount { get; set; }
    public string IterationResult { get; set; }
    public string IterationLine { get; set; }
}
  • Iteration Line contains the complete and unparsed string.
  • If iteration line could not be parsed with the given RegEx in the configured selector:
    • IterationDate will be set to 01.01.0001
    • IterationCount will be set to 0
    • IterationResult and IterationResult will be set to ""

Usage:

IIterationParser parser = new IterationModelParser();
List<IterationModel>  result = parser.ParseTestResult(input, new JsonFileGenericRegExSelector"config.json")..RegExSelectors):

There is a basic DefaultIterationRegExSelector available which could be used as default configuration (without external json cofiguration file). The configuration example from above matches the default configuration.

IIterationParser parser = new IterationModelParser();
List<IterationModel> result = parser.ParseTestResult(input, new DefaultIterationRegExSelector()):
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.0.1.15-pre 571 1/17/2019
1.0.1.14-pre 581 1/16/2019
1.0.1.11-pre 558 1/14/2019