Skip to content

Commit f9f2f20

Browse files
disable testrail and skip specific tesrun id deletion
1 parent 2cf1925 commit f9f2f20

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
- [x] Create dynamic test run and update test results in it
88
- [x] Update multi-testrail cases from a single automation scenario
99
- [x] Delete/clean all the existing test runs in a project's suite before test run
10+
- [x] Skip specific test-runs from deletion, when `clean_testrun` is set `true`
1011
- [x] Static status comments on all the scenarios
1112
- [x] Support for RSpec `shared examples`
13+
- [x] Disable `testrail-rspec` execution on-demand
1214

1315
## Installation
1416

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

155+
6. To skip specific test-runs from deletion, when `clean_testrun` is set `true`
156+
```yaml
157+
testrail:
158+
url: https://your_url.testrail.io/
159+
user: your@email.com
160+
password: ******
161+
clean_testrun: true
162+
skip_testrun_ids: 473, 475
163+
project_id: 10
164+
suite_id: 110
165+
```
166+
Here, `skip_testrun_ids: value` is optional.
167+
168+
7. To disable `testrail-rspec` execution
169+
```yaml
170+
testrail:
171+
url: https://your_url.testrail.io/
172+
user: your@email.com
173+
password: ******
174+
run_id: 111
175+
allow: no
176+
```
177+
Here, `skip_testrun_ids: value` is optional.
178+
153179
#### Hooks
154180

155181
Update the results through `Hooks` on end of each test

lib/testrail-rspec/update-testrails.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ def initialize(scenario)
1414
raise 'TestRail configuration file is required'
1515
end
1616

17+
return if [@config['allow'].nil?, @config['allow']].all? false
1718
setup_testrail_client
1819
config_validator if $config_validator.nil?
1920
end
2021

2122
def upload_result
22-
23+
return if [@config['allow'].nil?, @config['allow']].all? false
2324
response = {}
2425

2526
case_list = []
@@ -105,6 +106,7 @@ def get_status_id(status)
105106
def cleaner
106107
test_run_list = client.send_get("get_runs/#{@config['project_id']}")
107108
test_run_list.map do |list|
109+
next if !@config['skip_testrun_ids'].nil? && @config['skip_testrun_ids'].to_s.delete(' ').split(',').any?(list['id'].to_s)
108110
client.send_post("delete_run/#{list['id']}", {"suite_id": @config['suite_id']})
109111
end
110112
end

lib/testrail-rspec/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module TestrailRspec
2-
VERSION = '0.1.7'.freeze
2+
VERSION = '0.1.8'.freeze
33
end

testrail_config.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ testrail:
33
user: your_username
44
password: your_password
55
run_id: <run_id>
6-
clean_testrun: false
6+
clean_testrun: true
7+
skip_testrun_ids: <run_id1>, <run_id2>
78
project_id: <project_id>
8-
suite_id: <suite_id>
9+
suite_id: <suite_id>
10+
allow: yes

0 commit comments

Comments
 (0)