lib/gurke/reporters/team_city_reporter.rb in gurke-3.3.1 vs lib/gurke/reporters/team_city_reporter.rb in gurke-3.3.2
- old
+ new
@@ -11,25 +11,31 @@
super
end
def before_scenario(scenario)
- @status_reported = false
- @retry = false
-
publish :testStarted, name: scenario.name
super
end
- def retry_scenario(scenario)
- @retry = true
-
- super
- end
-
def after_scenario(scenario)
+ if scenario.failed?
+ publish :testFailed,
+ name: scenario.name,
+ message: scenario.exception.inspect,
+ backtrace: scenario.exception.backtrace.join('\n')
+ elsif scenario.pending?
+ publish :testIgnored,
+ name: scenario.name,
+ message: 'Step definition missing'
+ else
+ publish :testIgnored,
+ name: scenario.name,
+ message: 'Aborted.'
+ end
+
publish :testFinished, name: scenario.name
super
end
@@ -37,48 +43,10 @@
publish :testSuiteFinished, name: feature.name
super
end
- protected
-
- def step_pending(step, *)
- super
-
- report :testIgnored,
- name: step.scenario.name,
- message: 'Step definition missing'
- end
-
- def step_failed(step, *args)
- super(step, *args, exception: false)
-
- unless step.scenario.retryable? && !retry?
- # do not report test as failed if it will be retries
- report :testFailed,
- name: step.scenario.name,
- message: step.exception.inspect,
- backtrace: step.exception.backtrace.join('\n')
- end
-
- print_exception(step.exception)
- end
-
private
-
- def status_reported?
- @status_reported
- end
-
- def retry?
- @retry
- end
-
- def report(*args)
- return if status_reported?
-
- publish(*args)
- end
def publish(message_name, args)
args = [] << message_name.to_s << escaped_array_of(args)
args = args.flatten.reject(&:nil?)