Help us shape the future of Go! Take the 2026 Go Developer Survey

scenario

package
v0.57.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package scenario owns the compile-time catalog of cross-runtime user flows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseTags

func ParseTags(raw string) []string

ParseTags splits a comma-separated tag selector and removes duplicates.

Types

type Expectation

type Expectation struct {
	Scenario string
	Runtime  string
}

Expectation identifies a scenario/runtime row required by an aggregate job.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry validates and owns an explicit scenario catalog.

func NewRegistry

func NewRegistry(scenarios ...Scenario) *Registry

NewRegistry constructs a scenario registry from an explicit catalog.

func (*Registry) All

func (r *Registry) All() []Scenario

All returns the registry scenarios in declaration order.

func (*Registry) Run

func (r *Registry) Run(ctx context.Context, rt runtime.Runtime, tags []string) Report

Run executes selected scenarios in declaration order and emits NOT RUN rows for the rest. Declared session boundaries reset only the scenario that owns them; warm scenarios inherit the current runtime state.

type Report

type Report struct {
	Rows []Row
}

Report contains one row for every scenario in the registry.

func (Report) Row

func (r Report) Row(scenario string, runtimeName string) Row

Row returns a report row, or a zero row when it is absent.

func (Report) String

func (r Report) String() string

String renders the discovered-scenario report as a stable, line-oriented table suitable for CI logs and artifacts.

func (Report) ValidateExpected

func (r Report) ValidateExpected(expected []Expectation) error

ValidateExpected fails when an aggregate-required row is absent, unselected, or failed. SKIP is a valid coverage row when the runtime declares a control unsupported and includes the reason in the report.

type Row

type Row struct {
	Scenario string
	Runtime  string
	Status   Status
	Reason   string
}

Row is the report record for one scenario/runtime pair.

type Scenario

type Scenario struct {
	Name    string
	Tags    []string
	Session runtime.SessionRequirement
	Run     func(context.Context, runtime.Runtime) error
}

Scenario is one user flow with stable tags for CI slicing.

func DriveScenarios

func DriveScenarios() []Scenario

DriveScenarios returns the Drive scenario catalog in execution order.

type Status

type Status string

Status is the result state for one scenario and runtime pair.

const (
	// StatusPass marks a selected scenario that completed successfully.
	StatusPass Status = "PASS"
	// StatusFail marks a selected scenario that failed in the runtime.
	StatusFail Status = "FAIL"
	// StatusSkip marks a selected scenario that the runtime cannot support.
	StatusSkip Status = "SKIP"
	// StatusNotRun marks a scenario that was filtered out by tags.
	StatusNotRun Status = "NOT RUN"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL