Class: TestRail::CucumberAdaptor
- Defined in:
- lib/testrail/cucumber_adaptor.rb
Instance Method Summary collapse
- #resolve_from_scenario_outline(scenario) ⇒ Object
- #resolve_from_simple_scenario(scenario) ⇒ Object
-
#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.
Methods inherited from Adaptor
#end_test_run, #initialize, #start_test_run
Constructor Details
This class inherits a constructor from TestRail::Adaptor
Instance Method Details
#resolve_from_scenario_outline(scenario) ⇒ Object
38 39 40 41 42 43 44 45 |
# 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) ⇒ Object
47 48 49 50 51 52 53 54 |
# 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) ⇒ 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
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# 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 |