Documentation
¶
Overview ¶
Package graph builds and analyzes the dependency graph between test cases.
The graph builder inspects template references in test fields ({{ alias.path }}, {{ savedVar }}, {{ prev.body.id }}) and constructs a directed acyclic graph where edges represent "must run after" relationships.
After the graph is built, it is topologically sorted and grouped into waves: sets of tests that have no dependencies on each other and can run in parallel.
Responsibilities ¶
- Extract template references via regex
- Match references to alias-defining tests
- Build a directed graph of dependencies
- Detect cycles and report them with the participating tests
- Topologically sort with deterministic tie-breaking
- Group into parallel waves
- Compute SaveRequirements (which fields each producer must persist)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct{}
Builder constructs a dependency graph from a set of test files.
func New ¶
func New() *Builder
New returns a new Builder. Builder is stateless and safe for concurrent use.
func (*Builder) Build ¶
Build analyzes every test across the given files and produces a Plan with ordered waves, dependencies, and the per-producer save requirements.
Build returns an error on duplicate aliases, missing alias references in explicit `depends:`, or dependency cycles (returned as *CycleError).
Matrix expansion and load-test replication are deferred — see TODOs.
type CycleError ¶
type CycleError struct {
Cycle []*TestRef
}
CycleError indicates a dependency cycle. Cycle lists the tests involved.
func (*CycleError) Error ¶
func (e *CycleError) Error() string
type Dependency ¶
type Dependency struct {
From *TestRef
To *TestRef
Type DependencyType
Alias string
Paths []string
}
Dependency describes a "must run after" relationship.
type DependencyType ¶
type DependencyType int
DependencyType classifies how a dependency was discovered.
const ( DepTemplate DependencyType = iota DepExplicit DepPrev )
type Plan ¶
type Plan struct {
Waves []Wave
Dependencies []Dependency
SaveRequirements map[string]SaveRequirement
}
Plan is the execution plan produced by the graph builder.
type SaveRequirement ¶
SaveRequirement describes what a producer test must persist for its consumers.