Allure.Net.Commons 2.10.0-preview.1
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:
set ALLURE_CONFIG environment variable to the full path of json config file. This option is preferable for .net core projects which utilize nuget libraries directly from nuget packages folder. See this example of setting it via code: https://github.com/allure-framework/allure-csharp/blob/bdf11bd3e1f41fd1e4a8fd22fa465b90b68e9d3f/Allure.Commons.NetCore.Tests/AllureConfigTests.cs#L13-L15
place
allureConfig.jsonto the location ofAllure.Commons.dll. This option can be used with .net classic projects which copy all referenced package libraries into binary folder. Do not forget to set 'Copy to Output Directory' property to 'Copy always' or 'Copy if newer' in your test project or set it in .csproj:<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
Context capturing
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. Particularly, changes made in an async callee can't be observed by the caller.
Use the following methods of AllureLifecycle to capture Allure context and
to operate on a context later, after it has been captured:
- Context
- RunInContext
Example:
public static async Task Caller(ScenarioContext scenario)
{
await Callee(scenario);
AllureLifecycle.Instance.RunInContext(
scenario.Get<AllureContext>(),
() =>
{
// 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() }
);
// Pass Allure context to the caller via ScenarioContext
scenario.Set(AllureLifecycle.Instance.Context);
}
Obsoleted methods
Methods with explicit uuid parameters are deprecated. Migrate to their uuid-less counterparts that operate on the current Allure context.
Troubleshooting
...
No packages depend on Allure.Net.Commons.
.NET Standard 2.0
- AspectInjector (>= 2.8.2)
- MimeTypesMap (>= 1.0.8)
- Newtonsoft.Json (>= 13.0.3)
- System.Collections.Immutable (>= 5.0.0)
| Version | Downloads | Last updated |
|---|---|---|
| 2.15.0 | 3 | 07.05.2026 |
| 2.14.1 | 3 | 09.05.2026 |
| 2.14.0 | 2 | 09.05.2026 |
| 2.13.0 | 2 | 09.05.2026 |
| 2.12.1 | 2 | 09.05.2026 |
| 2.12.0 | 2 | 09.05.2026 |
| 2.11.0 | 2 | 09.05.2026 |
| 2.10.0 | 2 | 09.05.2026 |
| 2.10.0-preview.1 | 2 | 10.05.2026 |
| 2.9.5-preview.1 | 2 | 11.05.2026 |
| 2.9.4-preview.6 | 2 | 11.05.2026 |
| 2.9.4-preview.5 | 3 | 11.05.2026 |
| 2.9.4-preview.2 | 2 | 11.05.2026 |
| 2.9.4-preview.1 | 2 | 11.05.2026 |
| 2.9.3-preview.1 | 2 | 11.05.2026 |
| 2.9.2-preview.1 | 2 | 11.05.2026 |
| 2.9.1-preview.7-nunit-fixtures | 2 | 11.05.2026 |
| 2.9.1-preview.6-nunit-fixtures | 2 | 11.05.2026 |
| 2.9.1-preview.5 | 2 | 11.05.2026 |
| 2.9.1-preview.3 | 2 | 11.05.2026 |
| 2.9.1-preview.2 | 2 | 11.05.2026 |
| 2.9.0 | 2 | 10.05.2026 |