Allure NUnit configuration

This page describes the configuration options that affect the behavior of Allure NUnit.

By default, Allure NUnit tries to read the allureConfig.json file in the same directory where the test assembly is located. To make sure the file is present there, edit the file properties in your IDE or manually in your *.csproj file and set the corresponding item's CopyToOutputDirectory to either Always or PreserveNewest. For example:

XML
<Project Sdk="Microsoft.NET.Sdk"> <!-- ... --> <ItemGroup> <None Update="specflow.json"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> </ItemGroup> </Project>

Alternatively, use the ALLURE_CONFIG environment variable to specify a relative or absolute path of the configuration file.

allure.directory

Path to the directory where Allure NUnit will save the test results, see How it works. If the directory does not exist, it will be created. Defaults to allure-results.

Note that the path is treated as relative to the build output directory of the project. When building and running tests from an IDE, this is typically different from the solution folder. Multiple ../ elements may be needed if you want to put the test results into a directory in the solution folder.

JSON
{ "allure": { "directory": "../../../../../allure-results" } }

List of patterns that can be used to construct full URLs from short identifiers.

Each pattern must be a string containing a placeholder surrounded by curly brackets, for example: {issue}. When processing a link, Allure NUnit selects the pattern whose placeholder matches the link type (as specified using the Link or [AllureLink] arguments). The placeholder is then replaced by the short identifier.

For example, with the configuration below, the link BUG-123 of type issue will be translated to https://issues.example.com/BUG-123.

JSON
{ "allure": { "links": [ "https://issues.example.com/{issue}", "https://tms.example.com/{tms}", "https://jira.example.com/browse/{jira}" ] } }

allure.failExceptions

A list of exception types representing assertion failures.

In case of an exception that matches one of the listed classes, the Failed status is assigned to the test, step, or fixture. In case of any other exception, the Broken status is assigned. When looking for matches, Allure NUnit uses not only the exception class's own full name but also all its interfaces and base classes.

The default list includes the NUnit.Framework.Internal.NUnitException and NUnit.Framework.AssertionException classes. The setting, if not empty, overrides the default list.

With the example configuration below, a test will be considered failed if it throws NUnit.Framework.AssertionException, MyNamespace.MyCustomException, or anything that derives from them. At the same time, any other exception will make the test broken.

JSON
{ "allure": { "failExceptions": ["NUnit.Framework.AssertionException", "MyNamespace.MyCustomException"] } }
Powered by
logo

Join our newsletter

Join our community

We aim to make Allure Report as reliable and user-friendly as possible, and together with the community, we're here to help when problems arise.

© 2024 Qameta Software Inc. All rights reserved.