adapter

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	// Init is called once before any actions/assertions.
	Init(config map[string]string) error

	// Action executes a named action with arguments.
	Action(name string, args json.RawMessage) (*Response, error)

	// Assert checks an assertion against the system under test.
	Assert(property string, locator string, expected json.RawMessage) (*Response, error)

	// Close cleans up resources.
	Close() error
}

Adapter is the interface any plugin adapter must implement.

type HTTPAdapter

type HTTPAdapter struct {
	BaseURL string
	// contains filtered or unexported fields
}

HTTPAdapter is the built-in adapter for testing HTTP APIs.

func NewHTTPAdapter

func NewHTTPAdapter() *HTTPAdapter

func (*HTTPAdapter) Action

func (a *HTTPAdapter) Action(name string, args json.RawMessage) (*Response, error)

func (*HTTPAdapter) Assert

func (a *HTTPAdapter) Assert(
	property string,
	_ string,
	expected json.RawMessage,
) (*Response, error)

func (*HTTPAdapter) Close

func (*HTTPAdapter) Close() error

func (*HTTPAdapter) Init

func (a *HTTPAdapter) Init(config map[string]string) error

type ProcessAdapter

type ProcessAdapter struct {
	Command string
	// contains filtered or unexported fields
}

ProcessAdapter is the built-in adapter for testing subprocesses.

func NewProcessAdapter

func NewProcessAdapter() *ProcessAdapter

func (*ProcessAdapter) Action

func (a *ProcessAdapter) Action(name string, args json.RawMessage) (*Response, error)

func (*ProcessAdapter) Assert

func (a *ProcessAdapter) Assert(
	property string,
	_ string,
	expected json.RawMessage,
) (*Response, error)

func (*ProcessAdapter) Close

func (*ProcessAdapter) Close() error

func (*ProcessAdapter) Init

func (a *ProcessAdapter) Init(config map[string]string) error

type Request

type Request struct {
	Type     string          `json:"type"`               // "action" or "assert"
	Name     string          `json:"name,omitempty"`     // action/assertion name
	Args     json.RawMessage `json:"args,omitempty"`     // action arguments
	Locator  string          `json:"locator,omitempty"`  // for UI assertions
	Property string          `json:"property,omitempty"` // assertion property
	Expected json.RawMessage `json:"expected,omitempty"` // expected value
}

Request is sent from the runtime to an adapter.

type Response

type Response struct {
	Error  string          `json:"error,omitempty"`
	Actual json.RawMessage `json:"actual,omitempty"`
	OK     bool            `json:"ok"`
}

Response is returned from an adapter to the runtime.

Jump to

Keyboard shortcuts

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