Module: AllureCucumber::AstTransformer

Included in:
AllureCucumberModel
Defined in:
allure-cucumber/lib/allure_cucumber/ast_transformer.rb

Overview

Cucumber::Core::Ast is removed in cucumber-core 4.0 version. This will have to be updated accordingly, once stable version rolls out

Instance Method Summary collapse

Instance Method Details

#example_row(test_case) ⇒ Cucumber::Core::Ast::ExamplesTable::Row

Get scenario outline example row

Parameters:

  • test_case (Cucumber::Core::Test::Case)

Returns:

  • (Cucumber::Core::Ast::ExamplesTable::Row)

26
27
28
# File 'allure-cucumber/lib/allure_cucumber/ast_transformer.rb', line 26

def example_row(test_case)
  test_case.source.detect { |it| it.is_a?(Cucumber::Core::Ast::ExamplesTable::Row) }
end

#multiline_arg(test_step) ⇒ Cucumber::Core::Ast::DataTable, String

Get step multiline argument

Parameters:

  • test_step (Cucumber::Core::Test::Step)

Returns:

  • (Cucumber::Core::Ast::DataTable, String)

33
34
35
36
37
38
# File 'allure-cucumber/lib/allure_cucumber/ast_transformer.rb', line 33

def multiline_arg(test_step)
  multiline_arg = step(test_step).multiline_arg
  return if multiline_arg.is_a?(Cucumber::Core::Ast::EmptyMultilineArgument)

  multiline_arg
end

#scenario(test_case) ⇒ Cucumber::Core::Ast::Scenario, Cucumber::Core::Ast::ScenarioOutline

Get scenario object

Parameters:

  • test_case (Cucumber::Core::Test::Case)

Returns:

  • (Cucumber::Core::Ast::Scenario, Cucumber::Core::Ast::ScenarioOutline)

10
11
12
13
14
# File 'allure-cucumber/lib/allure_cucumber/ast_transformer.rb', line 10

def scenario(test_case)
  test_case.source.detect do |it|
    it.is_a?(Cucumber::Core::Ast::Scenario) || it.is_a?(Cucumber::Core::Ast::ScenarioOutline)
  end
end

#step(test_step) ⇒ Cucumber::Core::Ast::Step

Get step object

Parameters:

  • test_step (Cucumber::Core::Test::Step)

Returns:

  • (Cucumber::Core::Ast::Step)

19
20
21
# File 'allure-cucumber/lib/allure_cucumber/ast_transformer.rb', line 19

def step(test_step)
  test_step.source.detect { |it| it.is_a?(Cucumber::Core::Ast::Step) }
end