Class: Multicuke::Runner
- Inherits:
-
Object
- Object
- Multicuke::Runner
- Defined in:
- lib/multicuke/runner.rb
Overview
Actual clas that will spawn one command process per directory of features collected according to configuration
Instance Attribute Summary collapse
-
#dry_run ⇒ Object
Optional.
-
#excluded_dirs ⇒ Object
Optional regexp for name of features directories to exclude.
-
#extra_options ⇒ Object
Array of extra options to pass to the command.
-
#features_root_path ⇒ Object
Root path to your features directory.
-
#forks_pool_size ⇒ Object
Define the size for the pool of forks.
-
#included_only_dirs ⇒ Object
Optional only the features directories to be included.
-
#output_dir_name ⇒ Object
Optional name for directory containing the reports.
-
#output_path ⇒ Object
Optional full path for generated reports.
-
#reports_path ⇒ Object
readonly
Full final path where html reports will be generated.
-
#require_features_root_option ⇒ Object
Add cucumber –require option load *.rb files under features root path by default unless specified to false.
-
#system_command ⇒ Object
Delegate to a wrapper of system call in order mock/test.
Instance Method Summary collapse
-
#initialize(features_root) {|_self| ... } ⇒ Runner
constructor
A new instance of Runner.
- #start ⇒ Object
Constructor Details
#initialize(features_root) {|_self| ... } ⇒ Runner
Returns a new instance of Runner.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/multicuke/runner.rb', line 92 def initialize(features_root) @features_root_path = features_root yield self if block_given? @dry_run = false if dry_run.nil? @forks_pool_size ||= 5 @require_features_root_option = true if require_features_root_option.nil? @output_dir_name = "cucumber_reports" unless output_dir_name @output_path = File.("..", features_root_path) unless output_path @excluded_dirs ||= [] @included_only_dirs ||= [] @extra_options ||= [] @reports_path = File.join(output_path, output_dir_name) @system_command ||= SystemCommand.new end |
Instance Attribute Details
#dry_run ⇒ Object
Optional. If true will generate index file but not launch processes. Used for testing.
84 85 86 |
# File 'lib/multicuke/runner.rb', line 84 def dry_run @dry_run end |
#excluded_dirs ⇒ Object
Optional regexp for name of features directories to exclude.
69 70 71 |
# File 'lib/multicuke/runner.rb', line 69 def excluded_dirs @excluded_dirs end |
#extra_options ⇒ Object
Array of extra options to pass to the command. Ex: [“-p”, “my_profile”, “–backtrace”]
75 76 77 |
# File 'lib/multicuke/runner.rb', line 75 def @extra_options end |
#features_root_path ⇒ Object
Root path to your features directory. Ex: your_project/features
60 61 62 |
# File 'lib/multicuke/runner.rb', line 60 def features_root_path @features_root_path end |
#forks_pool_size ⇒ Object
Define the size for the pool of forks. Default is 5
78 79 80 |
# File 'lib/multicuke/runner.rb', line 78 def forks_pool_size @forks_pool_size end |
#included_only_dirs ⇒ Object
Optional only the features directories to be included
72 73 74 |
# File 'lib/multicuke/runner.rb', line 72 def included_only_dirs @included_only_dirs end |
#output_dir_name ⇒ Object
Optional name for directory containing the reports. Default to ‘cucumber_reports’
63 64 65 |
# File 'lib/multicuke/runner.rb', line 63 def output_dir_name @output_dir_name end |
#output_path ⇒ Object
Optional full path for generated reports. Default to ../#features_root_path.
66 67 68 |
# File 'lib/multicuke/runner.rb', line 66 def output_path @output_path end |
#reports_path ⇒ Object (readonly)
Full final path where html reports will be generated
81 82 83 |
# File 'lib/multicuke/runner.rb', line 81 def reports_path @reports_path end |
#require_features_root_option ⇒ Object
Add cucumber –require option load *.rb files under features root path by default unless specified to false.
87 88 89 |
# File 'lib/multicuke/runner.rb', line 87 def require_features_root_option @require_features_root_option end |
#system_command ⇒ Object
Delegate to a wrapper of system call in order mock/test
90 91 92 |
# File 'lib/multicuke/runner.rb', line 90 def system_command @system_command end |
Instance Method Details
#start ⇒ Object
109 110 111 112 113 114 115 116 |
# File 'lib/multicuke/runner.rb', line 109 def start FileUtils.mkdir_p reports_path exit_status = launch_process_per_dir collect_results reports = ReportsIndex.new(reports_path, features_dirs).generate puts "See reports index at #{reports.index_path}" if reports system_command.exit(exit_status) end |