Skip to content

feat(#511): scenario runner — capture step outputs into named variables#566

Merged
Timi16 merged 1 commit intoTimi16:mainfrom
kehindefaith26:feature/511-scenario-variable-capture
Mar 25, 2026
Merged

feat(#511): scenario runner — capture step outputs into named variables#566
Timi16 merged 1 commit intoTimi16:mainfrom
kehindefaith26:feature/511-scenario-variable-capture

Conversation

@kehindefaith26
Copy link
Contributor

Summary

  • Adds a capture field to ScenarioStep: set it to a variable name and the step's return value is stored for reuse by later steps.
  • Later steps interpolate captured values via {{var_name}} in args or expected_return.
  • Undefined variable references fail immediately with a descriptive error that names the missing variable and lists currently available ones.

Changes

  • src/scenario.rs — new capture field, interpolate_variables() helper, variable accumulator in run_scenario, 4 unit tests
  • tests/command_feature_tests.rs — 2 new integration tests (capture+interpolation success, undefined variable error)
  • README.md — new ### Scenario Command section with field reference table and capture/{{var}} examples

Test plan

  • cargo test passes (unit + integration)
  • scenario_captures_step_output_and_uses_in_expected_return passes with counter fixture
  • scenario_fails_on_undefined_variable_in_args fails with clear error message containing the variable name

Closes #511

… in scenario runner

Steps can now set `capture = "var_name"` to store their return value in a
named variable. Later steps reference captured values with `{{var_name}}`
syntax in their `args` or `expected_return` fields. An undefined variable
reference produces a clear error listing both the missing name and the
variables currently in scope.
@drips-wave
Copy link

drips-wave bot commented Mar 25, 2026

@kehindefaith26 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Timi16 Timi16 merged commit aed0730 into Timi16:main Mar 25, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scenario runner: support capturing step outputs into named variables

2 participants