reportportal / agent-ruby

Agent - Ruby Cucumber and RSpec formatters
Apache License 2.0
15 stars 43 forks source link

Ruby Cucumber and RSpec formatters for ReportPortal

Download

Join Slack chat! stackoverflow UserVoice Build with Love

Installation

Use Ruby 2.3+

Rubygems

From https://rubygems.org

gem install reportportal

or

Add gem 'reportportal', git: 'https://github.com/reportportal/agent-ruby.git' to your Gemfile. Run bundle install.

Usage (examples)

cucumber <other options> -f ReportPortal::Cucumber::Formatter

parallel_cucumber <some options> -o '<some other options> -f ReportPortal::Cucumber::ParallelFormatter'

rspec <other options> -f ReportPortal::RSpec::Formatter

Configuration

Create report_portal.yml configuration file in one of the following folders of your project: '.', './.config', './config' (see report_portal.yaml.example). Alternatively specify path to configuration file via rp_config environment variable.

Supported settings:

Each of these settings can be overridden by an environment variable with the same name and 'rp_' prefix (e.g. 'rp_uuid' for 'uuid'). Environment variable can be upper cased (e.g. 'RP_UUID'). Environment variables take precedence over YAML configuration. Environment variable values are parsed as YAML values.

WebMock configuration

If you use WebMock for stubbing and setting expectations on HTTP requests in Ruby, add this to your configuration file (for RSpec it would be rails_helper.rb or spec_helper.rb)

WebMock.disable_net_connect!(:net_http_connect_on_start => true, :allow_localhost => true, :allow => [/rp\.epam\.com/]) # Don't break Net::HTTP

Formatter modes

The following modes are supported:

Name Purpose
attach_to_launch Do not create a new launch but add executing features/scenarios to an existing launch. Use launch_id or file_with_launch_id settings to configure that. If they are not present client will check rp_launch_id.tmp in Dir.tmpdir)
use_same_thread_for_reporting Send reporting commands in the same main thread used for running tests. This mode is useful for debugging this Report Portal client. It changes default behavior to send commands in the separate thread. Default behavior is there not to slow test execution.
skip_reporting_hierarchy Do not create items for folders and feature files
use_persistent_connection Use persistent connection to connect to the server

Logging

Experimental support for three common logging frameworks was added:

To use Logger, set use_standard_logger parameter to true (see Configuration chapter). For the other two corresponding appenders/outputters are available under reportportal/logging.

Parallel formatter

ReportPortal::Cucumber::ParallelFormatter can be used for tests started via parallel_tests gem.

Note: Launch id is shared between independent processes (as is the case with parallel_tests gem) via a file in Dir.tmpdir.

Links