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



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
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/ace/test/end_to_end_runner/cli/commands/run_test.rb', line 70

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

  if options[:dry_run] && prune_artifacts
    raise Ace::Support::Cli::Error.new(
      "--prune-artifacts cannot be used with --dry-run"
    )
  end

  prune_artifacts_if_requested(output: output, prune_artifacts: prune_artifacts, quiet: quiet?(options))

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

  orchestrator = build_orchestrator(
    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