Documentation ¶
Overview ¶
Package testkit contains blackbox testing utilities for testing Dogma applications.
Index ¶
- type Runner
- type RunnerOption
- type T
- type Test
- func (t *Test) AdvanceTimeBy(delta time.Duration, a assert.Assertion, options ...engine.OperationOption) *Test
- func (t *Test) AdvanceTimeTo(now time.Time, a assert.Assertion, options ...engine.OperationOption) *Test
- func (t *Test) ExecuteCommand(m dogma.Message, a assert.Assertion, options ...engine.OperationOption) *Test
- func (t *Test) Prepare(messages ...dogma.Message) *Test
- func (t *Test) RecordEvent(m dogma.Message, a assert.Assertion, options ...engine.OperationOption) *Test
- type TestOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
A Runner executes tests.
func New ¶
func New( app dogma.Application, options ...RunnerOption, ) *Runner
New returns a test runner.
func (*Runner) Begin ¶
func (r *Runner) Begin(t T, options ...TestOption) *Test
Begin starts a new test.
func (*Runner) BeginContext ¶
BeginContext starts a new test within a context.
type RunnerOption ¶
type RunnerOption func(*runnerOptions)
RunnerOption applies optional settings to a test runner.
func RunnerVerbose ¶
func RunnerVerbose(enabled bool) RunnerOption
RunnerVerbose returns a runner option that enables or disables verbose test output across the entire test runner.
By default, tests produce verbose output if the -v flag is passed to "go test".
func WithEngineOptions ¶
func WithEngineOptions(options ...engine.Option) RunnerOption
WithEngineOptions returns a RunnerOption that applies optional settings to the engine used by the test-runner.
type T ¶
type T interface { Log(args ...interface{}) Logf(f string, args ...interface{}) FailNow() }
T is the interface via which the test framework consumes Go's *testing.T value.
It allows use of stand-ins, such as Ginkgo's GinkgoT() value.
type Test ¶
type Test struct {
// contains filtered or unexported fields
}
Test contains the state of a single test.
func (*Test) AdvanceTimeBy ¶
func (t *Test) AdvanceTimeBy( delta time.Duration, a assert.Assertion, options ...engine.OperationOption, ) *Test
AdvanceTimeBy artificially advances the engine's notion of the current time by a fixed duration. The duration must be positive.
func (*Test) AdvanceTimeTo ¶
func (t *Test) AdvanceTimeTo( now time.Time, a assert.Assertion, options ...engine.OperationOption, ) *Test
AdvanceTimeTo artificially advances the engine's notion of the current time to a specific time. The time must be greater than the current engine time.
func (*Test) ExecuteCommand ¶
func (t *Test) ExecuteCommand( m dogma.Message, a assert.Assertion, options ...engine.OperationOption, ) *Test
ExecuteCommand makes an assertion about the application's behavior when a specific command is executed.
func (*Test) Prepare ¶
Prepare prepares the application for the test by executing the given set of messages without any assertions.
func (*Test) RecordEvent ¶
func (t *Test) RecordEvent( m dogma.Message, a assert.Assertion, options ...engine.OperationOption, ) *Test
RecordEvent makes an assertion about the application's behavior when a specific event is recorded.
type TestOption ¶
type TestOption func(*testOptions)
TestOption applies optional settings to a test.
func Verbose ¶
func Verbose(enabled bool) TestOption
Verbose returns a test option that enables or disables verbose test output for an individual test.
By default, tests produce verbose output if the -v flag is passed to "go test".
func WithOperationOptions ¶
func WithOperationOptions(options ...engine.OperationOption) TestOption
WithOperationOptions returns a TestOption that applies optional per-operation settings when performing assertions.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package assert contains the assertions used by the test runner.
|
Package assert contains the assertions used by the test runner. |
Package compare contains utilities for comparing Dogma entities.
|
Package compare contains utilities for comparing Dogma entities. |
Package engine contains an in-memory Dogma engine.
|
Package engine contains an in-memory Dogma engine. |
controller
Package controller contains interfaces that the engine uses to consume controllers for each of the message handler types.
|
Package controller contains interfaces that the engine uses to consume controllers for each of the message handler types. |
controller/aggregate
Package aggregate provides engine components that handle messages that are routed to aggregate message handlers.
|
Package aggregate provides engine components that handle messages that are routed to aggregate message handlers. |
controller/integration
Package integration provides engine components that handle messages that are routed to integration message handlers.
|
Package integration provides engine components that handle messages that are routed to integration message handlers. |
controller/process
Package process provides engine components that handle messages that are routed to process message handlers.
|
Package process provides engine components that handle messages that are routed to process message handlers. |
controller/projection
Package projection provides engine components that handle messages that are routed to projection message handlers.
|
Package projection provides engine components that handle messages that are routed to projection message handlers. |
envelope
Package envelope provides a container for passing Dogma messages and their meta-data between components.
|
Package envelope provides a container for passing Dogma messages and their meta-data between components. |
fact
Package fact contains structures that represents internal engine events.
|
Package fact contains structures that represents internal engine events. |
Package render contains utilities for rendering various values in a human-readable manner.
|
Package render contains utilities for rendering various values in a human-readable manner. |