Skip to content

Commit

Permalink
Merge pull request #19 from prashanth-sams/fix
Browse files Browse the repository at this point in the history
Disable testrail and skip specific tesrun id deletion
  • Loading branch information
prashanth-sams authored Mar 25, 2020
2 parents dd8e48e + f9f2f20 commit c298967
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
- [x] Create dynamic test run and update test results in it
- [x] Update multi-testrail cases from a single automation scenario
- [x] Delete/clean all the existing test runs in a project's suite before test run
- [x] Skip specific test-runs from deletion, when `clean_testrun` is set `true`
- [x] Static status comments on all the scenarios
- [x] Support for RSpec `shared examples`
- [x] Disable `testrail-rspec` execution on-demand

## Installation

Expand Down Expand Up @@ -150,6 +152,30 @@ end
```
Set, `clean_testrun: false` if you don't want to clean the existing test runs; but this keyword is optional.

6. To skip specific test-runs from deletion, when `clean_testrun` is set `true`
```yaml
testrail:
url: https://your_url.testrail.io/
user: [email protected]
password: ******
clean_testrun: true
skip_testrun_ids: 473, 475
project_id: 10
suite_id: 110
```
Here, `skip_testrun_ids: value` is optional.

7. To disable `testrail-rspec` execution
```yaml
testrail:
url: https://your_url.testrail.io/
user: [email protected]
password: ******
run_id: 111
allow: no
```
Here, `skip_testrun_ids: value` is optional.

#### Hooks

Update the results through `Hooks` on end of each test
Expand Down
4 changes: 3 additions & 1 deletion lib/testrail-rspec/update-testrails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ def initialize(scenario)
raise 'TestRail configuration file is required'
end

return if [@config['allow'].nil?, @config['allow']].all? false
setup_testrail_client
config_validator if $config_validator.nil?
end

def upload_result

return if [@config['allow'].nil?, @config['allow']].all? false
response = {}

case_list = []
Expand Down Expand Up @@ -105,6 +106,7 @@ def get_status_id(status)
def cleaner
test_run_list = client.send_get("get_runs/#{@config['project_id']}")
test_run_list.map do |list|
next if !@config['skip_testrun_ids'].nil? && @config['skip_testrun_ids'].to_s.delete(' ').split(',').any?(list['id'].to_s)
client.send_post("delete_run/#{list['id']}", {"suite_id": @config['suite_id']})
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/testrail-rspec/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module TestrailRspec
VERSION = '0.1.7'.freeze
VERSION = '0.1.8'.freeze
end
6 changes: 4 additions & 2 deletions testrail_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ testrail:
user: your_username
password: your_password
run_id: <run_id>
clean_testrun: false
clean_testrun: true
skip_testrun_ids: <run_id1>, <run_id2>
project_id: <project_id>
suite_id: <suite_id>
suite_id: <suite_id>
allow: yes

0 comments on commit c298967

Please sign in to comment.