Module: Itriagetestrail::TestRuns

Included in:
TestRailInterface
Defined in:
lib/itriagetestrail/testrail_objects/test_runs.rb

Instance Method Summary collapse

Instance Method Details

#add_testrail_runObject

open a test run to submit test results



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/itriagetestrail/testrail_objects/test_runs.rb', line 32

def add_testrail_run
  body = {
    name: test_name,
    description: '',
    include_all: true,
    milestone_id: @milestone_id
  }

  unless @testrail_config[:include_all] == 'true'
    body[:include_all] = false
    body[:case_ids] = @test_case_ids
  end

  case @suite_mode
  when 2, 3
    body[:suite_id] = @suite_id
  end
  res = @client.send_post("add_run/#{@project_id}", body)
  @run_id = res['id']
end

#existing_cases_from_descriptionObject



11
12
13
14
15
16
# File 'lib/itriagetestrail/testrail_objects/test_runs.rb', line 11

def existing_cases_from_description
  # Grabs from testrail run description
  run = @client.send_get("get_run/#{@run_id}")
  @description = run['description']
  @description.nil? ? [] : @description.split(',')
end

#existing_cases_from_run(run_id = @run_id) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/itriagetestrail/testrail_objects/test_runs.rb', line 18

def existing_cases_from_run(run_id = @run_id)
  allowed_statuses = %i[1 2 4 5]
  allowed_statuses << 6 if @testrail_config[:report_skips] == 'true'
  tests = @client.send_get("get_tests/#{run_id}&status_id=#{allowed_statuses.compact.join(',')}") || []

  cases = []

  tests.each do |test|
    cases << test['case_id']
  end
  cases
end

#extend_testrail_runObject



5
6
7
8
9
# File 'lib/itriagetestrail/testrail_objects/test_runs.rb', line 5

def extend_testrail_run
  # Reset test scope to include all cases
  body = { include_all: true }
  @client.send_post("update_run/#{@run_id}", body)
end