๐Ÿ“ฆ nvborisenko / reportportal-extensions-sourceback

Paste a piece of source code where test was failed

โ˜… 4 stars โ‘‚ 0 forks ๐Ÿ‘ 4 watching โš–๏ธ MIT License
๐Ÿ“ฅ Clone https://github.com/nvborisenko/reportportal-extensions-sourceback.git
HTTPS git clone https://github.com/nvborisenko/reportportal-extensions-sourceback.git
SSH git clone git@github.com:nvborisenko/reportportal-extensions-sourceback.git
CLI gh repo clone nvborisenko/reportportal-extensions-sourceback
Nikolay Borisenko Nikolay Borisenko Update appveyor.yml 2921e32 3 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ docs
๐Ÿ“ src
๐Ÿ“ test
๐Ÿ“„ .gitignore
๐Ÿ“„ appveyor.yml
๐Ÿ“„ LICENSE
๐Ÿ“„ Logo.png
๐Ÿ“„ NuGet.config
๐Ÿ“„ README.md
๐Ÿ“„ README.md

Install ReportPortal.Extensions.SourceBack nuget package into tests project and see in report where exactly test was failed.

Example

How it works

This package embedds your tests source code into pdb file. When test fails, SourceBack package tracks exceptions stacktrace and inserts corresponding piece of code. This works even if you build and execute tests on different machines.

Requirements

You should compile test project with portable or embedded debug type option. This is already set for the most of projects by default. To change it: right click on the project in Solution Explorer window and then Properties > Build > Advanced > Debugging Information.

Configuration

Configuration parameters are optional. Example for default ReportPortal.config.json file

{
  "Extensions": {
    "SourceBack": {
        "OffsetUp": 4,
        "OffsetDown": 2
      }
   }
}

And alternative is via environment variables like ReportPortal_Extensions_SourceBack_OffsetUp. Read more about it.

List of configuration parameters

NameDescription
ReportPortalExtensionsSourceBackOffsetUpHow many lines of code above to capture. Default: 4.
ReportPortalExtensionsSourceBackOffsetDownHow many lines of code below to capture. Default: 2.
ReportPortalExtensionsSourceBack_OpenWithProgram where to open highlighted line of code. Currently only Visual Studio Code is supported. Default: vscode.

Troubleshooting

Incorrect highlighed line in report

Sometimes this extension doesn't highlight the line of code properly if project is built with Code Optimization enabled. Usually this option is disabled in Debug configuration (Right click on the project Properties > Build > Disable Optimize code).

Internal Tracing

If something doesn't work as you expect, please set environment variable ReportPortal_TraceLevel=Verbose to turn on internal report portal tracing. See verbosed messages in ReportPortal.*.log files.