Module: QAT::Cucumber::Hooks

Includes:
Logger
Defined in:
lib/qat/cucumber/hooks.rb,
lib/qat/cucumber/hooks/scenario.rb

Overview

Methods to execute with Cucumber Hooks and at_exit.

Since:

  • 0.1.0

Defined Under Namespace

Modules: Scenario

Class Method Summary collapse

Class Method Details

.after(_) ⇒ Object

Hook to be executed after a scenario. It executes the following actions:

  • delete the temporary folder

  • reset the cache

Since:

  • 0.1.0



42
43
44
45
46
# File 'lib/qat/cucumber/hooks.rb', line 42

def after(_)
  FileUtils.rm_r QAT[:tmp_folder]
rescue => error
  log.warn { error }
end

.after_stepObject

Since:

  • 0.1.0



33
34
35
36
37
# File 'lib/qat/cucumber/hooks.rb', line 33

def after_step
  #TODO
rescue => error
  log.warn { error }
end

.at_exitObject

Since:

  • 0.1.0



48
49
50
51
52
# File 'lib/qat/cucumber/hooks.rb', line 48

def at_exit
  #TODO
rescue => error
  log.warn { error }
end

.before(scenario) ⇒ Object

Hook to be executed before a scenario. It executes the following actions:

  • save scenario tags (Saved in QAT::Core with the :scenario_tags key)

  • save current test start timestamp (Saved in QAT::Core with the :test_start_timestamp key)

  • create a temporary folder (Saved in QAT::Core with the :tmp_folder key)

Since:

  • 0.1.0



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/qat/cucumber/hooks.rb', line 21

def before(scenario)
  QAT.reset!

  QAT.store :scenario_tags, Scenario.scenario_tags(scenario)
  QAT.store :test_start_timestamp, QAT::Time.now
  QAT.store :tmp_folder, Dir.mktmpdir

  Scenario.define_test_id(scenario)
rescue => error
  log.warn { error }
end