Class: RkCucumber::TestDataGenerator
- Inherits:
-
Object
- Object
- RkCucumber::TestDataGenerator
- Defined in:
- lib/results_keeper/test_data_generator.rb
Constant Summary collapse
- SCENARIO_HOOKS =
'Before hook After hook Around hook'
Instance Method Summary collapse
- #revision_completed_data ⇒ Object
- #revision_data ⇒ Object
- #save_screenshot(scenario) ⇒ Object
- #test_data(scenario, revision, test_started_at) ⇒ Object
Instance Method Details
#revision_completed_data ⇒ Object
13 14 15 |
# File 'lib/results_keeper/test_data_generator.rb', line 13 def revision_completed_data { revision: RkCucumber::Config.config[:revision_name], project: RkCucumber::Config.config[:project_name], completed: 1 } end |
#revision_data ⇒ Object
9 10 11 |
# File 'lib/results_keeper/test_data_generator.rb', line 9 def revision_data { revision: RkCucumber::Config.config[:revision_name], project: RkCucumber::Config.config[:project_name] } end |
#save_screenshot(scenario) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/results_keeper/test_data_generator.rb', line 35 def save_screenshot(scenario) if scenario.exception begin screenshot_name = "#{Time.now.to_i}_#{rand(1000..9999)}.png" @file_path = "tmp/screenshots/#{screenshot_name}" Capybara.page.save_screenshot(@file_path) @file_path rescue RkCucumber::Messages.take_screenshot_error nil end end end |
#test_data(scenario, revision, test_started_at) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/results_keeper/test_data_generator.rb', line 17 def test_data(scenario, revision, test_started_at) revision ||= { revision_id: nil } test_duration = Time.now - test_started_at scenario_error = scenario.exception. if scenario.exception run_path = "cucumber #{scenario.location.file}:#{scenario.location.line}" { name: scenario.name, status: scenario.status, feature_name: scenario.feature.name, run_path: run_path, tags: scenario..map(&:name).join(', '), error: scenario_error, revision_id: revision['revision_id'], steps: scenario_steps(scenario), duration: test_duration } end |