base

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 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

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