There are 2 ways to use ReportPortal with xUnit framework, it's depent on runner.
This way is applicable if you use xunit with
xunit.runner.visualstudio
nuget package.
Install
ReportPortal.XUnit
nuget package in project with xunit tests.
Add
ReportPortal.json
file to the test project.
Read more about configuration of other available options and alternative ways how to provide options.
Now if you execute tests via
dotnet test
, or
dotnet vstest
, or
vstest.console.exe
, you should see real-time report.
If you execute tests with
xunit.console.exe
runner.
Download zip archive from the
Releases
tab and extract it into the folder with
xunit.console.exe
. After downloading zip file, make sure Windows didn't block it: right click on zip -> Properties -> Unblock.
2 files should be placed in the same folder:
Note: Supports only xUnit v2.4.1. Awaiting issue with ability to use custom reporters.
To verify whether reporter is available, execute
xunit.console.exe
without parameters.
-reportportal
should be listed in Reporters section.
Configure connection with Report Portal server in
ReportPortal.config.json
file. Sample is already included in zip archive.
Just execute your tests as you do it usually. Test results are automatically will be sent during execution.
By default xunit doesn't have capturing test output mechanism. To make log frameworks to put messages to ReportPortal, you have to declare
ITestOutputHelper
object in fixture class constructor, and attach ReportPortal to it.
class MyTests
private ITestOutputHelper _output;
public MyTests(ITestOutputHelper output)
_output = output.WithReportPortal();
[Fact]
public void MyTest1()
_output.WriteLine("my message"); // this message goes to test output, will see it at the end of test
ReportPortal.Shared.Log.Info("my message"); // this message goes immediately to Report Portal
// or use log framework to produce messages
And how you can improve your logging experience with attachments or nested steps.
No Defect
automaticallyReportPortal is licensed under Apache 2.0
We use Google Analytics for sending anonymous usage information as library's name/version and the agent's name/version when starting launch. This information might help us to improve integration with ReportPortal. Used by the ReportPortal team only and not for sharing with 3rd parties. You are able to turn off it if needed.