Add scenario setup and teardown lifecycle#21
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds scenario lifecycle support (setup / main steps / teardown) to the Luotsi scenario runner, including phase-aware reporting/events and ensuring teardown runs even after setup/main failures.
Changes:
- Introduces
setupandteardownsections inScenarioFileand makes validation/catalog discovery lifecycle-aware. - Executes scenario lifecycle with phase reporting in JSONL events and scenario reports.
- Extends test fakes and adds coverage for lifecycle ordering, phase reporting, and “first failure wins” behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Luotsi.Cli/Scenarios/ScenarioValidator.cs | Validates setup/main/teardown steps in order; updates “observe from previous step” rule to be lifecycle-aware. |
| Luotsi.Cli/Scenarios/ScenarioExecutor.cs | Runs setup + main with teardown always attempted; emits per-step phase and reports phase in step results. |
| Luotsi.Cli/Scenarios/ScenarioEvents.cs | Extends scenario event payload with phase field. |
| Luotsi.Cli/Scenarios/ScenarioCatalog.cs | Includes lifecycle steps in catalog action discovery and step counting; adds ScenarioStepPhases. |
| Luotsi.Cli/Models/Contracts.cs | Extends ScenarioFile contract to include Setup and Teardown. |
| Luotsi.Cli.Tests/TestSupport.cs | Enhances FakeDeviceHost to support lifecycle-related assertions and injected failures. |
| Luotsi.Cli.Tests/ScenarioExecutorTests.cs | Adds tests for lifecycle ordering, validation, teardown-after-failure, and phase reporting. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
setupandteardownlifecycle sections around existingstepsphasefor setup, main, and teardown stepsValidation
dotnet test Luotsi.Cli.Tests\Luotsi.Cli.Tests.csprojdotnet build -c Releasegit diff --check