runner

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunStage

func RunStage(runContext *TestRunContext, ftwCheck *check.FTWCheck, testCase schema.Test, stage schema.Stage) error

RunStage runs an individual test stage. runContext contains information for the current test run ftwCheck is the current check utility testCase is the test case the stage belongs to stage is the stage you want to run

func RunTest

func RunTest(runContext *TestRunContext, ftwTest *test.FTWTest) error

RunTest runs an individual test. runContext contains information for the current test run ftwTest is the test you want to run

Types

type RunStats added in v0.4.2

type RunStats struct {
	// Run is the amount of tests executed in this run.
	Run int `json:"run"`
	// Success is a list containing the tests that were successful.
	Success []string `json:"success"`
	// Failed is a list containing the failed tests.
	Failed []string `json:"failed"`
	// Skipped is a list containing the tests that were skipped.
	Skipped    []string `json:"skipped"`
	Ignored    []string `json:"ignored"`
	ForcedPass []string `json:"forced-pass"`
	ForcedFail []string `json:"forced-fail"`
	// RunTime maps the time taken to run each test.
	RunTime map[string]time.Duration `json:"runtime"`
	// TotalTime is the duration over all runs, the sum of all individual run times.
	TotalTime time.Duration
}

RunStats accumulates test statistics.

func NewRunStats added in v0.4.2

func NewRunStats() *RunStats

NewRunStats creates and initializes a new Stats struct.

func (*RunStats) TotalFailed added in v0.4.2

func (stats *RunStats) TotalFailed() int

type RunnerConfig added in v0.4.5

type RunnerConfig struct {
	// Include is a regular expression to filter tests to include. If nil, all tests are included.
	Include *regexp.Regexp
	// Exclude is a regular expression to filter tests to exclude. If nil, no tests are excluded.
	Exclude *regexp.Regexp
	// IncludeTags is a regular expression to filter tests to count the ones tagged with the mathing label. If nil, no impact on test runner.
	IncludeTags *regexp.Regexp
	// ShowTime determines whether to show the time taken to run each test.
	ShowTime bool
	// ShowOnlyFailed will only output information related to failed tests
	ShowOnlyFailed bool
	// Output determines the type of output the user wants.
	Output output.Type
	// ConnectTimeout is the timeout for connecting to endpoints during test execution.
	ConnectTimeout time.Duration
	// ReadTimeout is the timeout for receiving responses during test execution.
	ReadTimeout time.Duration
	// RateLimit is the rate limit for requests to the server. 0 is unlimited.
	RateLimit time.Duration
	// FailFast determines whether to stop running tests when the first failure is encountered.
	FailFast bool
}

RunnerConfig provides configuration for the test runner.

type TestResult

type TestResult int

TestResult type are the values that the result of a test can have

const (
	Success TestResult = iota
	Failed
	Skipped
	Ignored
	ForcePass
	ForceFail
)

Handy constants for test results

type TestRunContext

type TestRunContext struct {
	Config         *config.FTWConfiguration
	RunnerConfig   *RunnerConfig
	Include        *regexp.Regexp
	Exclude        *regexp.Regexp
	IncludeTags    *regexp.Regexp
	ShowTime       bool
	ShowOnlyFailed bool
	Output         *output.Output
	Stats          *RunStats
	Result         TestResult
	Duration       time.Duration
	Client         *ftwhttp.Client
	LogLines       *waflog.FTWLogLines
}

TestRunContext carries information about the current test run. This includes configuration information as well as statistics and results.

func Run

Run runs your tests with the specified Config.

Jump to

Keyboard shortcuts

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