Class: Cucumber::Formatter::CucumberZephyr

Inherits:
Object
  • Object
show all
Includes:
Io
Defined in:
lib/cucumber_zephyr.rb

Overview

This class is the formatter for the Zephyr plugin

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ CucumberZephyr

Returns a new instance of CucumberZephyr.



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cucumber_zephyr.rb', line 19

def initialize(config)
  @io = Cucumber::Formatter::Io.new(config.out_stream, config.default_path, "upload-to-zephyr")
  @project_id = config.options[:project_id]
  @results_format = config.options[:results_format]
  @path_to_file = config.options[:path_to_file]
  @auto_close_cycle = config.options[:auto_close_cycle] ? true : false
  @auto_create_test_cases = config.options[:auto_create_test_cases] ? true : false
  @name = config.options[:name]
  @description = config.options[:description]

  at_exit { upload_results }
end

Instance Method Details

#before_feature(feature) ⇒ Object



32
33
34
# File 'lib/cucumber_zephyr.rb', line 32

def before_feature(feature)
  @current_feature = feature
end

#before_scenario(scenario) ⇒ Object



36
37
38
# File 'lib/cucumber_zephyr.rb', line 36

def before_scenario(scenario)
  @current_scenario = scenario
end

#upload_resultsObject



40
41
42
43
44
45
46
47
48
49
# File 'lib/cucumber_zephyr.rb', line 40

def upload_results
  system("zephyr_cli test_cycles " \
 "--#{@results_format} " \
 "--project_id=#{@project_id} " \
 "--file=#{@path_to_file} " \
 "--auto_close_cycle=#{@auto_close_cycle} " \
 "--auto_create_test_cases=#{@auto_create_test_cases}" \
 "--name=#{@name} " \
 "--description=#{@description}")
end