Skip to main content
.NETFramework4.5.NETStandard2.0

.NET implementation of Allure java-commons

Published
Aug 2, 2022
4y ago
Total Downloads
9.2M
9,226,947

Install

dotnet add package Allure.Net.Commons --version 2.9.1-preview.7-nunit-fixtures
ProductVersions
.NET Standard
netstandard2.0
Other
.NETFramework4.5

README

Allure.Net.Commons

.Net implementation of Allure java-commons.

Can be targeted either by legacy .net 4.5+ or .net standard 2.* projects.

Use this library to create custom Allure adapters for .Net test frameworks.

Configuration

Allure lifecycle is configured via json file with default name allureConfig.json. NuGet package installs allureConfig.Template.json which you can use as an example. There are 2 ways to specify config file location:

<ItemGroup>
<None Update="allureConfig.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

Allure lifecycle will start with default configuration settings if allureConfig.json is not found.

Raw json configuration can be accessed from AllureLifeCycle.Instance.JsonConfiguration to extend configuration by adapters. See extension example here: https://github.com/allure-framework/allure-csharp/blob/bdf11bd3e1f41fd1e4a8fd22fa465b90b68e9d3f/Allure.SpecFlowPlugin/PluginHelper.cs#L20-L29

Base configuration params are stored in AllureLifeCycle.Instance.Configuration

Allure configuration section is used to setup output directory and link patterns, e.g.:

{
  "allure": {
    "directory": "allure-results", // optional, default value is "allure-results"
    "title": "custom run title", // optional
    "links": //optional 
    [
      "https://example.org/{link}",
      "https://example.org/{issue}",
      "https://example.org/{tms}"
    ]
  }
}

All Link pattern placeholders will be replaced with URL value of corresponding link type, e.g.

link(type: "issue", url: "BUG-01") => https://example.org/BUG-01

AllureLifecycle

AllureLifecycle class provides methods for test engine events processing.

Use AllureLifecycle.Instance property to access.

Fixture Events
  • StartBeforeFixture
  • StartAfterFixture
  • UpdateFixture
  • StopFixture
Testcase Events
  • StartTestCase
  • UpdateTestCase
  • StopTestCase
  • WriteTestCase

Step Events

  • StartStep
  • UpdateStep
  • StopStep
Attachment Events
  • AddAttachment - adds attachment to the current lifecycle executable item
  • AddScreenDiff - adds needed artifacts to the test case with given uuid to be used with screen-diff-plugin
Utility Methods
  • CleanupResultDirectory - can be used in test run setup to clean old result files

Troubleshooting

...

Changes from Previous Version

No structural changes between v2.9.1-preview.6-nunit-fixtures and v2.9.1-preview.7-nunit-fixtures.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.