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.
Defined Under Namespace
Modules: Scenario
Class Method Summary collapse
-
.after(_) ⇒ Object
Hook to be executed after a scenario.
- .after_step ⇒ Object
- .at_exit ⇒ Object
-
.before(scenario) ⇒ Object
Hook to be executed before a scenario.
Class Method Details
.after(_) ⇒ Object
Hook to be executed after a scenario. It executes the following actions:
-
delete the temporary folder
-
reset the cache
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_step ⇒ Object
33 34 35 36 37 |
# File 'lib/qat/cucumber/hooks.rb', line 33 def after_step #TODO rescue => error log.warn { error } end |
.at_exit ⇒ Object
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)
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) 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 |