Class: Ace::Test::EndToEndRunner::Models::TestScenario

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/test/end_to_end_runner/models/test_scenario.rb

Overview

Data model representing a parsed E2E test scenario (TS-*/scenario.yml directory)

Contains all information extracted from a test scenario including scenario.yml metadata, test cases, and setup steps.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_id:, title:, area:, package:, file_path:, content:, priority: "medium", duration: "~5min", requires: {}, setup_steps: [], dir_path: nil, fixture_path: nil, test_cases: [], timeout: nil, tags: [], tool_under_test: nil, sandbox_layout: {}, sandbox_profile: "ace-default") ⇒ TestScenario

Returns a new instance of TestScenario.

Parameters:

  • test_id (String)

    Test identifier (e.g., “TS-LINT-001”)

  • title (String)

    Test title

  • area (String)

    Test area (e.g., “lint”)

  • package (String)

    Package name (e.g., “ace-lint”)

  • priority (String) (defaults to: "medium")

    Priority level (default: “medium”)

  • duration (String) (defaults to: "~5min")

    Expected duration (default: “~5min”)

  • requires (Hash) (defaults to: {})

    Required tools and versions

  • file_path (String)

    Absolute path to the scenario directory

  • content (String)

    Full markdown content of the scenario

  • timeout (Integer, nil) (defaults to: nil)

    Optional per-scenario timeout in seconds

  • setup_steps (Array) (defaults to: [])

    Declarative setup steps from scenario.yml

  • dir_path (String, nil) (defaults to: nil)

    Path to the scenario directory

  • fixture_path (String, nil) (defaults to: nil)

    Path to the fixtures/ directory

  • test_cases (Array<Models::TestCase>) (defaults to: [])

    Independent test case files

  • tags (Array<String>) (defaults to: [])

    Scenario-level tags for discovery-time filtering

  • tool_under_test (String, nil) (defaults to: nil)

    Primary tool under test

  • sandbox_layout (Hash) (defaults to: {})

    Declared sandbox artifact layout

  • sandbox_profile (String) (defaults to: "ace-default")

    Sandbox bootstrap profile



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 35

def initialize(test_id:, title:, area:, package:, file_path:, content:,
  priority: "medium", duration: "~5min", requires: {},
  setup_steps: [], dir_path: nil, fixture_path: nil, test_cases: [],
  timeout: nil, tags: [], tool_under_test: nil,
  sandbox_layout: {}, sandbox_profile: "ace-default")
  @test_id = test_id
  @title = title
  @area = area
  @package = package
  @priority = priority
  @duration = duration
  @requires = requires
  @file_path = file_path
  @content = content
  @timeout = timeout
  @setup_steps = setup_steps
  @dir_path = dir_path
  @fixture_path = fixture_path
  @test_cases = test_cases
  @tags = tags
  @tool_under_test = tool_under_test
  @sandbox_layout = sandbox_layout
  @sandbox_profile = sandbox_profile
end

Instance Attribute Details

#areaObject (readonly)

Returns the value of attribute area.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def area
  @area
end

#contentObject (readonly)

Returns the value of attribute content.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def content
  @content
end

#dir_pathObject (readonly)

Returns the value of attribute dir_path.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def dir_path
  @dir_path
end

#durationObject (readonly)

Returns the value of attribute duration.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def duration
  @duration
end

#file_pathObject (readonly)

Returns the value of attribute file_path.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def file_path
  @file_path
end

#fixture_pathObject (readonly)

Returns the value of attribute fixture_path.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def fixture_path
  @fixture_path
end

#packageObject (readonly)

Returns the value of attribute package.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def package
  @package
end

#priorityObject (readonly)

Returns the value of attribute priority.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def priority
  @priority
end

#requiresObject (readonly)

Returns the value of attribute requires.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def requires
  @requires
end

#sandbox_layoutObject (readonly)

Returns the value of attribute sandbox_layout.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def sandbox_layout
  @sandbox_layout
end

#sandbox_profileObject (readonly)

Returns the value of attribute sandbox_profile.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def sandbox_profile
  @sandbox_profile
end

#setup_stepsObject (readonly)

Returns the value of attribute setup_steps.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def setup_steps
  @setup_steps
end

#tagsObject (readonly)

Returns the value of attribute tags.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def tags
  @tags
end

#test_casesObject (readonly)

Returns the value of attribute test_cases.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def test_cases
  @test_cases
end

#test_idObject (readonly)

Returns the value of attribute test_id.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def test_id
  @test_id
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def timeout
  @timeout
end

#titleObject (readonly)

Returns the value of attribute title.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def title
  @title
end

#tool_under_testObject (readonly)

Returns the value of attribute tool_under_test.



12
13
14
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 12

def tool_under_test
  @tool_under_test
end

Instance Method Details

#dir_name(timestamp) ⇒ String

Build a directory name for sandbox/reports

Parameters:

  • timestamp (String)

    Timestamp ID (7-char Base36)

Returns:

  • (String)

    Directory name (e.g., “8xyz12-lint-ts001”)



85
86
87
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 85

def dir_name(timestamp)
  "#{timestamp}-#{short_package}-#{short_id}"
end

#short_idString

Generate short test ID for directory naming

Returns:

  • (String)

    Short ID (e.g., “ts001” from “TS-LINT-001”)



68
69
70
71
72
73
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 68

def short_id
  match = test_id.match(/TS-[A-Z0-9]+-(\d+[a-z]*)/)
  return "ts#{match[1]}" if match

  test_id.downcase.gsub(/[^a-z0-9]/, "")
end

#short_packageString

Generate short package name (without ace- prefix)

Returns:

  • (String)

    Short package name (e.g., “lint” from “ace-lint”)



62
63
64
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 62

def short_package
  package.sub(/\Aace-/, "")
end

#test_case_idsArray<String>

Extract test case IDs from the test_cases array

Returns:

  • (Array<String>)

    List of test case IDs (e.g., [“TC-001”, “TC-002”])



78
79
80
# File 'lib/ace/test/end_to_end_runner/models/test_scenario.rb', line 78

def test_case_ids
  @test_case_ids ||= test_cases.map(&:tc_id)
end