bdd

package
v0.3.66 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunFeatures

func RunFeatures(t *testing.T, path string, opts ...Option)

RunFeatures runs all Gherkin feature files at path using the pre-built step definitions. Each scenario gets a fresh ScenarioContext and wftest.Harness so scenarios are fully isolated.

Types

type Config

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

Config holds configuration for a BDD test run.

type CoverageReport

type CoverageReport struct {
	TotalPipelines       int
	CoveredPipelines     []PipelineCoverageEntry
	UncoveredPipelines   []string
	TotalScenarios       int
	ImplementedScenarios int // scenarios that reference a known pipeline
	PassingScenarios     int // filled in by test runner, not static analysis
	PendingScenarios     int // filled in by test runner, not static analysis
	UndefinedScenarios   int // TotalScenarios - ImplementedScenarios
}

CoverageReport summarises pipeline and scenario coverage from static analysis. PassingScenarios and PendingScenarios require a live test run; they are zero when returned by CalculateCoverage (static only).

func CalculateCoverage

func CalculateCoverage(configPath, featureDir string) (*CoverageReport, error)

CalculateCoverage performs static analysis: parses configPath for pipeline definitions and walks featureDir for .feature files. Returns a CoverageReport showing which pipelines are exercised by BDD scenarios.

type Option

type Option func(*Config)

Option configures a BDD test run.

func Strict

func Strict() Option

Strict makes the runner fail on undefined or pending steps.

func WithConfig

func WithConfig(path string) Option

WithConfig sets a default config file path applied to every scenario's harness.

func WithMockStep

func WithMockStep(name string, handler wftest.StepHandler) Option

WithMockStep registers a mock step handler applied to every scenario's harness.

func WithYAML

func WithYAML(yaml string) Option

WithYAML sets default inline YAML applied to every scenario's harness.

type PipelineCoverageEntry

type PipelineCoverageEntry struct {
	Pipeline    string
	FeatureFile string
	Line        int
	Via         string // "tag" or "route"
}

PipelineCoverageEntry describes a .feature file reference to a pipeline.

type ScenarioContext

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

ScenarioContext holds state for a single Gherkin scenario. A fresh ScenarioContext is created for each scenario. Harness creation is deferred until the first "When" action step so that all "Given" step options (YAML config, mocks, state seeds) are accumulated first and applied together when the harness is built.

Jump to

Keyboard shortcuts

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