Permalink
Browse files

Updated testjour to work with latest Cucumber

  • Loading branch information...
1 parent 210746c commit f0902bff629742fdcf72b3f88af0e56d47beecfd Lee Bankewitz committed Sep 14, 2009
@@ -23,7 +23,7 @@ def load_plain_text_features(files)
Array(files).each do |f|
feature_file = Cucumber::FeatureFile.new(f)
- feature = feature_file.parse(configuration.cucumber_configuration.options)
+ feature = feature_file.parse(step_mother, configuration.cucumber_configuration.options)
if feature
features.add_feature(feature)
end
@@ -37,7 +37,7 @@ def parser
end
def step_mother
- Cucumber::Cli::Main.instance_variable_get("@step_mother")
+ Cucumber::Cli::Main.step_mother
end
def testjour_path
@@ -8,17 +8,16 @@
module Testjour
module Commands
-
+
class RunSlave < Command
-
+
def execute
configuration.parse!
configuration.parse_uri!
-
+
Dir.chdir(configuration.path) do
Testjour.setup_logger(configuration.path)
Testjour.logger.info "Starting run:slave"
-
begin
configuration.setup
configuration.setup_mysql
@@ -34,14 +33,14 @@ def execute
def work
HttpQueue.with_queue(configuration.queue_uri) do |queue|
feature_file = true
-
+
while feature_file
begin
feature_file = queue.pop(:feature_files)
rescue Curl::Err::ConnectionFailedError
feature_file = false
end
-
+
if feature_file
Testjour.logger.info "Running: #{feature_file}"
features = load_plain_text_features(feature_file)
@@ -54,22 +53,21 @@ def work
end
end
end
-
+
def execute_features(features)
visitor = Testjour::HttpFormatter.new(step_mother, StringIO.new, configuration.queue_uri)
visitor.options = configuration.cucumber_configuration.options
Testjour.logger.info "Visiting..."
visitor.visit_features(features)
end
-
+
def require_files
- configuration.files_to_require.each do |lib|
- Testjour.logger.info "Requiring: #{lib}"
- require lib
- end
+ step_mother.load_code_files(configuration.cucumber_configuration.support_to_load)
+ step_mother.after_configuration(configuration.cucumber_configuration)
+ step_mother.load_code_files(configuration.cucumber_configuration.step_defs_to_load)
end
-
+
end
-
+
end
end
@@ -51,12 +51,8 @@ def setup_mysql
mysql.load_schema
end
- def files_to_require
- cucumber_configuration.files_to_require
- end
-
def step_mother
- Cucumber::Cli::Main.instance_variable_get("@step_mother")
+ Cucumber::Cli::Main.step_mother
end
def mysql_mode?
@@ -76,7 +72,7 @@ def load_plain_text_features(files)
Array(files).each do |f|
feature_file = Cucumber::FeatureFile.new(f)
- feature = feature_file.parse(cucumber_configuration.options)
+ feature = feature_file.parse(step_mother, cucumber_configuration.options)
if feature
features.add_feature(feature)
end
@@ -27,7 +27,7 @@ def visit_step(step)
end
end
- def visit_table_cell_value(value, width, status)
+ def visit_table_cell_value(value, status)
if (status != :skipped_param) && !@multiline_arg
progress(0.0, nil, status)
end
@@ -1,31 +1,31 @@
require 'cucumber/ast/visitor'
module Testjour
-
+
class StepCounter < Cucumber::Ast::Visitor
attr_reader :backtrace_lines
-
+
def initialize(step_mother)
super
@backtrace_lines = []
end
-
+
def visit_step(step_invocation)
if step_invocation.respond_to?(:status) #&& step_invocation.status != :outline
@backtrace_lines << step_invocation.backtrace_line
end
end
-
- def visit_table_cell_value(value, width, status)
+
+ def visit_table_cell_value(value, status)
# Testjour.logger.info "#{value.inspect}, #{status.inspect}"
super
@backtrace_lines << "Table cell value: #{value}" unless status == :skipped_param
end
-
+
def count
@backtrace_lines.size
end
-
+
end
end

0 comments on commit f0902bf

Please sign in to comment.