Class: Ace::Test::EndToEndRunner::CLI::Commands::RunTest

Inherits:
Support::Cli::Command
  • Object
show all
Includes:
Support::Cli::Base
Defined in:
lib/ace/test/end_to_end_runner/cli/commands/run_test.rb

Overview

CLI command for running E2E tests

Supports running a single test by ID or all tests in a package. Tests are executed via LLM and results are written to standard report locations.

Instance Method Summary collapse

Instance Method Details

#call(package:, test_id: nil, **options) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/ace/test/end_to_end_runner/cli/commands/run_test.rb', line 67

def call(package:, test_id: nil, **options)
  options = coerce_types(options, timeout: :integer, parallel: :integer)
  output = quiet?(options) ? StringIO.new : $stdout

  # Handle dry-run mode
  if options[:dry_run]
    return handle_dry_run(package, test_id, output, tags: parse_tags(options[:tags]))
  end

  orchestrator = Organisms::TestOrchestrator.new(
    provider: options[:provider],
    timeout: options[:timeout],
    parallel: options[:parallel],
    progress: options[:progress]
  )

  results = orchestrator.run(
    package: package,
    test_id: test_id,
    verify: options[:verify],
    tags: parse_tags(options[:tags]),
    cli_args: options[:cli_args],
    run_id: options[:run_id],
    report_dir: options[:report_dir],
    output: output
  )

  if results.empty?
    raise Ace::Support::Cli::Error.new(
      "No tests found for package '#{package}'" +
      (test_id ? " with ID '#{test_id}'" : "")
    )
  end

  # Exit with error if any test failed (excluding skips)
  if results.any?(&:failed?)
    failed = results.select(&:failed?)
    failed_ids = failed.map(&:test_id).join(", ")
    raise Ace::Support::Cli::Error.new(
      "#{failed.size} test(s) failed: #{failed_ids}"
    )
  end
end