Output API#

The Reqnroll Output API allows you to display texts and attachments in your IDE’s test explorer output window and also in the test result logs.

To use the Reqnroll output API interface you must inject the IReqnrollOutputHelper interface via Context Injection:

Step Definition File#
private readonly IReqnrollOutputHelper _reqnrollOutputHelper;

public CalculatorStepDefinitions(IReqnrollOutputHelper outputHelper)
{
    _outputHelper = outputHelper;
}

There are two methods available:

WriteLine(string text)#

This method adds text:

_reqnrollOutputHelper.WriteLine("TEXT");

AddAttachment(string filePath)#

This method adds an attachment and requires the file path:

_reqnrollOutputHelper.AddAttachment("filePath");

Note

The attachment file can be stored anywhere. But it is important to keep mind that if a local file is added, it will only work on your machine and not accessible when shared with others.

Note

Handling of attachments depends on your runner. MStest and NUnit currently support this feature but xUnit do not.