{"id":15022428,"url":"https://github.com/prashanth-sams/testrail-rspec","last_synced_at":"2025-10-24T01:30:31.595Z","repository":{"id":59157767,"uuid":"198260037","full_name":"prashanth-sams/testrail-rspec","owner":"prashanth-sams","description":"Sync Rspec test results with your testrail suite. Discover an example with Capybara in this gem source","archived":false,"fork":false,"pushed_at":"2020-03-28T16:27:12.000Z","size":47,"stargazers_count":11,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-26T21:23:33.800Z","etag":null,"topics":["automation","capybara","capybara-rspec","rspec","selenium","selenium-webdriver","testrail"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/testrail-rspec","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prashanth-sams.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-22T16:11:06.000Z","updated_at":"2024-08-29T11:55:58.000Z","dependencies_parsed_at":"2022-09-13T20:11:16.886Z","dependency_job_id":null,"html_url":"https://github.com/prashanth-sams/testrail-rspec","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashanth-sams%2Ftestrail-rspec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashanth-sams%2Ftestrail-rspec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashanth-sams%2Ftestrail-rspec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashanth-sams%2Ftestrail-rspec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prashanth-sams","download_url":"https://codeload.github.com/prashanth-sams/testrail-rspec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219867198,"owners_count":16555821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","capybara","capybara-rspec","rspec","selenium","selenium-webdriver","testrail"],"created_at":"2024-09-24T19:57:56.303Z","updated_at":"2025-10-24T01:30:31.240Z","avatar_url":"https://github.com/prashanth-sams.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# testrail-rspec\n[![Gem Version](https://badge.fury.io/rb/testrail-rspec.svg)](http://badge.fury.io/rb/testrail-rspec)\n\u003e Sync `Rspec` test results with your `testrail` suite. Discover an example with Capybara in this gem source.\n\n### Features\n- [x] Update test results in the existing test run\n- [x] Create dynamic test run and update test results in it\n- [x] Update multi-testrail cases from a single automation scenario \n- [x] Delete/clean all the existing test runs in a project's suite before test run\n- [x] Skip specific test-runs from deletion, when `clean_testrun` is set `true`\n- [x] Static status comments on all the scenarios \n- [x] Support for RSpec `shared examples` \n- [x] Disable `testrail-rspec` execution on-demand\n- [x] Support for environment variables to pass testrail config values\n\n## Installation\n\nAdd this line to your application's Gemfile:\n```ruby\ngem 'testrail-rspec'\n```\n\nAnd then execute:\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n```bash\n$ gem install testrail-rspec\n```\n\n**Import the library in your `spec_helper.rb` file**\n```\nrequire 'testrail-rspec'\n```\n\n## Usage outline\n\n#### Update one case at a time\nPrefix TestRail Case ID on start of your rspec scenario; say, `C845`\n\n```ruby\n  describe 'Verify Google Home Page' do\n    \n    scenario 'C845 verify the Google home page' do\n      expect(page).to have_content('Google')\n    end\n  \n    scenario 'C847 verify the Google home page to fail' do\n      expect(page).to have_content('Goo gle')\n    end\n    \n    scenario 'C853 verify the Google home page to skip' do\n      skip \"skipping this test\"\n    end\n  \n  end\n```\n\n#### Update multi-cases at a time\nPrefix multiple testrail case id(s) on start of your rspec scenario; say, `C845 C845 your scenario description`\n\n```ruby\n  describe 'Verify Google Home Page' do\n    \n    scenario 'C847 C846 C845 verify the Google home page' do\n      expect(page).to have_content('Google')\n    end\n  \n    scenario 'C848 C849 verify the Google home page to fail' do\n      expect(page).to have_content('Goo gle')\n    end\n    \n    scenario 'verify the Google home page to fail' do\n      expect(page).to have_content('Goo gle')\n    end\n    \n  end\n```\n\n#### Use context blocks to update cases\n`Context blocks` with testrail case id(s) to make use of `Shared Examples`\n\n```ruby\nshared_examples 'log in' do\n  it 'logs in'\nend\n\nshared_examples 'log out' do\n  it 'logs out'\nend\n\ndescribe 'User login' do\n  context 'Regular user' do\n    let(:user) { create(:regular_user) }\n    context 'C845 single case' do\n      include_examples 'log in'\n    end\n\n    context 'C847' do\n      include_examples 'log out'\n    end\n  end\n\n  context 'Admin user' do\n    let(:user) { create(:admin_user) }\n    context 'C850 C853 multi cases' do\n      include_examples 'log in'\n    end\n\n    context 'nothing to update in test-rail' do\n      include_examples 'log out'\n    end\n  end\nend\n```\n\n#### Configuration\n\n1. Create a config file, `testrail_config.yml` in the project's parent folder\n2. Enter the testrail details based on demand\n3. To execute tests against the existing `Test Run`,\n    ```yaml\n    testrail:\n      url: https://your_url.testrail.io/\n      user: your@email.com\n      password: ******\n      run_id: 111\n    ```\n    Here, `run_id` is the dynamically generated id from your testrail account (say, `run_id: 111`)\n\n4. To create a dynamic `Test Run` and to update results,\n    ```yaml\n    testrail:\n      url: https://your_url.testrail.io/\n      user: your@email.com\n      password: ******\n      project_id: 10\n      suite_id: 110\n    ```\n    Here, `project_id` and `suite_id` are the dynamically generated id from your testrail account; `run_id` is optional in this case.\n\n5. To delete all test-runs before execution,\n    ```yaml\n    testrail:\n      url: https://your_url.testrail.io/\n      user: your@email.com\n      password: ******\n      clean_testrun: true\n      project_id: 10\n      suite_id: 110\n    ```\n    Set, `clean_testrun: false` if you don't want to clean the existing test runs; but this keyword is optional.\n\n6. Skip specific test-runs from deletion: set `clean_testrun: true` \u0026 `skip_testrun_ids: value, ...`\n    ```yaml\n    testrail:\n      url: https://your_url.testrail.io/\n      user: your@email.com\n      password: ******\n      clean_testrun: true\n      skip_testrun_ids: 473, 475\n      project_id: 10\n      suite_id: 110\n    ```\n    Here, `skip_testrun_ids: value` is optional.\n\n7. Disable `testrail-rspec` execution: set `allow: yes` \n    ```yaml\n    testrail:\n      url: https://your_url.testrail.io/\n      user: your@email.com\n      password: ******\n      run_id: 111\n      allow: no\n    ```\n    Here, `allow: yes` is optional. \n\n8. Use Environment variables to pass testrail config values \n    ```yaml\n    testrail:\n      url: ENV['URL']\n      user: ENV['TESTRAIL_USER']\n      password: ENV['TESTRAIL_PASSWORD']\n      run_id: ENV['RUN_ID']\n      clean_testrun: false\n      project_id: 10\n      suite_id: 110\n    ```\n    Example, `rake ./demo_spec.rb TESTRAIL_USER=your@email.com TESTRAIL_PASSWORD=****** RUN_ID=564 URL=https://your_url.testrail.io/` \n\n#### Hooks\n\nUpdate the results through `Hooks` on end of each test\n```\nconfig.after(:each) do |scenario|\n    TestrailRSpec::UpdateTestRails.new(scenario).upload_result\nend\n```\n\n**Is there any demo available for this gem?**\n\nYes, you can use this `capybara` demo as an example, https://github.com/prashanth-sams/testrail-rspec\n\n```\nbundle install\nrake test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprashanth-sams%2Ftestrail-rspec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprashanth-sams%2Ftestrail-rspec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprashanth-sams%2Ftestrail-rspec/lists"}