class TestRail::CucumberAdaptor

Public Instance Methods

resolve_from_scenario_outline(scenario) click to toggle source
# File lib/testrail/cucumber_adaptor.rb, line 38
def resolve_from_scenario_outline(scenario)
  {
    section_name: scenario.scenario_outline.feature.name.strip,
    test_name: "#{scenario.scenario_outline.name.strip} #{scenario.name.strip}",
    success: !scenario.failed?,
    comment: scenario.exception
  }
end
resolve_from_simple_scenario(scenario) click to toggle source
# File lib/testrail/cucumber_adaptor.rb, line 47
def resolve_from_simple_scenario(scenario)
  {
    section_name: scenario.feature.name.strip,
    test_name: scenario.name.strip,
    success: !scenario.failed?,
    comment: scenario.exception
  }
end
submit(scenario) click to toggle source

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 @param scenario [Cucumber Scenario|Cucumber Scenario Outline] A test case scenario after execution

# File lib/testrail/cucumber_adaptor.rb, line 23
def submit(scenario)
  return unless @enabled
  case scenario.class.name
  when 'Cucumber::RunningTestCase::ScenarioOutlineExample'
    test_results = resolve_from_scenario_outline(scenario)
  when 'Cucumber::Ast::OutlineTable::ExampleRow'
    test_results = resolve_from_scenario_outline(scenario)
  when 'Cucumber::RunningTestCase::Scenario'
    test_results = resolve_from_simple_scenario(scenario)
  when 'Cucumber::Ast::Scenario'
    test_results = resolve_from_simple_scenario(scenario)
  end
  submit_test_result(test_results)
end