Documentation
¶
Index ¶
- func Run(spec Exec, contextList chan Context) chan *Execution
- func RunParallel(workerCount int, spec Exec, contextList chan Context) chan *Execution
- type Context
- type ContextImpl
- func (cntx *ContextImpl) CorrelationId() string
- func (cntx *ContextImpl) Derive(overrideValues map[string]string) Context
- func (cntx *ContextImpl) Env() map[string]string
- func (cntx *ContextImpl) ExpandVars(tpl string) (string, error)
- func (cntx *ContextImpl) ExpandVarsNoError(tpl string) string
- func (cntx *ContextImpl) Populate(n int, createTestDataClosure func(testNumber int) map[string]string) chan Context
- func (cntx *ContextImpl) Test() map[string]string
- func (cntx *ContextImpl) TestNumber() int
- type Exec
- type Execution
- type FuncExec
- type HttpExec
- func (httpExec *HttpExec) Contains(substring string) *HttpExec
- func (httpExec *HttpExec) Exec(cntx Context) error
- func (httpExec *HttpExec) Expect(e HttpExpectation)
- func (httpExec *HttpExec) HasCode(code int) *HttpExec
- func (httpExec *HttpExec) HasCodeRange(min, max int) *HttpExec
- func (httpExec *HttpExec) HasContentType(contentType string) *HttpExec
- func (httpExec *HttpExec) HasNonErrorCode() *HttpExec
- func (httpExec *HttpExec) SelectorContains(selector, substring string) *HttpExec
- func (httpExec *HttpExec) String(cntx Context) string
- func (httpExec *HttpExec) WithAuthorization(authorizationHeader string) *HttpExec
- func (httpExec *HttpExec) WithBasicAuth(username, password string) *HttpExec
- type HttpExpectation
- type Repository
- type SequenceExec
- type TestFactory
- type TestScenario
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context interface {
// TestNumber is the number of the actual test.
TestNumber() int
// Test returns the configuration data
// for a single test integration.
Test() map[string]string
// Env returns the environment configuration which is common for all
// test groups.
Env() map[string]string
// ExpandVars executes the supplied go template with the context as data context
ExpandVars(template string) (string, error)
// ExpandVarsNoError Same as expand vars, but returning template it self in case of an error
ExpandVarsNoError(template string) string
// Derive creates a copy of the context, where the test data is
// field wise overwritten by the supplied test data and the
// test number is incremented.
Derive(overrideValues map[string]string) Context
// Populate can be used to create test data for the number of ExecutionCount tests.
// It calls the supplied closure for each test and derives a new Context using the test data returned by the supplied function.
// The creation is done in a go routine and supplied over returned channel.
// The channel will be closed after sending the last entry.
Populate(n int, createTestDataClosure func(testNumber int) map[string]string) chan Context
// CorrelationId is the id which should be transferred in the service chain
CorrelationId() string
}
type ContextImpl ¶
type ContextImpl struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext(env map[string]string) *ContextImpl
NewContext creates a new context - env base data, which ma be nil
func NewDefaultContext ¶
func NewDefaultContext() *ContextImpl
NewDefaultContext creates a new context without data
func (*ContextImpl) CorrelationId ¶
func (cntx *ContextImpl) CorrelationId() string
func (*ContextImpl) Derive ¶
func (cntx *ContextImpl) Derive(overrideValues map[string]string) Context
func (*ContextImpl) Env ¶
func (cntx *ContextImpl) Env() map[string]string
func (*ContextImpl) ExpandVars ¶
func (cntx *ContextImpl) ExpandVars(tpl string) (string, error)
func (*ContextImpl) ExpandVarsNoError ¶
func (cntx *ContextImpl) ExpandVarsNoError(tpl string) string
func (*ContextImpl) Test ¶
func (cntx *ContextImpl) Test() map[string]string
func (*ContextImpl) TestNumber ¶
func (cntx *ContextImpl) TestNumber() int
type Exec ¶
type Exec interface {
// Exec executes the step
// - cntx the data and reporting context
Exec(cntx Context) error
// String returns the description for the step
String(cntx Context) string
}
Exec is the central interface for executable processing steps
type Execution ¶
type Execution struct {
// contains filtered or unexported fields
}
func StartExecution ¶
type HttpExec ¶
type HttpExec struct {
Method string
Url string
Header http.Header
Body []byte
// contains filtered or unexported fields
}
func Get ¶
Example ¶
err := Get("https://www.golang.org").
HasContentType("text/html").
SelectorContains("div.rootHeading", "Try Java").
Exec(NewDefaultContext())
fmt.Println(err.Error())
Output: selection does not contain "Try Java", but was: "Try Go"
func (*HttpExec) Expect ¶
func (httpExec *HttpExec) Expect(e HttpExpectation)
func (*HttpExec) HasCodeRange ¶
func (*HttpExec) HasContentType ¶
func (*HttpExec) HasNonErrorCode ¶
func (*HttpExec) SelectorContains ¶
func (*HttpExec) WithAuthorization ¶
func (*HttpExec) WithBasicAuth ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
A repository is a set of test groups with tests.
func NewRepository ¶
func NewRepository() *Repository
func (*Repository) Add ¶
func (repo *Repository) Add(scenario *TestScenario, testGroup string, concurrency int, tags ...string)
func (*Repository) GetErrorExecutions ¶
func (repo *Repository) GetErrorExecutions() []*Execution
func (*Repository) RunTestScenarios ¶
func (repo *Repository) RunTestScenarios(testGroupRegex string, nameRegex string, tagPatterns ...string)
Run all testScenarios, which match the supplied filter criteria.
type SequenceExec ¶
type SequenceExec struct {
// contains filtered or unexported fields
}
func Seq ¶
func Seq(name string, steps ...Exec) *SequenceExec
func (*SequenceExec) Add ¶
func (s *SequenceExec) Add(r Exec) *SequenceExec
Add a Step to the SequenceExec
func (*SequenceExec) AddN ¶
func (s *SequenceExec) AddN(n int, r Exec) *SequenceExec
Add a Step n times to the SequenceExec
func (*SequenceExec) Exec ¶
func (s *SequenceExec) Exec(cntx Context) error
func (*SequenceExec) String ¶
func (s *SequenceExec) String() string
type TestFactory ¶
TestFactory is a factory method which returns a test with its data.
type TestScenario ¶
func NewTestScenario ¶
func NewTestScenario(name string, exec Exec, contextChannelFactory func() chan Context) *TestScenario
Click to show internal directories.
Click to hide internal directories.