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

suiterun

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Overview

Package suiterun runs a declarative suite from a Go test binary. A project supplies its step definitions and cleanup handlers through Options and calls Main from TestMain and Run from a test; flag parsing, topology loading, image builds, selection, coverage and log capture are handled here. The framework's own suite and a suite in another repository that imports the framework as a module use the same entry points.

Index

Constants

View Source
const DefaultSuiteFile = "it-suite.yaml"

DefaultSuiteFile is the suite declaration read from Options.Dir when none is named.

Variables

This section is empty.

Functions

func FindWorkspaceRoot

func FindWorkspaceRoot(dir string) (string, error)

FindWorkspaceRoot returns the nearest directory at or above dir that holds a go.work file or a .git entry.

func Main

func Main(m *testing.M, opts Options)

Main parses the suite flags, prepares the process, runs the tests and exits. Call it from TestMain.

func Run

func Run(t *testing.T, opts Options)

Run executes the suite declared by opts. Call it from a test function.

func Selection

func Selection() topology.Selection

Selection returns the selection parsed from the command line by Main.

func ShapeAt

func ShapeAt(dir, suiteFile string, selected topology.Selection) (blocks, maxRunners int, ok bool)

ShapeAt returns the resolved block count and largest runner concurrency of the suite declared in dir, after applying selected.

Types

type Options

type Options struct {
	// Dir holds the suite file and is the root feature paths resolve against. It defaults to
	// the working directory, which `go test` sets to the test package's directory.
	Dir string

	// SuiteFile names the suite declaration inside Dir. It defaults to DefaultSuiteFile.
	SuiteFile string

	// WorkspaceRoot is the project checkout. Relative policy trees and project files resolve
	// against it, and files the framework itself owns fall back to its embedded copies. It
	// defaults to the nearest ancestor of Dir that holds a go.work file or a .git entry.
	WorkspaceRoot string

	// Steps constructs the runner-isolated step definitions. It is required.
	Steps func(topo *frameworkruntime.Topology, featureRoot string) (frameworkruntime.StepRegistrar, error)

	// CleanupDeleters registers how each resource kind is deleted. It is optional.
	CleanupDeleters func(reg *cleanup.Registry, topo *frameworkruntime.Topology)
}

Options describes one suite.

Jump to

Keyboard shortcuts

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