Class: TestRail::CucumberAdaptor

Inherits:
Adaptor
  • Object
show all
Defined in:
lib/testrail/cucumber_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(scenario) ⇒ Object

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

Parameters:

  • scenario (Cucumber::RunningTestCase::ScenarioOutlineExample|Cucumber::RunningTestCase::Scenario)

    A test case scenario after execution



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/testrail/cucumber_adaptor.rb', line 24

def submit(scenario)
  return unless @enabled
  case scenario.class.name
  when 'Cucumber::RunningTestCase::ScenarioOutlineExample'
    test_case_section = scenario.scenario_outline.feature.name.strip
    test_case_name = scenario.scenario_outline.name.strip
    test_result = !scenario.failed?
    test_comment = scenario.exception
  when 'Cucumber::RunningTestCase::Scenario'
    test_case_section = scenario.feature.name.strip
    test_case_name = scenario.name.strip
    test_result = !scenario.failed?
    test_comment = scenario.exception
  end

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