Class: Xcode::Test::Formatters::StdoutFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/xcode/test/formatters/stdout_formatter.rb

Instance Method Summary collapse

Constructor Details

#initializeStdoutFormatter

Returns a new instance of StdoutFormatter.



6
7
8
# File 'lib/xcode/test/formatters/stdout_formatter.rb', line 6

def initialize
  @errors = []
end

Instance Method Details

#after(report) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/xcode/test/formatters/stdout_formatter.rb', line 14

def after(report)
  puts "\n\nThe following failures occured:" if @errors.count>0
  @errors.each do |e|
    puts "[#{e.suite.name} #{e.name}]"
    e.errors.each do |error|
      puts "  #{error[:message]}"
      puts "    at #{error[:location]}"
      if error[:data].count>0
        puts "\n   Test Output:"
        puts "   > #{error[:data].join("   > ")}\n\n"
      end
    end       
    
    # if there is left over data in the test report, show that
    if e.data.count>0
      puts "\n  There was this trailing output after the above failures"
      puts "   > #{e.data.join("   > ")}\n\n"
    end
  end
  
  puts "\n\nEnd tests (#{report.failed? ? 'FAILED' : 'PASSED'}).  Took #{report.duration}s"
end

#after_suite(suite) ⇒ Object



41
42
43
# File 'lib/xcode/test/formatters/stdout_formatter.rb', line 41

def after_suite(suite)
  puts " [#{suite.total_passed_tests}/#{suite.tests.count}]"
end

#after_test(test) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/xcode/test/formatters/stdout_formatter.rb', line 49

def after_test(test)
    if test.passed?
      print "." 
    elsif test.failed?
      print "F"
      @errors << test 
    end 
    # puts "[#{test.suite.name} #{test.name}] << END"
end

#before(report) ⇒ Object



10
11
12
# File 'lib/xcode/test/formatters/stdout_formatter.rb', line 10

def before(report)
  puts "Begin tests"
end

#before_suite(suite) ⇒ Object



37
38
39
# File 'lib/xcode/test/formatters/stdout_formatter.rb', line 37

def before_suite(suite)
  print "#{suite.name}: "
end

#before_test(test) ⇒ Object



45
46
47
# File 'lib/xcode/test/formatters/stdout_formatter.rb', line 45

def before_test(test)
  # puts "[#{test.suite.name} #{test.name}] << BEGIN"
end