Report test selection on progress report

This commit is contained in:
Markus Schirp 2014-05-27 14:42:15 +00:00
parent e9faba8043
commit ec85651901
10 changed files with 43 additions and 35 deletions

View file

@ -1,3 +1,3 @@
--- ---
threshold: 18 threshold: 18
total_score: 794 total_score: 798

View file

@ -6,6 +6,8 @@ module Mutant
# Abstract base class for process printers # Abstract base class for process printers
class Progress < Printer class Progress < Printer
include AbstractType, Registry.new include AbstractType, Registry.new
delegate :running?
end # Progress end # Progress
end # CLI end # CLI
end # Reporter end # Reporter

View file

@ -5,9 +5,9 @@ module Mutant
# Progress printer for configuration # Progress printer for configuration
class Config < self class Config < self
handle(Mutant::Config) handle(Mutant::Runner::Config)
delegate :matcher, :strategy, :expected_coverage delegate :config
# Report configuration # Report configuration
# #
@ -18,10 +18,12 @@ module Mutant
# @api private # @api private
# #
def run def run
if running?
info 'Mutant configuration:' info 'Mutant configuration:'
info 'Matcher: %s', matcher.inspect info 'Matcher: %s', config.matcher.inspect
info 'Strategy: %s', strategy.inspect info 'Strategy: %s', config.strategy.inspect
info 'Expect Coverage: %02f%%', expected_coverage.inspect info 'Expect Coverage: %02f%%', config.expected_coverage.inspect
end
self self
end end

View file

@ -13,13 +13,16 @@ module Mutant
# Run printer # Run printer
# #
# @return [undefined] # @return [self]
# #
# @api private # @api private
# #
def run def run
unless running?
char(success? ? SUCCESS : FAILURE) char(success? ? SUCCESS : FAILURE)
end end
self
end
private private

View file

@ -5,7 +5,7 @@ module Mutant
# Noop CLI progress reporter # Noop CLI progress reporter
class Noop < self class Noop < self
handle(Mutant::Mutation) handle(Mutant::Runner::Killer)
# Noop progress report # Noop progress report
# #

View file

@ -2,30 +2,15 @@ module Mutant
class Reporter class Reporter
class CLI class CLI
class Progress class Progress
# Subject results printer
class Subject < self
handle(Mutant::Subject)
# Run subject results printer
#
# @return [undefined]
#
# @api private
#
def run
puts(object.identification)
end
end # Subject
# Reporter for subject runners # Reporter for subject runners
class SubjectRunner < self class Subject < self
FORMAT = '(%02d/%02d) %3d%% - %0.02fs'.freeze FORMAT = '(%02d/%02d) %3d%% - %0.02fs'.freeze
handle(Mutant::Runner::Subject) handle(Mutant::Runner::Subject)
delegate :running?, :tests, :subject
# Run printer # Run printer
# #
# @return [undefined] # @return [undefined]
@ -33,8 +18,15 @@ module Mutant
# @api private # @api private
# #
def run def run
if running?
puts(subject.identification)
tests.each do |test|
puts "- #{test.identification}"
end
else
print_progress_bar_finish print_progress_bar_finish
print_stats print_stats
end
self self
end end

View file

@ -53,6 +53,16 @@ module Mutant
handler.new(config, object, *arguments) handler.new(config, object, *arguments)
end end
# Test if runner is running
#
# Yeah this is evil. Should be refactored away
#
# @return [Boolean]
#
def running?
@running
end
# Return config # Return config
# #
# @return [Mutant::Config] # @return [Mutant::Config]
@ -73,7 +83,11 @@ module Mutant
@config = config @config = config
@stop = false @stop = false
@start = Time.now @start = Time.now
@running = true
progress(self)
run run
@running = false
progress(self)
@end = Time.now @end = Time.now
end end

View file

@ -134,7 +134,6 @@ module Mutant
# @api private # @api private
# #
def run def run
progress(config)
run_subjects run_subjects
@end = Time.now @end = Time.now
reporter.report(self) reporter.report(self)

View file

@ -63,14 +63,12 @@ module Mutant
# @api private # @api private
# #
def run def run
progress(mutation)
@killers = @tests.map do |test| @killers = @tests.map do |test|
Mutant::Killer.new( Mutant::Killer.new(
mutation: mutation, mutation: mutation,
test: test test: test
) )
end.map(&method(:visit)) end.map(&method(:visit))
progress(self)
end end
end # Mutation end # Mutation

View file

@ -83,9 +83,7 @@ module Mutant
# @api private # @api private
# #
def run def run
progress(subject)
@mutations = visit_collection(subject.mutations, tests) @mutations = visit_collection(subject.mutations, tests)
progress(self)
end end
end # Subject end # Subject