runner

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunStage

func RunStage(runContext *TestRunContext, ftwCheck *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 FTWCheck

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

FTWCheck is the base struct for checking test results

func NewCheck

func NewCheck(context *TestRunContext) (*FTWCheck, error)

NewCheck creates a new FTWCheck, allowing to inject the configuration

func (*FTWCheck) AssertExpectError

func (c *FTWCheck) AssertExpectError(err error) (bool, bool)

AssertExpectError helper to check if this error was expected or not

func (*FTWCheck) AssertLogs

func (c *FTWCheck) AssertLogs() bool

func (*FTWCheck) AssertResponseContains

func (c *FTWCheck) AssertResponseContains(response string) bool

AssertResponseContains checks that the http response contains the needle

func (*FTWCheck) AssertStatus

func (c *FTWCheck) AssertStatus(status int) bool

AssertStatus will match the expected status list with the one received in the response

func (*FTWCheck) CloudMode

func (c *FTWCheck) CloudMode() bool

CloudMode returns true if we are running in cloud mode

func (*FTWCheck) ForcedFail

func (c *FTWCheck) ForcedFail(testCase *schema.Test) bool

ForcedFail check if this ID need to be ignored from results

func (*FTWCheck) ForcedIgnore

func (c *FTWCheck) ForcedIgnore(testCase *schema.Test) bool

ForcedIgnore check if this ID need to be ignored from results

func (*FTWCheck) ForcedPass

func (c *FTWCheck) ForcedPass(testCase *schema.Test) bool

ForcedPass check if this ID need to be ignored from results

func (*FTWCheck) GetTriggeredRules

func (c *FTWCheck) GetTriggeredRules() []uint

func (*FTWCheck) SetEndMarker

func (c *FTWCheck) SetEndMarker(marker []byte)

SetEndMarker sets the log line that marks the end of the logs to analyze

func (*FTWCheck) SetExpectError

func (c *FTWCheck) SetExpectError(expect bool)

SetExpectError sets the boolean if we are expecting an error from the server

func (*FTWCheck) SetExpectResponse

func (c *FTWCheck) SetExpectResponse(response string)

SetExpectResponse sets the response we expect in the text from the server

func (*FTWCheck) SetExpectStatus

func (c *FTWCheck) SetExpectStatus(status int)

SetExpectStatus sets to expect the HTTP status from the test to be in the integer range passed

func (*FTWCheck) SetExpectTestOutput

func (c *FTWCheck) SetExpectTestOutput(t *test.Output)

SetExpectTestOutput sets the combined expected output from this test

func (*FTWCheck) SetLogContains

func (c *FTWCheck) SetLogContains(regex string)

SetLogContains sets the string to look for in logs

func (*FTWCheck) SetNoLogContains

func (c *FTWCheck) SetNoLogContains(regex string)

SetNoLogContains sets the string to look that should not present in logs

func (*FTWCheck) SetStartMarker

func (c *FTWCheck) SetStartMarker(marker []byte)

SetStartMarker sets the log line that marks the start of the logs to analyze

type RunStats

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
	// TriggeredRules maps triggered rules to stages of tests
	TriggeredRules map[string][][]uint `json:"triggered-rules"`
}

RunStats accumulates test statistics.

func NewRunStats

func NewRunStats() *RunStats

NewRunStats creates and initializes a new Stats struct.

func (*RunStats) TotalFailed

func (stats *RunStats) TotalFailed() int

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 {
	RunnerConfig         *config.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
	CurrentStageDuration time.Duration
	// contains filtered or unexported fields
}

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

func Run

func Run(runnerConfig *config.RunnerConfig, tests []*test.FTWTest, out *output.Output) (*TestRunContext, error)

Run runs your tests with the specified Config.

func (*TestRunContext) EndStage

func (t *TestRunContext) EndStage(testCase *schema.Test, testResult TestResult, triggeredRules []uint)

func (*TestRunContext) EndTest

func (t *TestRunContext) EndTest(testCase *schema.Test)

func (*TestRunContext) StartStage

func (t *TestRunContext) StartStage()

func (*TestRunContext) StartTest

func (t *TestRunContext) StartTest()

Jump to

Keyboard shortcuts

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