Documentation
¶
Index ¶
- Variables
- func NewFxWorker(in WorkerIn) common.Worker
- func NewFxWorker2(cfg *common.Config, args common.Arguments, loggerFactory common.LoggerFactory, ...) common.Worker
- type Asserter
- func NewContainsAsserter(expr string) Asserter
- func NewDateAsserter(layout string) Asserter
- func NewEmptyAsserter() Asserter
- func NewEqAsserter(expected interface{}) Asserter
- func NewMaxAsserter(expected float64) Asserter
- func NewMinAsserter(expected float64) Asserter
- func NewPositiveAsserter() Asserter
- func NewRangeAsserter(min, max interface{}) Asserter
- func NewRegexAsserter(expr string) Asserter
- type Asserter2
- type Asserter2Constructor
- type Asserter2Descriptor
- type Asserter2List
- type AsserterBuilder
- type Assertion
- type Assertion2
- type Assertion2Factory
- type Assertion2FactoryIn
- type AssertionMap
- type AssertionProcessor
- type AssertionResult
- type AssertionResultList
- type AssertionResultStatus
- type Engine
- type EngineConstructor
- type EngineDescriptor
- type EngineFactory
- type EngineFactoryIn
- type PostProcessor
- type PostProcessorConstructor
- type PostProcessorDescriptor
- type PostProcessorDescriptorIn
- type PostProcessorFactory
- type Reporter
- type Reporter2
- type Reporter2Constructor
- type Reporter2Descriptor
- type Reporter2Factory
- type Reporter2FactoryIn
- type Runner
- type RunnerReport
- type RunnerReportDetail
- type RunnerReportList
- type TestCase
- type TestCase2
- type TestCase2List
- type TestCase2Setup
- type TestCaseContainer
- type TestCaseResult
- type TestCaseStatus
- type Tester
- type WorkerIn
Constants ¶
This section is empty.
Variables ¶
View Source
var Constructors = fx.Provide( NewFxTester, NewFxAsserterBuilder, NewFxPostProcessorFactory, common.NewFxConfig, fx.Annotated{ Group: "reporter", Target: NewFxStdoutReporter, }, fx.Annotated{ Group: "worker", Target: NewFxWorker, }, fx.Annotated{ Group: "worker", Target: NewFxWorker2, }, fx.Annotated{ Group: "expression_descriptor", Target: func() common.ExpressionDescriptor { return common.ExpressionDescriptor{ Type: common.ExpressionTypeAsserter, Name: "eq", Constructor: NewEqAsserter, } }, }, fx.Annotated{ Group: "expression_descriptor", Target: func() common.ExpressionDescriptor { return common.ExpressionDescriptor{ Type: common.ExpressionTypeAsserter, Name: "positive", Constructor: NewPositiveAsserter, } }, }, fx.Annotated{ Group: "expression_descriptor", Target: func() common.ExpressionDescriptor { return common.ExpressionDescriptor{ Type: common.ExpressionTypeAsserter, Name: "min", Constructor: NewMinAsserter, } }, }, fx.Annotated{ Group: "expression_descriptor", Target: func() common.ExpressionDescriptor { return common.ExpressionDescriptor{ Type: common.ExpressionTypeAsserter, Name: "max", Constructor: NewMaxAsserter, } }, }, fx.Annotated{ Group: "expression_descriptor", Target: func() common.ExpressionDescriptor { return common.ExpressionDescriptor{ Type: common.ExpressionTypeAsserter, Name: "regex", Constructor: NewRegexAsserter, } }, }, fx.Annotated{ Group: "expression_descriptor", Target: func() common.ExpressionDescriptor { return common.ExpressionDescriptor{ Type: common.ExpressionTypeAsserter, Name: "empty", Constructor: NewEmptyAsserter, } }, }, fx.Annotated{ Group: "expression_descriptor", Target: func() common.ExpressionDescriptor { return common.ExpressionDescriptor{ Type: common.ExpressionTypeAsserter, Name: "date", Constructor: NewDateAsserter, } }, }, fx.Annotated{ Group: "expression_descriptor", Target: func() common.ExpressionDescriptor { return common.ExpressionDescriptor{ Type: common.ExpressionTypeAsserter, Name: "range", Constructor: NewRangeAsserter, } }, }, fx.Annotated{ Group: "expression_descriptor", Target: func() common.ExpressionDescriptor { return common.ExpressionDescriptor{ Type: common.ExpressionTypeAsserter, Name: "contains", Constructor: NewContainsAsserter, } }, }, fx.Annotated{ Group: "post_processor_descriptor", Target: func(args common.Arguments) PostProcessorDescriptor { return PostProcessorDescriptor{ Type: "JSON_EXTRACTOR", Constructor: func(config map[string]interface{}) (PostProcessor, error) { return NewJsonExtractorPostProcessor(args, config) }, } }, }, NewFxAssertionFactory, NewFxEngineFactory, NewFxReporter2Factory, )
View Source
var (
ErrTestHasFailureStatus = errors.New("Test Is Failed")
)
View Source
var (
ErrUnsupportedPostProcessor = errors.New("unsupported post processor type")
)
Functions ¶
func NewFxWorker ¶
func NewFxWorker2 ¶
func NewFxWorker2( cfg *common.Config, args common.Arguments, loggerFactory common.LoggerFactory, configProviderFactory common.ConfigProviderFactory, testEngineFactory EngineFactory, assertionFactory Assertion2Factory, reporterFactory Reporter2Factory, ) common.Worker
Types ¶
type Asserter ¶
func NewContainsAsserter ¶
func NewDateAsserter ¶
func NewEmptyAsserter ¶
func NewEmptyAsserter() Asserter
func NewEqAsserter ¶
func NewEqAsserter(expected interface{}) Asserter
func NewMaxAsserter ¶
func NewMinAsserter ¶
func NewPositiveAsserter ¶
func NewPositiveAsserter() Asserter
func NewRangeAsserter ¶
func NewRangeAsserter(min, max interface{}) Asserter
func NewRegexAsserter ¶
type Asserter2 ¶
type Asserter2 interface {
Assert(data interface{}) AssertionResultList
}
type Asserter2Constructor ¶
type Asserter2Descriptor ¶
type Asserter2Descriptor struct { Type string Constructor Asserter2Constructor }
type Asserter2List ¶
func NewAsserter2List ¶
func NewAsserter2List(assertions ...Asserter2) Asserter2List
type AsserterBuilder ¶
type AsserterBuilder interface {
Build(testCase *TestCase) AssertionProcessor
}
func NewFxAsserterBuilder ¶
func NewFxAsserterBuilder( dataCrawler common.DataCrawler, expressionFactory common.ExpressionFactory, ) AsserterBuilder
type Assertion2 ¶
type Assertion2Factory ¶
type Assertion2Factory interface {
Create(assertion Assertion2) (Asserter2, error)
}
func NewFxAssertionFactory ¶
func NewFxAssertionFactory(in Assertion2FactoryIn) Assertion2Factory
type Assertion2FactoryIn ¶
type Assertion2FactoryIn struct { fx.In Descriptors []Asserter2Descriptor `group:"assertion_descriptor"` }
type AssertionMap ¶
type AssertionProcessor ¶
type AssertionProcessor interface {
Process(testCase *TestCase)
}
type AssertionResult ¶
type AssertionResult struct { Name string Status AssertionResultStatus Expected string Actual string }
type AssertionResultList ¶
type AssertionResultList struct { common.List[AssertionResult] }
func NewAssertionResultList ¶
func NewAssertionResultList(results ...AssertionResult) AssertionResultList
func (AssertionResultList) IsPassed ¶
func (l AssertionResultList) IsPassed() bool
type AssertionResultStatus ¶
type AssertionResultStatus int
const ( AssertionResultStatusSuccess AssertionResultStatus = iota + 1 AssertionResultStatusFailure )
type Engine ¶
type Engine interface { Configure(data interface{}) error GetTestCase2List() TestCase2List CreateRunner() Runner }
type EngineConstructor ¶
type EngineConstructor func() Engine
type EngineDescriptor ¶
type EngineDescriptor struct { Type string Constructor EngineConstructor }
type EngineFactory ¶
func NewFxEngineFactory ¶
func NewFxEngineFactory(in EngineFactoryIn) EngineFactory
type EngineFactoryIn ¶
type EngineFactoryIn struct { fx.In Descriptors []EngineDescriptor `group:"engine_descriptor"` }
type PostProcessor ¶
func NewJsonExtractorPostProcessor ¶
func NewJsonExtractorPostProcessor(args common.Arguments, config map[string]interface{}) (PostProcessor, error)
type PostProcessorConstructor ¶
type PostProcessorConstructor func(config map[string]interface{}) (PostProcessor, error)
type PostProcessorDescriptor ¶
type PostProcessorDescriptor struct { Type string Constructor PostProcessorConstructor }
type PostProcessorDescriptorIn ¶
type PostProcessorDescriptorIn struct { fx.In Descriptors []PostProcessorDescriptor `group:"post_processor_descriptor"` }
type PostProcessorFactory ¶
type PostProcessorFactory interface {
Create(def common.PostProcessor) (PostProcessor, error)
}
func NewFxPostProcessorFactory ¶
func NewFxPostProcessorFactory(in PostProcessorDescriptorIn) PostProcessorFactory
type Reporter ¶
type Reporter interface {
Report(container TestCaseContainer) error
}
func NewFxStdoutReporter ¶
func NewFxStdoutReporter( loggerFactory common.LoggerFactory, ) Reporter
type Reporter2 ¶
type Reporter2 interface {
Report(report RunnerReport)
}
type Reporter2Constructor ¶
type Reporter2Constructor func(definition interface{}) Reporter2
type Reporter2Descriptor ¶
type Reporter2Descriptor struct { Type string Constructor Reporter2Constructor }
type Reporter2Factory ¶
func NewFxReporter2Factory ¶
func NewFxReporter2Factory(in Reporter2FactoryIn) Reporter2Factory
type Reporter2FactoryIn ¶
type Reporter2FactoryIn struct { fx.In Descriptors []Reporter2Descriptor `group:"reporter_descriptor"` }
type Runner ¶
type Runner interface { Setup(testCase TestCase2) Run(assertions Asserter2List) RunnerReportList }
type RunnerReport ¶
type RunnerReport struct { Name string Details []RunnerReportDetail Assertions AssertionResultList }
type RunnerReportDetail ¶
type RunnerReportDetail struct { Name string Data interface{} }
type RunnerReportList ¶
type RunnerReportList struct { common.List[RunnerReport] }
func NewRunnerReportList ¶
func NewRunnerReportList() RunnerReportList
type TestCase ¶
type TestCase struct { Name string Status TestCaseStatus Err error Template *common.Template ExpectedResult TestCaseResult ActualResult *TestCaseResult Assertions []*Assertion // contains filtered or unexported fields }
type TestCase2 ¶
type TestCase2 struct { Name string `yaml:"name"` Tags []string `yaml:"tags"` Priority int `yaml:"priority"` Setup TestCase2Setup `yaml:"setup"` Assertions []Assertion2 `yaml:"assertions"` }
func (*TestCase2) ContainsTags ¶
type TestCase2List ¶
func NewTestCase2List ¶
func NewTestCase2List() TestCase2List
func (*TestCase2List) ImportFromMap ¶
func (l *TestCase2List) ImportFromMap(testCaseMap common.Map[string, TestCase2])
type TestCase2Setup ¶
type TestCaseContainer ¶
type TestCaseContainer []*TestCase
func (TestCaseContainer) HasError ¶
func (c TestCaseContainer) HasError() bool
func (TestCaseContainer) Len ¶
func (c TestCaseContainer) Len() int
func (TestCaseContainer) Less ¶
func (c TestCaseContainer) Less(i, j int) bool
func (TestCaseContainer) Swap ¶
func (c TestCaseContainer) Swap(i, j int)
type TestCaseResult ¶
type TestCaseStatus ¶
type TestCaseStatus int
const ( TestCaseStatusUndefined TestCaseStatus = iota TestCaseStatusSuccess TestCaseStatusFailure )
type Tester ¶
type Tester interface { Configure(ctx context.Context, arguments common.Arguments, containers common.TemplateContainer) Test() (TestCaseContainer, error) }
func NewFxTester ¶
func NewFxTester( loggerFactory common.LoggerFactory, mediaConverter common.MediaConverter, builder AsserterBuilder, postProcessorFactory PostProcessorFactory, ) Tester
Source Files
¶
Click to show internal directories.
Click to hide internal directories.