testmgr

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TODO(#10): Make this configurable
	DEFAULT_TEST_CLEANUP_TIMEOUT = 20 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type StormTestManager

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

func NewStormTestManager

func NewStormTestManager(
	suite core.SuiteContext,
	registrant interface {
		core.TestRegistrant
		core.TestRegistrantMetadata
	},
	logDir *string,
) (*StormTestManager, error)

func (*StormTestManager) Duration added in v0.2.0

func (tm *StormTestManager) Duration() time.Duration

func (*StormTestManager) Registrant

func (tm *StormTestManager) Registrant() core.TestRegistrantMetadata

func (*StormTestManager) StopTimer added in v0.2.0

func (tm *StormTestManager) StopTimer()

func (*StormTestManager) Suite

func (tm *StormTestManager) Suite() core.SuiteContext

func (*StormTestManager) TestCases

func (tm *StormTestManager) TestCases() []*TestCase

type TestCase

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

TestCase represents a single test case within a test suite. It implements the core.TestCase interface. This is the concrete implementation of a test case that is managed by the StormTestManager.

func (*TestCase) ArtifactBroker added in v0.2.0

func (t *TestCase) ArtifactBroker() stormartifacts.ArtifactBroker

ArtifactBroker implements core.TestCase.

func (*TestCase) BackgroundWaitGroup

func (t *TestCase) BackgroundWaitGroup() *sync.WaitGroup

BackgroundWaitGroup implements core.TestCase.

func (*TestCase) CollectedOutput

func (t *TestCase) CollectedOutput() []string

Returns the collected output of the test case.

func (*TestCase) Context

func (t *TestCase) Context() context.Context

Context implements core.TestCase.

func (*TestCase) Error

func (t *TestCase) Error(err error)

Error implements core.TestCase.

func (*TestCase) Execute

func (t *TestCase) Execute() error

Executes the test case function. The returned error is guaranteed to be the return of the test case function.

func (*TestCase) Fail

func (t *TestCase) Fail(reason string)

Fail implements core.TestCase.

func (*TestCase) FailFromError

func (t *TestCase) FailFromError(err error)

FailFromError implements core.TestCase.

func (*TestCase) GetError

func (t *TestCase) GetError() error

Returns the error that caused the test case to fail. This is nil if the test case did not fail because of an error.

func (*TestCase) IsBailCondition

func (t *TestCase) IsBailCondition() bool

Returns whether this test caused a bail condition, which means that the test suite should stop. This is true if the test failed or errored out in a way that does not allow for recovery.

func (*TestCase) MarkError

func (t *TestCase) MarkError(err error)

Mark a test as errored. This is used when the test case panics or returns an error.

func (*TestCase) MarkNotRun

func (t *TestCase) MarkNotRun(reason string)

Mark a pending test as skipped because of a dependency failure.

func (*TestCase) Name

func (t *TestCase) Name() string

Name implements core.TestCase.

func (*TestCase) Pass

func (t *TestCase) Pass()

Close this test case as passed.

func (*TestCase) Reason

func (t *TestCase) Reason() string

Returns the reason for the test case closure.

func (*TestCase) Registrant

func (t *TestCase) Registrant() core.TestRegistrantMetadata

Registrant implements core.TestCase.

func (*TestCase) RunTime

func (t *TestCase) RunTime() time.Duration

RunTime implements core.TestCase. Returns the duration of the test case. If the test case is still running, it returns the duration since the start time.

func (*TestCase) SetCollectedOutput

func (t *TestCase) SetCollectedOutput(val []string)

func (*TestCase) Skip

func (t *TestCase) Skip(reason string)

Skip implements core.TestCase.

func (*TestCase) Status

func (t *TestCase) Status() TestCaseStatus

Retrieves the status of the test case.

func (*TestCase) SuiteCleanup

func (t *TestCase) SuiteCleanup(f func())

SuiteCleanup implements core.TestCase.

func (*TestCase) SuiteCleanupList

func (t *TestCase) SuiteCleanupList() []func()

Return the suite-level cleanup functions registered in this test case.

type TestCaseStatus

type TestCaseStatus int
const (
	TestCaseStatusPending TestCaseStatus = iota
	TestCaseStatusRunning
	TestCaseStatusPassed
	TestCaseStatusFailed
	TestCaseStatusSkipped
	TestCaseStatusNotRun
	TestCaseStatusError
)

func (TestCaseStatus) ColorString

func (tcs TestCaseStatus) ColorString() string

func (TestCaseStatus) Errored

func (tcs TestCaseStatus) Errored() bool

func (TestCaseStatus) Failed

func (tcs TestCaseStatus) Failed() bool

func (TestCaseStatus) IsBad

func (tcs TestCaseStatus) IsBad() bool

IsBad returns true if the test case status is either Failed or Error.

func (TestCaseStatus) IsFinal

func (tcs TestCaseStatus) IsFinal() bool

IsFinal returns true for all test case statuses that are considered final states. This includes Passed, Failed, Skipped, and Error statuses. It does not include Pending or Running statuses.

func (TestCaseStatus) IsPending

func (tcs TestCaseStatus) IsPending() bool

func (TestCaseStatus) IsRunning

func (tcs TestCaseStatus) IsRunning() bool

func (TestCaseStatus) NotRun

func (tcs TestCaseStatus) NotRun() bool

func (TestCaseStatus) Passed

func (tcs TestCaseStatus) Passed() bool

func (TestCaseStatus) Ran added in v0.2.0

func (tcs TestCaseStatus) Ran() bool

Ran returns whether the test case was actually executed. This is true for Passed, Failed, and Error statuses. It is false for Pending, Running, Skipped, and NotRun statuses.

func (TestCaseStatus) Skipped

func (tcs TestCaseStatus) Skipped() bool

func (TestCaseStatus) String

func (tcs TestCaseStatus) String() string

Jump to

Keyboard shortcuts

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