Documentation
¶
Overview ¶
HTTP dialing stays behind Sender. This package owns scenario execution.
Index ¶
- func MatchPath(got, pattern string) (map[string]any, bool)
- func Register(name string, fn func([]any) (any, error)) error
- func Unregister(name string)
- type Call
- type Embed
- type Exchange
- type FileResult
- type Link
- type MockRuntime
- type Options
- type Page
- type Reply
- type ScenarioResult
- type Sender
- type StepResult
- type Stream
- type TransportSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
Register adds a function to the gi and karate objects for later scenarios. Built-in names are rejected. Unregister removes a previous registration.
func Unregister ¶
func Unregister(name string)
Types ¶
type FileResult ¶
type FileResult struct {
Path string
Name string
Scenarios []ScenarioResult
Duration time.Duration
Started time.Time
}
func RunFiles ¶
func RunFiles(ctx context.Context, files []*feature.File, opt Options, done func(FileResult)) ([]FileResult, error)
RunFiles runs every file. One file uses Jobs across its scenarios. Several files use Jobs across files, and each file stays in order. done, when set, is called once per file, one file at a time.
func (FileResult) Passed ¶
func (f FileResult) Passed() bool
type Link ¶
type Link struct {
Send func(context.Context, any) error
Receive func(context.Context) (any, error)
Call func(context.Context, string, any) (any, error)
Open func(context.Context, string) (Stream, error)
Close func() error
}
Link carries only the operations a protocol actually implements.
type MockRuntime ¶
type MockRuntime struct {
// contains filtered or unexported fields
}
MockRuntime owns a persistent scenario VM. Its caller must serialize requests. Background executes once; request variables and response metadata are reset for each request, while user-defined state remains in the same JS runtime.
func NewMockRuntime ¶
func (*MockRuntime) Run ¶
func (m *MockRuntime) Run(ctx context.Context, vars map[string]any) ScenarioResult
type Options ¶
type Options struct {
Vars map[string]any
HTTP Sender
Stdout io.Writer
Jobs int
Tag string
LoadMode bool
Mock bool
VU int
Iter int
Timeout time.Duration
OnRequest func(Exchange)
BeforeRequest func(context.Context) error
Prepare func(*script.VM)
Dial func(context.Context, string, map[string]any) (Link, error)
NewPage func(context.Context) (Page, error)
Depth int
Env string
Suite *suite.Suite
SkipHooks bool
Stack []string
// contains filtered or unexported fields
}
type ScenarioResult ¶
type ScenarioResult struct {
Name string
Line int
Tags []string
Passed bool
Canceled bool
Skipped bool
Miss bool
Duration time.Duration
Started time.Time
Steps []StepResult
Error string
Vars map[string]any
Defined map[string]bool
ReportDisabled bool
}
func RunScenario ¶
type StepResult ¶
type Stream ¶
type Stream struct {
Send func(context.Context, any) error
Receive func(context.Context) (any, error)
CloseSend func() error
Close func() error
}
Stream is one streaming call. CloseSend half-closes the client side. Close releases the call.
type TransportSettings ¶
type TransportSettings struct {
TLSConfigured bool
TrustAll bool
TLSVersion uint16
CACert, Cert, Key string
ProxySet bool
Proxy, NonProxyHosts string
ConnectTimeout time.Duration
}
TransportSettings is immutable data, comparable for connection-pool reuse. Default settings preserve the caller's HTTP client's transport.