添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Repository files navigation

Build status

There are 2 ways to use ReportPortal with xUnit framework, it's depent on runner.

  • Visual Studio Runner
  • xunit.console.exe
  • Visual Studio Runner

    This way is applicable if you use xunit with xunit.runner.visualstudio nuget package.

    Installation

    Install ReportPortal.XUnit nuget package in project with xunit tests.

    Configuration

    Add ReportPortal.json file to the test project.

    "$schema" : " https://raw.githubusercontent.com/reportportal/agent-net-xunit/master/src/ReportPortal.XUnitReporter/ReportPortal.config.schema " , "enabled" : true , "server" : { "url" : " https://rp.epam.com/api/v1/ " , "project" : " default_project " , "apiKey" : " aa19555c-c9ce-42eb-bb11-87757225d535 " "launch" : { "name" : " XUnit Demo Launch " , "description" : " this is description " , "debugMode" : false , "attributes" : [ " t1 " , " os:win10 " ]

    Read more about configuration of other available options and alternative ways how to provide options.

    Run tests

    Now if you execute tests via dotnet test , or dotnet vstest , or vstest.console.exe , you should see real-time report.

    xunit.console.exe

    If you execute tests with xunit.console.exe runner.

    Installation

    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:

  • xunit.console.exe
  • ReportPortal.XUnitReporter.dll
  • 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.

    Configuration

    Configure connection with Report Portal server in ReportPortal.config.json file. Sample is already included in zip archive.

    Run tests

    Just execute your tests as you do it usually. Test results are automatically will be sent during execution.

    Integrate logger framework

  • log4net
  • Serilog
  • System.Diagnostics.TraceListener
  • 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.

    Useful extensions

  • Skippable marks skipped tests as No Defect automatically
  • SourceBack adds piece of test code where test was failed
  • Insider brings more reporting capabilities without coding like methods invocation as nested steps
  • License

    ReportPortal 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.