Class: Ace::Test::EndToEndRunner::Molecules::ScenarioLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/test/end_to_end_runner/molecules/scenario_loader.rb

Overview

Loads a TS-format scenario directory into TestScenario + TestCase models.

Supported test case format is standalone TC pairs only:

  • ‘TC-*.runner.md`

  • ‘TC-*.verify.md`

Constant Summary collapse

LEGACY_FIELDS =
%w[mode execution-model].freeze

Instance Method Summary collapse

Instance Method Details

#load(scenario_dir) ⇒ Models::TestScenario

Load a scenario directory

Parameters:

  • scenario_dir (String)

    Path to the TS-* scenario directory

Returns:

Raises:

  • (ArgumentError)

    If scenario.yml is missing, invalid, or has missing required fields



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ace/test/end_to_end_runner/molecules/scenario_loader.rb', line 23

def load(scenario_dir)
  yml_path = File.join(scenario_dir, "scenario.yml")
  raise ArgumentError, "scenario.yml not found: #{yml_path}" unless File.exist?(yml_path)

  frontmatter = parse_scenario_yml(yml_path)
  validate_scenario!(frontmatter, yml_path)

  test_cases = discover_test_cases(scenario_dir)
  fixture_path = detect_fixture_path(scenario_dir)

  Models::TestScenario.new(
    test_id: frontmatter["test-id"],
    title: frontmatter["title"],
    area: frontmatter["area"],
    package: frontmatter["package"] || infer_package(scenario_dir),
    priority: frontmatter["priority"] || "medium",
    duration: frontmatter["duration"] || "~5min",
    timeout: parse_timeout(frontmatter["timeout"], yml_path),
    requires: frontmatter["requires"] || {},
    file_path: File.expand_path(yml_path),
    content: File.read(yml_path),
    setup_steps: frontmatter["setup"] || [],
    dir_path: File.expand_path(scenario_dir),
    fixture_path: fixture_path,
    test_cases: test_cases,
    tags: parse_tags(frontmatter["tags"]),
    tool_under_test: frontmatter["tool-under-test"],
    sandbox_layout: frontmatter["sandbox-layout"] || {},
    sandbox_profile: parse_sandbox_profile(frontmatter["sandbox-profile"], yml_path)
  )
end