testrail-cucumber

Gem Version

Sync cucumber automation test results with your testrail suite. Discover an example with Cucumber in this gem source.

Features

  • [x] Update test results in the existing test run
  • [x] Create dynamic test run and update test results in it
  • [x] Update multi-testrail cases's status from a single automation scenario

Installation

Add this line to your application's Gemfile:

gem 'testrail-cucumber'

And then execute:

$ bundle

Or install it yourself as:

$ gem install testrail-cucumber

Import the library in your env.rb file

require 'testrail-cucumber'

Usage

Update one or multiple case(s) at a time

Prefix testrail case id(s) on start of your cucumber scenario or scenario outline; say, C860

  @your_tag
  Scenario: C860 Verify the home page
    Given I navigate to "home" page
    Then I verify the home page

  Scenario: C860 C862 C863 Verify the home page
    Given I navigate to "home" page
    Then I verify the home page

  Scenario Outline: C853 Verify Google search
    And I search for <keyword>
    Then I verify <result> in the search result page

    Examples:
      | keyword | result     |
      | Jesus   | Jesus      |
      | Bible   | My saviour |

Configuration

  1. Create a config file, testrail_config.yml in the project's parent folder
  2. Enter the testrail details based on demand
  3. To execute tests against the existing Test Run,

    testrail:
      url: https://your_url.testrail.io/
      user: [email protected]
      password: ******
      run_id: 111
    

    Here, run_id is the dynamically generated id from your testrail account (say, run_id: 111)

  4. To create a dynamic Test Run and to update results,

    testrail:
      url: https://your_url.testrail.io/
      user: [email protected]
      password: ******
      project_id: 10
      suite_id: 110
    

    Here, project_id and suite_id are the dynamically generated id from your testrail account; run_id is optional in this case.

Hooks

Update the results through Hooks on end of each test

After do |scenario|
  TestrailCucumber::UpdateTestRails.new(scenario).upload_result
end

Is there any demo available for this gem?

Yes, you can use this cucumber demo as an example, https://github.com/prashanth-sams/testrail-cucumber/features

rake test