framework

package
v2.0.0-alpha.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

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

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 CapturedMessage struct {
	Time    time.Time
	Message string
}

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

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

func (l *CapturingLogger) RemoveChildLogger(child *CapturingLogger)

type Logger

type Logger interface {
	Println(args ...interface{})
	Printf(message string, args ...interface{})
}

func LoggerWithPrefix

func LoggerWithPrefix(baseLogger Logger, prefix string) Logger

func NullLogger

func NullLogger() Logger

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL