Class: Ace::TestRunner::Formatters::BaseFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/test_runner/formatters/base_formatter.rb

Overview

Base class for all formatters

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BaseFormatter

Returns a new instance of BaseFormatter.



11
12
13
14
15
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 11

def initialize(options = {})
  @options = options
  @use_color = options.fetch(:color, true) && $stdout.tty?
  @report_path = nil
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 8

def options
  @options
end

#report_pathObject

Returns the value of attribute report_path.



9
10
11
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 9

def report_path
  @report_path
end

Instance Method Details

#format_report(report) ⇒ Object

Format the complete report for saving

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 23

def format_report(report)
  raise NotImplementedError, "Subclasses must implement format_report"
end

#format_stdout(result) ⇒ Object

Format the test result for stdout output

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 18

def format_stdout(result)
  raise NotImplementedError, "Subclasses must implement format_stdout"
end

#on_finish(result) ⇒ Object

Called when all tests complete



38
39
40
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 38

def on_finish(result)
  # Override in subclasses if needed
end

#on_start(total_files) ⇒ Object

Called when test execution starts



28
29
30
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 28

def on_start(total_files)
  # Override in subclasses if needed
end

#on_test_complete(file, success, duration) ⇒ Object

Called when a single test file completes



33
34
35
# File 'lib/ace/test_runner/formatters/base_formatter.rb', line 33

def on_test_complete(file, success, duration)
  # Override in subclasses if needed
end