base

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextLabel added in v0.11.0

func ContextLabel(ctx context.Context) Labels

ContextLabel get labels from context

func WithContextLabel added in v0.11.0

func WithContextLabel(ctx context.Context, labels Labels) context.Context

WithContextLabel inject labels into context

Types

type Condition

type Condition interface {
	Condition(testCtx *TestContext) error
}

Condition describe the conditions which the test must match

type ConditionFunc

type ConditionFunc func(testCtx *TestContext) error

ConditionFunc helper function to wrapping condition

func (ConditionFunc) Condition

func (c ConditionFunc) Condition(testCtx *TestContext) error

Condition implement the Condition interface

type Configure added in v0.11.0

type Configure interface {
	// Config mutate suite config and reporter config
	Config(suiteConfig *types.SuiteConfig, reporterConfig *types.ReporterConfig)
}

Configure describe interface for configure framework

type ConfigureFunc added in v0.11.0

type ConfigureFunc func(suiteConfig *types.SuiteConfig, reporterConfig *types.ReporterConfig)

ConfigureFunc helper function to generate a implementation of configure interface

func (ConfigureFunc) Config added in v0.11.0

func (p ConfigureFunc) Config(suiteConfig *types.SuiteConfig, reporterConfig *types.ReporterConfig)

Config mutate suite config and reporter config

type SharedExtension

type SharedExtension interface {
	// SetShardInfo set shard info into context
	SetShardInfo(ctx context.Context) context.Context
}

SharedExtension describe interface for shared extension

type SharedExtensionFunc

type SharedExtensionFunc func(ctx context.Context) context.Context

SharedExtensionFunc helper function to generate a new shared extension

func (SharedExtensionFunc) SetShardInfo

func (p SharedExtensionFunc) SetShardInfo(ctx context.Context) context.Context

SetShardInfo set shard info into context

type TestCaseBuilder

type TestCaseBuilder struct {
	TestContextGetter

	// Name of the test case
	Name string

	// Priority of the test case
	Priority TestCasePriority

	// Scope defines what kind of permissions this test case needs
	// Labels used to filter test cases when executing testing
	Labels []string

	// Conditions condition list which will be checked before test case execution
	Conditions []Condition

	// FailedWhenConditionMismatch allow skip test case when test condition check failed
	// default to skip
	FailedWhenConditionMismatch bool

	// TestSpec the spec of the test case
	TestSpec TestSpecFunc
}

TestCaseBuilder builder for TestCases helps provide methods to construct

func (*TestCaseBuilder) CaseName

func (b *TestCaseBuilder) CaseName() string

CaseName returns the formatted name of the test case

func (*TestCaseBuilder) CheckCondition

func (b *TestCaseBuilder) CheckCondition(testCtx *TestContext) (skip bool, err error)

CheckCondition check test case condition

type TestCaseLabel

type TestCaseLabel = string

TestCaseLabel label for test case

type TestCasePriority

type TestCasePriority uint16

TestCasePriority priority for the testcase

const (
	// P0 critical priority test case
	P0 TestCasePriority = 0
	// P1 high priority test case
	P1 TestCasePriority = 1
	// P2 medium priority test case
	P2 TestCasePriority = 2
	// P3 low priority test case
	P3 TestCasePriority = 3
)

type TestContext

type TestContext struct {
	Context context.Context
	*zap.SugaredLogger
}

TestContext the context of a test case

func (*TestContext) GetContext added in v0.11.0

func (ctx *TestContext) GetContext() context.Context

GetContext returns the context for TestContext

func (*TestContext) GetLogger added in v0.11.0

func (ctx *TestContext) GetLogger() *zap.SugaredLogger

GetLogger returns a logger

type TestContextGetter

type TestContextGetter interface {
	// GetTestContext get test case context
	GetTestContext() *TestContext
}

TestContextGetter interface to get test context

type TestContextGetterFunc

type TestContextGetterFunc func() *TestContext

TestContextGetterFunc a function used to generate an implementation of TestContextGetter

func (TestContextGetterFunc) GetTestContext

func (c TestContextGetterFunc) GetTestContext() *TestContext

GetTestContext get test case context

type TestSpecFunc

type TestSpecFunc func(testContext *TestContext)

TestSpecFunc function used as describe

Jump to

Keyboard shortcuts

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