Class: TestRail::RSpecAdaptor

Inherits:
Adaptor
  • Object
show all
Defined in:
lib/testrail/rspec_adaptor.rb

Instance Method Summary collapse

Methods inherited from Adaptor

#end_test_run, #initialize, #start_test_run

Constructor Details

This class inherits a constructor from TestRail::Adaptor

Instance Method Details

#submit(example) ⇒ Object

Submits an example test results If the test case exists, it will reuse the id, otherwise it will create a new Test Case in TestRails

Parameters:

  • example (RSpec::Core::Example)

    A test case example after execution



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/testrail/rspec_adaptor.rb', line 23

def submit(example)
  return unless @enabled
  test_case_section = example.example_group.description.strip
  test_case_name = example.description.strip
  test_result = example.exception.nil?
  test_comment = example.exception

  submit_test_result(
    section_name: test_case_section,
    test_name: test_case_name,
    success: test_result,
    comment: test_comment
  )
end