{"modulePath":"github.com/AlaudaDevops/pkg","version":"v0.14.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package base\n\n## Functions\n\n```go\nfunc ContextLabel(ctx context.Context) Labels\n```\nContextLabel get labels from context\n\n```go\nfunc WithContextLabel(ctx context.Context, labels Labels) context.Context\n```\nWithContextLabel inject labels into context\n\n## Types\n\n```go\ntype Condition interface {\n\tCondition(testCtx *TestContext) error\n}\n```\nCondition describe the conditions which the test must match\n\n```go\ntype ConditionFunc func(testCtx *TestContext) error\n```\nConditionFunc helper function to wrapping condition\n\n```go\nfunc (c ConditionFunc) Condition(testCtx *TestContext) error\n```\nCondition implement the Condition interface\n\n```go\ntype Configure interface {\n\t// Config mutate suite config and reporter config\n\tConfig(suiteConfig *types.SuiteConfig, reporterConfig *types.ReporterConfig)\n}\n```\nConfigure describe interface for configure framework\n\n```go\ntype ConfigureFunc func(suiteConfig *types.SuiteConfig, reporterConfig *types.ReporterConfig)\n```\nConfigureFunc helper function to generate a implementation of configure interface\n\n```go\nfunc (p ConfigureFunc) Config(suiteConfig *types.SuiteConfig, reporterConfig *types.ReporterConfig)\n```\nConfig mutate suite config and reporter config\n\n```go\ntype SharedExtension interface {\n\t// SetShardInfo set shard info into context\n\tSetShardInfo(ctx context.Context) context.Context\n}\n```\nSharedExtension describe interface for shared extension\n\n```go\ntype SharedExtensionFunc func(ctx context.Context) context.Context\n```\nSharedExtensionFunc helper function to generate a new shared extension\n\n```go\nfunc (p SharedExtensionFunc) SetShardInfo(ctx context.Context) context.Context\n```\nSetShardInfo set shard info into context\n\n```go\ntype TestCaseBuilder struct {\n\tTestContextGetter\n\n\t// Name of the test case\n\tName string\n\n\t// Priority of the test case\n\tPriority TestCasePriority\n\n\t// Scope defines what kind of permissions this test case needs\n\t// Labels used to filter test cases when executing testing\n\tLabels []string\n\n\t// Conditions condition list which will be checked before test case execution\n\tConditions []Condition\n\n\t// FailedWhenConditionMismatch allow skip test case when test condition check failed\n\t// default to skip\n\tFailedWhenConditionMismatch bool\n\n\t// TestSpec the spec of the test case\n\tTestSpec TestSpecFunc\n}\n```\nTestCaseBuilder builder for TestCases helps provide methods to construct\n\n```go\nfunc (b *TestCaseBuilder) CaseName() string\n```\nCaseName returns the formatted name of the test case\n\n```go\nfunc (b *TestCaseBuilder) CheckCondition(testCtx *TestContext) (skip bool, err error)\n```\nCheckCondition check test case condition\n\n```go\ntype TestCaseLabel = string\n```\nTestCaseLabel label for test case\n\n```go\ntype TestCasePriority uint16\n```\nTestCasePriority priority for the testcase\n\n```go\nconst (\n\t// P0 critical priority test case\n\tP0 TestCasePriority = 0\n\t// P1 high priority test case\n\tP1 TestCasePriority = 1\n\t// P2 medium priority test case\n\tP2 TestCasePriority = 2\n\t// P3 low priority test case\n\tP3 TestCasePriority = 3\n)\n```\n\n```go\ntype TestContext struct {\n\tContext context.Context\n\t*zap.SugaredLogger\n}\n```\nTestContext the context of a test case\n\n```go\nfunc (ctx *TestContext) GetContext() context.Context\n```\nGetContext returns the context for TestContext\n\n```go\nfunc (ctx *TestContext) GetLogger() *zap.SugaredLogger\n```\nGetLogger returns a logger\n\n```go\ntype TestContextGetter interface {\n\t// GetTestContext get test case context\n\tGetTestContext() *TestContext\n}\n```\nTestContextGetter interface to get test context\n\n```go\ntype TestContextGetterFunc func() *TestContext\n```\nTestContextGetterFunc a function used to generate an implementation of TestContextGetter\n\n```go\nfunc (c TestContextGetterFunc) GetTestContext() *TestContext\n```\nGetTestContext get test case context\n\n```go\ntype TestSpecFunc func(testContext *TestContext)\n```\nTestSpecFunc function used as describe\n\n","path":"github.com/AlaudaDevops/pkg/testing/framework/base","name":"base","synopsis":"","isRedistributable":true}
