class RkCucumber::TestDataGenerator
Constants
- SCENARIO_HOOKS
Public Instance Methods
revision_completed_data()
click to toggle source
# 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()
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# 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.message 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.tags.map(&:name).join(', '), error: scenario_error, revision_id: revision['revision_id'], steps: scenario_steps(scenario), duration: test_duration } end
Private Instance Methods
scenario_steps(scenario)
click to toggle source
# File lib/results_keeper/test_data_generator.rb, line 55 def scenario_steps(scenario) steps = [] scenario.test_steps.each do |test_step| if test_step.to_s.include? 'Cucumber::Core::Test' steps << "#{step_keyword(test_step)} #{test_step.name.to_s}" unless SCENARIO_HOOKS.include?(test_step.name.to_s) else steps << "#{step_keyword(test_step)} #{test_step.to_s}" unless SCENARIO_HOOKS.include?(test_step.to_s) end end steps end
step_keyword(test_step)
click to toggle source
# File lib/results_keeper/test_data_generator.rb, line 51 def step_keyword(test_step) test_step.source.last.keyword end