Documentation ¶
Overview ¶
Package framework contains the low-level implementation of test harness infrastructure that can be reused for different kinds of tests. The base package contains shared types such as Logger; other components are in the subpackages harness and ldtest.
The general model is:
1. The test harness communicates with a test service, which exposes a root endpoint for querying its status (GET) or creating some kind of entity within the test service (POST).
2. The test harness can expose any number of mock endpoints to receive requests from the test service.
3. There is a general notion of a test context which is similar to Go's testing.T, allowing pieces of test logic to be associated with a test identifier and to accumulate success/failure results.
The domain-specific code that knows what is being tested is responsible for providing the parameters to send to the test service, the HTTP handlers for handling requests to mock endpoints, and domain-specific test APIs on top of the test context.
Index ¶
- type Capabilities
- type CapturedMessage
- type CapturedOutput
- type CapturingLogger
- func (l *CapturingLogger) AddChildLogger(child *CapturingLogger)
- func (l *CapturingLogger) Output() CapturedOutput
- func (l *CapturingLogger) Printf(message string, args ...interface{})
- func (l *CapturingLogger) Println(args ...interface{})
- func (l *CapturingLogger) RemoveChildLogger(child *CapturingLogger)
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
type Capabilities []string
Capabilities is a type alias for a list of strings representing test service capabilities. The meanings of these strings are defined by the domain-specific test service spec.
func (Capabilities) Has ¶
func (cs Capabilities) Has(name string) bool
Has returns true if the specified string appears in the list.
type CapturedMessage ¶
type CapturedOutput ¶
type CapturedOutput []CapturedMessage
func (CapturedOutput) ToString ¶
func (output CapturedOutput) ToString(prefix string) string
type CapturingLogger ¶
type CapturingLogger struct {
// contains filtered or unexported fields
}
CapturingLogger is used internally to record all output from a test scope. See comments on ldtest.(*T).DebugLogger() for the rules of logging in parent/child scopes.
func (*CapturingLogger) AddChildLogger ¶ added in v1.1.4
func (l *CapturingLogger) AddChildLogger(child *CapturingLogger)
func (*CapturingLogger) Output ¶
func (l *CapturingLogger) Output() CapturedOutput
func (*CapturingLogger) Printf ¶
func (l *CapturingLogger) Printf(message string, args ...interface{})
func (*CapturingLogger) Println ¶
func (l *CapturingLogger) Println(args ...interface{})
func (*CapturingLogger) RemoveChildLogger ¶ added in v1.1.4
func (l *CapturingLogger) RemoveChildLogger(child *CapturingLogger)
Directories ¶
Path | Synopsis |
---|---|
Package harness contains basic reusable test harness components, without any domain-specific logic.
|
Package harness contains basic reusable test harness components, without any domain-specific logic. |
Package ldtest contains a test runner framework that is similar to Go's testing package, but is run as regular Go application code rather than Go tests.
|
Package ldtest contains a test runner framework that is similar to Go's testing package, but is run as regular Go application code rather than Go tests. |
internal
Package internal contains test helpers for ldtest.
|
Package internal contains test helpers for ldtest. |
Package opt provides the generic Maybe type for representing optional values without pointers.
|
Package opt provides the generic Maybe type for representing optional values without pointers. |