Module: BareTest::Run::TAP

Defined in:
lib/baretest/run/tap.rb

Overview

TAP runner is invoked with ‘-f tap` or `–format tap`. TAP (Test Anything Protocol) output is intended as a universal, machine readable output format of test frameworks. The are various tools that can further process that information and leverage it in various ways of automation. This runner currently implements the TA Protocol in version 13.

Instance Method Summary collapse

Instance Method Details

#run_allObject

:nodoc:



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/baretest/run/tap.rb', line 19

def run_all
  puts "TAP version 13"
  count = proc { |acc,csuite|
    acc+
    csuite.assertions.size+
    csuite.suites.map { |d,suite| suite }.inject(0, &count)
  }
  puts "1..#{count[0, suite]}"
  @current = 0
  super
end

#run_test(assertion, setup) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/baretest/run/tap.rb', line 31

def run_test(assertion, setup)
  rv = super
  printf "%sok %d - %s%s\n",
    rv.status == :success ? '' : 'not ',
    @current+=1,
    assertion.description,
    rv.status == :success ? '' : " # #{rv.status}"

  rv
end