Class: Verity::Reporters::TestReporter

Inherits:
Object
  • Object
show all
Includes:
Verity::Reporter
Defined in:
lib/verity/reporters/test_reporter.rb

Overview

Public: In-memory reporter that records every callback for later inspection. Produces no I/O — designed for use in Verity’s own tests and tooling.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTestReporter

Returns a new instance of TestReporter.



11
12
13
14
15
16
# File 'lib/verity/reporters/test_reporter.rb', line 11

def initialize
  @run_starts = []
  @test_completes = []
  @run_finishes = []
  @parallel_finishes = []
end

Instance Attribute Details

#parallel_finishesObject (readonly)

Public: Array of Hashes recorded from on_run_start calls. Each Hash contains :total and :worker_id.

Public: Array of Hashes recorded from on_test_complete calls. Each Hash contains :status, :error (exception or nil), and :worker_id.

Public: Array of Hashes recorded from on_run_finish calls. Each Hash contains :summary and :worker_id.

Public: Array of Hashes recorded from on_parallel_complete calls. Each Hash contains :counts and :problem_rows.



29
30
31
# File 'lib/verity/reporters/test_reporter.rb', line 29

def parallel_finishes
  @parallel_finishes
end

#run_finishesObject (readonly)

Public: Array of Hashes recorded from on_run_start calls. Each Hash contains :total and :worker_id.

Public: Array of Hashes recorded from on_test_complete calls. Each Hash contains :status, :error (exception or nil), and :worker_id.

Public: Array of Hashes recorded from on_run_finish calls. Each Hash contains :summary and :worker_id.

Public: Array of Hashes recorded from on_parallel_complete calls. Each Hash contains :counts and :problem_rows.



29
30
31
# File 'lib/verity/reporters/test_reporter.rb', line 29

def run_finishes
  @run_finishes
end

#run_startsObject (readonly)

Public: Array of Hashes recorded from on_run_start calls. Each Hash contains :total and :worker_id.

Public: Array of Hashes recorded from on_test_complete calls. Each Hash contains :status, :error (exception or nil), and :worker_id.

Public: Array of Hashes recorded from on_run_finish calls. Each Hash contains :summary and :worker_id.

Public: Array of Hashes recorded from on_parallel_complete calls. Each Hash contains :counts and :problem_rows.



29
30
31
# File 'lib/verity/reporters/test_reporter.rb', line 29

def run_starts
  @run_starts
end

#test_completesObject (readonly)

Public: Array of Hashes recorded from on_run_start calls. Each Hash contains :total and :worker_id.

Public: Array of Hashes recorded from on_test_complete calls. Each Hash contains :status, :error (exception or nil), and :worker_id.

Public: Array of Hashes recorded from on_run_finish calls. Each Hash contains :summary and :worker_id.

Public: Array of Hashes recorded from on_parallel_complete calls. Each Hash contains :counts and :problem_rows.



29
30
31
# File 'lib/verity/reporters/test_reporter.rb', line 29

def test_completes
  @test_completes
end

Instance Method Details

#on_parallel_complete(counts:, problem_rows:) ⇒ Object



43
44
45
# File 'lib/verity/reporters/test_reporter.rb', line 43

def on_parallel_complete(counts:, problem_rows:)
  @parallel_finishes << { counts: counts, problem_rows: problem_rows }
end

#on_run_finish(summary:, worker_id:) ⇒ Object



39
40
41
# File 'lib/verity/reporters/test_reporter.rb', line 39

def on_run_finish(summary:, worker_id:)
  @run_finishes << { summary: summary, worker_id: worker_id }
end

#on_run_start(total:, worker_id:) ⇒ Object



31
32
33
# File 'lib/verity/reporters/test_reporter.rb', line 31

def on_run_start(total:, worker_id:)
  @run_starts << { total: total, worker_id: worker_id }
end

#on_test_complete(result:, worker_id:) ⇒ Object



35
36
37
# File 'lib/verity/reporters/test_reporter.rb', line 35

def on_test_complete(result:, worker_id:)
  @test_completes << { status: result.status, error: result.error, worker_id: worker_id }
end