Class: CapyDash::TestDataCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/capydash/test_data_collector.rb

Class Method Summary collapse

Class Method Details

.finish_test(test_name, status, error_message = nil) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/capydash/test_data_collector.rb', line 33

def finish_test(test_name, status, error_message = nil)
  return unless @test_run_started

  if status == "passed"
    @passed_count += 1
  elsif status == "failed"
    @failed_count += 1
  end

  # Emit test finish event
  event_data = {
    step_name: "test_finish",
    detail: "Test #{status}: #{test_name}",
    test_name: test_name,
    status: status
  }

  if error_message
    event_data[:error] = error_message
  end

  CapyDash::EventEmitter.broadcast(event_data)
end

.finish_test_runObject



13
14
15
16
17
# File 'lib/capydash/test_data_collector.rb', line 13

def finish_test_run
  return unless @test_run_started

  @test_run_started = false
end

.start_test(test_name, test_class, test_method) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/capydash/test_data_collector.rb', line 19

def start_test(test_name, test_class, test_method)
  return unless @test_run_started

  @test_count += 1

  # Emit test start event
  CapyDash::EventEmitter.broadcast(
    step_name: "test_start",
    detail: "Starting test: #{test_name}",
    test_name: test_name,
    status: "running"
  )
end

.start_test_runObject



6
7
8
9
10
11
# File 'lib/capydash/test_data_collector.rb', line 6

def start_test_run
  @test_run_started = true
  @test_count = 0
  @passed_count = 0
  @failed_count = 0
end