![]() |
VOOZH | about |
dotnet add package Allure.Net.Commons --version 2.15.0
NuGet\Install-Package Allure.Net.Commons -Version 2.15.0
<PackageReference Include="Allure.Net.Commons" Version="2.15.0" />
<PackageVersion Include="Allure.Net.Commons" Version="2.15.0" />Directory.Packages.props
<PackageReference Include="Allure.Net.Commons" />Project file
paket add Allure.Net.Commons --version 2.15.0
#r "nuget: Allure.Net.Commons, 2.15.0"
#:package Allure.Net.Commons@2.15.0
#addin nuget:?package=Allure.Net.Commons&version=2.15.0Install as a Cake Addin
#tool nuget:?package=Allure.Net.Commons&version=2.15.0Install as a Cake Tool
👁 Nuget release
👁 Nuget downloads
Allure.Net.Commons is a library for creating custom Allure adapters for .NET test frameworks.
The library can be used by any project that targets a framework compatible with .NET Standard 2.0 (.NET Framework 4.6.1+, .NET Core 2.0+, .NET 5.0+, and more). See the complete list here.
If you're developing on a Mac machine with Apple silicon, make sure you have Rosetta installed. Follow this article for the instructions: https://support.apple.com/en-us/HT211861
You may also install Rosetta via the CLI:
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
The Allure lifecycle is configured via a JSON file with the default name
allureConfig.json. NuGet package installs allureConfig.Template.json, which
you can use as an example. There are two ways to specify config file location:
allureConfig.json to the project and ensure it's copied to the
project output directory next to Allure.Net.Commons.dll:
<ItemGroup>
<None Update="allureConfig.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
The Allure lifecycle will start with the default configuration settings if no allureConfig.json is provided.
The unparsed configuration can be accessed via
AllureLifeCycle.Instance.JsonConfiguration. Adapters can use it to read
extended configuration properties they need. Check an example
here.
The parsed configuration object can be accessed via
AllureLifeCycle.Instance.Configuration.
An example of the configuration file is provided below:
{
"allure": {
"directory": "allure-results",
"title": "custom run title",
"links":
[
"https://example.org/{link}",
"https://example.org/{issue}",
"https://example.org/{tms}"
],
"failExceptions": [
"MyNamespace.MyAssertionException"
]
}
}
The directory property defaults to "allure-results".
All link pattern placeholders will be replaced with the URL value of the corresponding link type. Given the configuration above, the following transformation will be made:
link(type: "issue", url: "BUG-01") => https://example.org/BUG-01
failExceptions must be an array of strings, each representing the full name of
an exception type. If an unhandled exception occurs whose type matches one of
the provided types, the test/step/fixture is considered failed. Otherwise, it's
considered broken. An exception's type matches a name if:
Use the attributes defined in the Allure.Net.Commons.Attributes namespaces:
| Attribute | Effect | Apply to | Notes |
|---|---|---|---|
[AllureAfter] |
Creates a tear down fixture from the method call. | Method. | Uses AspectInjector under the hood. |
[AllureAttachment] |
Creates an attachment from the method's return value. | Method. | Only supports string and byte[] return types. Uses AspectInjector under the hood. |
[AllureBddHierarchy] |
Adds the epic, feature, and story labels to test results at once. |
Method, class, interface. | This is a shorthand for [AllureEpic], AllureFeature, and [AllureStory]. |
[AllureBefore] |
Creates a setup fixture from the method or constructor call. | Method, constructor. | Uses AspectInjector under the hood. |
[AllureDescription] |
Sets a description of test results. | Method, class, interface. | If applied multiple times with Append set, all the strings are joined with \n\n. |
[AllureDescriptionHtml] |
Sets a description of test results in raw HTML. | Method, class, interface. | If applied multiple times with Append set, all the strings are joined (no separator used). |
[AllureEpic] |
Adds the epic label to test results. |
Method, class, interface. | Discards the default BDD hierarchy. |
[AllureFeature] |
Adds the feature label to test results. |
Method, class, interface. | Discards the default BDD hierarchy. |
[AllureId] |
Applies the ALLURE_ID label to test results. |
Method. | - |
[AllureIssue] |
Adds an issue link to test results | Method, class, interface. | If a short ID is used instead of a full URL, a link template must exists in the config. |
[AllureLabel] |
Adds a custom label to test results. | Method, class, interface. | - |
[AllureLink] |
Adds a link to test results. | Method, class, interface. | If a short ID is used instead of a full URL, a link template must exists in the config. |
[AllureMeta] |
Applies a custom set of attributes to test results. | Method, class, interface. | See #406. |
[AllureName] |
Sets a display name of test results. | Method, class, interface. | When applied to a test class, affects the value of the default suite label created from this class. |
[AllureOwner] |
Applies the owner label to test results. |
Method, class, interface. | - |
[AllureParameter] |
Affects how method arguments are converted to Allure parameters. | Parameter. | Allows for ignoring the parameters, see #482. |
[AllureParentSuite] |
Applies the parentSuite label to test results. |
Method, class, interface. | Discards the default suite hierarchy. |
[AllureSeverity] |
Applies the severity label to test results. |
Method, class, interface. | - |
[AllureStep] |
Creates Allure steps from method calls. | Method. | Uses AspectInjector under the hood. |
[AllureStory] |
Applies the story label to test results. |
Method, class, interface. | Discards the default BDD hierarchy. |
[AllureSubSuite] |
Applies the subSuite label to test results. |
Method, class, interface. | Discards the default suite hierarchy. |
[AllureSuite] |
Applies the suite label to test results. |
Method, class, interface. | Discards the default suite hierarchy. |
[AllureSuiteHierarchy] |
Applies the parentSuite, suite, and subSuite labels at once. |
Method, class, interface. | This is a shorthand for [AllureParentSuite], [AllureSuite] and [AllureSubSuite]. |
[AllureTag] |
Applies the tag labels to test results. |
Method, class, interface. | - |
[AllureTmsItem] |
Applies a TMS item link to test results | Method, class, interface. | If a short ID is used instead of a full URL, a link template must exists in the config. |
Most of the attributes are straightforward and can be applied on a method, class, or interface:
Applying [AllureStep] automatically wraps method calls into Allure step. Call arguments are automatically converted to Allure parameters.
Similarly, [AllureBefore] and [AllureAfter] wrap method calls into fixtures. Apply these to
setup/teardown methods that are invoked by the framework to add fixtures to the report.
Apply [AllureAttachment] to a method that returns string, byte[], System.IO.Stream,
or async versions of these types (e.g., Task<string>) to automatically attach returned values
each time the method is called.
Apply [AllureAttachmentFile] to a method that returns string, FileInfo, or async versions
of these types (e.g., Task<string>) to automatically attach files on each call. The returned
values are treated as file paths.
All four attributes mentioned above requires rely on AspectInjector. If you disable AspectInjector
(e.g., by setting the AspectInjector_Enabled MSBuild property to false), the attributes won't
do anything.
There are two contexts where Allure automatically converts method arguments into Allure parameters:
In both contexts, [AllureParameter] can be used to affect the conversion:
Ignored to skip the argument.Name to explicitly name the parameter.Mode to mask or hide the value (the original value will still exist in the result files).Excluded to ignore the parameter when identifying the test that corresponds to the test
result (see here).Example:
using Allure.Net.Commons;
public class MyTests
{
public void MyParameterizedTestMethod(
[AllureParameter(Ignore = true)] IUserService users,
[AllureParameter(Name = "User")] string userName,
[AllureParameter(Mode = ParameterMode.Masked)] string password,
[AllureParameter(Excluded = true)] DateTime timestamp
)
{
// ...
}
}
You can compose multiple attributes in two ways.
Apply the attributes to a new interface and apply the interface to the classes the attributes should affect:
using Allure.Net.Commons.Attributes;
[AllureEpic("My epic")]
[AllureFeature("My feature")]
[AllureIssue("125")]
[AllureTag("acceptance")]
public interface IMyFeatureTests { }
public class MyTestClass : IMyFeatureTests
{
// tests
}
public class AnotherTestClass : IMyFeatureTests
{
// more tests
}
[AllureMeta]Define a new attribute class that derives from AllureMetaAttribute and apply the attributes
to this class. Use the new class to apply all the attributes to test classes and methods:
using System;
using Allure.Net.Commons.Attributes;
[AllureEpic("My epic")]
[AllureFeature("My feature")]
[AllureIssue("125")]
[AllureTag("acceptance")]
public class MyFeatureAttribute : AllureMetaAttribute { }
[MyFeature]
public class MyTestClass : IMyFeatureTests
{
// tests
}
public class AnotherTestClass : IMyFeatureTests
{
[Test]
[MyFeature]
public void MyTestMethod()
{
// test body
}
}
If [AllureDescription] is applied multiple times on different levels, the most specific one wins,
unless you set Append. In such a case, all strings are joined with \n\n creating separate
markdown paragraphs:
[AllureDescription("Paragraph 1", Append = true)]
class Base { }
[AllureDescription("Paragraph 2", Append = true)]
class TestClass : Base
{
[Test]
[AllureDescription("Paragraph 3", Append = true)] // Without Append, the description will be just "Paragraph 3"
public void MyTest()
{
// test body
}
}
For [AllureDescriptionHtml], the behavior is almost the same. The only difference is that no
separator is used to join multiple strings. Use block elements to keep the descriptions separate.
Use this API to enhance the report at runtime.
Use the Allure.Net.Commons.AllureApi class to access the most commonly used
functions.
SetTestNameSetFixtureNameSetStepNameSetDescriptionSetDescriptionHtmlAddLabelsAddLabelSetSeveritySetOwnerSetAllureIdAddTagsAddLinksAddLinkAddIssueAddTmsItemAddParentSuiteAddSuiteAddSubSuiteAddEpicAddFeatureAddStoryStep(string, Action): void - step action.Step<T>(string, Func<T>): T - step function.Step(string, Func<Task>): Task - async step action.Step<T>(string, Func<Task<T>>): T - async step function.Step(string)Use this class to access some less commonly used functions.
Use the functions below only if lambda steps don't suit your needs.
StartStep(string): voidStartStep(string, Action<StepResult>): voidPassStep(): voidPassStep(Action<StepResult>): voidFailStep(): voidFailStep(Action<StepResult>): voidBreakStep(): voidBreakStep(Action<StepResult>): voidBefore(string, Action): void - setup fixture action.Before<T>(string, Func<T>): T - setup fixture function.Before(string, Func<Task>): Task - async setup fixture action.Before<T>(string, Func<Task<T>>): T - async setup fixture function.After(string, Action): void - teardown fixture action.After<T>(string, Func<T>): T - teardown fixture function.After(string, Func<Task>): Task - async teardown fixture action.After<T>(string, Func<Task<T>>): T - async teardown fixture function.Use the functions below only if lambda fixtures don't suit your needs.
StartBeforeFixture(string): voidStartAfterFixture(string): voidPassFixture(): voidPassFixture(Action<FixtureResult>): voidFailFixture(): voidFailFixture(Action<FixtureResult>): voidBreakFixture(): voidBreakFixture(Action<FixtureResult>): voidThis API is designed for adapter or library authors. You may still use it as a test author, but we recommend considering the Attribute/Runtime API first.
The AllureLifecycle
class provides methods to manipulate the Allure context while responding to the
test framework's events. Use AllureLifecycle.Instance property to access it.
The methods above operate on the current Allure context. This context flows naturally as a part of ExecutionContext and is subject to the same constraints. Notably, changes made in an async callee can't be observed by the caller.
Use the following methods of AllureLifecycle to capture the current Allure
context and to operate on the captured context later:
Example:
public static async Task Caller(ScenarioContext scenario)
{
await Callee(scenario);
AllureLifecycle.Instance.RunInContext(
scenario.Get<AllureContext>(), // Get the previously captured context
() =>
{
// The test context required by the below methods wouldn't be
// visible if they weren't wrapped with RunInContext.
AllureLifecycle.Instance.StopTestCase();
AllureLifecycle.Instance.WriteTestCase();
}
);
}
public static async Task Callee(ScenarioContext scenario)
{
AllureLifecycle.Instance.StartTestCase(
new(){ uuid = Guid.NewGuid().ToString() }
);
// Capture the context in an object of the test framework's object model
scenario.Set(AllureLifecycle.Instance.Context);
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Allure.Net.Commons:
| Package | Downloads |
|---|---|
|
Allure.NUnit
Create beautiful reports from your NUnit tests. |
|
|
Allure.Reqnroll
Create beautiful reports from your Reqnroll tests. |
|
|
Allure.Xunit
Create beautiful reports from your xUnit.net tests. |
|
|
Allure.SpecFlow
Create beautiful reports from your SpecFlow tests. |
|
|
Empyrean.Core.Allure
Package Description |
Showing the top 1 popular GitHub repositories that depend on Allure.Net.Commons:
| Repository | Stars |
|---|---|
|
microsoft/garnet
Garnet is a remote cache-store from Microsoft Research that offers strong performance (throughput and latency), scalability, storage, recovery, cluster sharding, key migration, and replication features. Garnet can work with existing Redis clients.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 2.15.0 | 718,851 | 4/28/2026 |
| 2.14.1 | 1,122,572 | 10/21/2025 |
| 2.14.0 | 49,206 | 10/16/2025 |
| 2.13.0 | 44,542 | 10/9/2025 |
| 2.12.1 | 4,107,677 | 6/4/2024 |
| 2.12.0 | 325,964 | 4/2/2024 |
| 2.11.0 | 327,286 | 11/29/2023 |
| 2.10.0 | 136,504 | 10/16/2023 |
| 2.10.0-preview.1 | 7,943 | 9/22/2023 |
| 2.9.5-preview.1 | 195,835 | 3/22/2023 |
| 2.9.4-preview.6 | 54,651 | 2/13/2023 |
| 2.9.4-preview.5 | 312 | 2/13/2023 |
| 2.9.4-preview.2 | 18,913 | 1/2/2023 |
| 2.9.4-preview.1 | 365 | 12/30/2022 |
| 2.9.3-preview.1 | 11,800 | 12/23/2022 |
| 2.9.2-preview.1 | 17,082 | 9/19/2022 |
| 2.9.1-preview.7-nunit-fixtures | 2,313 | 8/2/2022 |
| 2.9.1-preview.6-nunit-fixtures | 356 | 7/27/2022 |