Test results

Technical reference of Resultados de pruebas.

This API is used in Results.


Symbols

SymbolClassDescription
ExecuteResulttypeExecuted ExecuteResult.
StepResulttypeStepResult defines a public type of API.
ResponseSnapshottypeResponseSnapshot defines a public type of API.
BenchmarkResulttypeBenchmarkResult defines a public type of API.
BenchmarkStepResulttypeBenchmarkStepResult defines a public type of API.
BenchmarkAllocationSitetypeBenchmarkAllocationSite defines a public type of API.
MatchValuetypeMatchValue defines a public type of API.
HeaderMatchResulttypeHeaderMatchResult defines a public type of API.
BodyMatchResulttypeBodyMatchResult defines a public type of API.
BodyMatchFindingtypeBodyMatchFinding defines a public type of API.
BodyMatchDifftypeBodyMatchDiff defines a public type of API.
JSONMatchFindingtypeJSONMatchFinding defines a public type of API.
ActionValueMatchResulttypeActionValueMatchResult defines a public type of API.
ActionMatchResulttypeActionMatchResult defines a public type of API.
StepResult.MarshalJSONfuncSerialize the value as JSON.
ExecuteResult.WriteOutputfuncWrite WriteOutput.
ExecuteResult.ErrorfuncReturns the textual representation of the error.

ExecuteResult

Declaration:

gox
type ExecuteResult struct {
	File  string `json:"file,omitempty"`
	Name  string `json:"name,omitempty"`
	Mode  Mode   `json:"mode,omitempty"`
	Match bool   `json:"match"`
	Steps  []StepResult `json:"steps"`
	Output string       `json:"output,omitempty"`
	Benchmark *BenchmarkResult `json:"benchmark,omitempty"`
}

Executed ExecuteResult.

Fields

FieldTypeDescription
Filestringjson: "file, omitempty" "Associated file.
Namestringjson: "name, omitempty" "Name of the value.
ModeModejson: "mode, omitempty" "Execution mode.
Matchbooljson: "match" "Result or expression of coincidence.
Steps[]StepResultjson: "steps" "Public data associated with Steps.
Outputstringjson: "output, omitempty" "Output produced.
Benchmark*BenchmarkResultjson: "Benchmark, omitempty" "Public data associated with Benchmark.

StepResult

Declaration:

gox
type StepResult struct {
	Index  int    `json:"index"`
	Type   string `json:"type"`
	Method string `json:"method"`
	URL    string `json:"url"`
	Match  bool   `json:"match"`
	Response ResponseSnapshot `json:"response,omitempty"`
	Status  MatchValue        `json:"status,omitempty"`
	Headers HeaderMatchResult `json:"headers,omitempty"`
	Cookies HeaderMatchResult `json:"cookies,omitempty"`
	Body    BodyMatchResult   `json:"body,omitempty"`
	Action  ActionMatchResult `json:"action,omitempty"`
	Error string `json:"error,omitempty"`
	Benchmark BenchmarkStepResult `json:"benchmark,omitempty"`
}

StepResult defines a public type of API.

Fields

FieldTypeDescription
Indexintjson: "index" "Public data associated with Index.
Typestringjson: "type" "Declared type.
Methodstringjson: "method" "HTTP method or Action name.
URLstringjson: "url" "Structured request URL.
Matchbooljson: "match" "Result or expression of coincidence.
ResponseResponseSnapshotjson: "response, omitempty" "The associated response status.
StatusMatchValuejson: "status, omitempty" "Status of the operation.
HeadersHeaderMatchResultjson: "heads, omitempty" "Header collection.
CookiesHeaderMatchResultjson: "cookies, omitempty" "Cookie collection.
BodyBodyMatchResultjson: "body, omitempty" "request body.
ActionActionMatchResultjson: "action, omitempty" "Public data associated with Action.
Errorstringjson: "error, omitempty" "Associated error.
BenchmarkBenchmarkStepResultjson: "Benchmark, omitempty" "Public data associated with Benchmark.

ResponseSnapshot

Declaration:

gox
type ResponseSnapshot struct {
	StatusCode int                 `json:"statusCode,omitempty"`
	Status     string              `json:"status,omitempty"`
	Headers    map[string][]string `json:"headers,omitempty"`
	Cookies    map[string]string   `json:"cookies,omitempty"`
	Body       string              `json:"body,omitempty"`
}

ResponseSnapshot defines a public type of API.

Fields

FieldTypeDescription
StatusCodeintjson: "statusCode, omitempty" "HTTP status code.
Statusstringjson: "status, omitempty" "Status of the operation.
Headersmap[string][]stringjson: "heads, omitempty" "Header collection.
Cookiesmap[string]stringjson: "cookies, omitempty" "Cookie collection.
Bodystringjson: "body, omitempty" "request body.

BenchmarkResult

Declaration:

gox
type BenchmarkResult struct {
	Warmup            int                       `json:"warmup"`
	Iterations        int                       `json:"iterations"`
	SampleRate        float64                   `json:"sampleRate"`
	AllocationSamples int                       `json:"allocationSamples"`
	DurationNS        int64                     `json:"durationNs"`
	NsPerOp           float64                   `json:"nsPerOp"`
	OpsPerSec         float64                   `json:"opsPerSec"`
	BytesSentPerOp    float64                   `json:"bytesSentPerOp"`
	BytesRecvPerOp    float64                   `json:"bytesReceivedPerOp"`
	HandlerAllocsOp   float64                   `json:"handler_allocs/op,omitempty"`
	HandlerBytesOp    float64                   `json:"handler_bytes/op,omitempty"`
	Status            map[int]int               `json:"status"`
	Errors            int                       `json:"errors"`
	AllocationSites   []BenchmarkAllocationSite `json:"allocationSites,omitempty"`
	Steps             []BenchmarkStepResult     `json:"steps,omitempty"`
}

BenchmarkResult defines a public type of API.

Fields

FieldTypeDescription
Warmupintjson: "warmove" "Public data associated with Warmup.
Iterationsintjson: "iterations" "Public data associated with Iterations.
SampleRatefloat64json: "sampleRate" "Public data associated with SampleRate.
AllocationSamplesintjson: "allocationSamples" "Public data associated with AllocationSamples.
DurationNSint64json: "durationNs" "Length recorded.
NsPerOpfloat64json: "nsPerOp" "Public data associated with NsPerOp.
OpsPerSecfloat64json: "opsPerSec" "Public data associated with OpsPerSec.
BytesSentPerOpfloat64json: "bytesSentPerOp" "Number of bytes.
BytesRecvPerOpfloat64json: "bytesReceivedPerOp" "Number of bytes.
HandlerAllocsOpfloat64json: "handler _ allocs / op, omitempty" "Associate Handler.
HandlerBytesOpfloat64json: "handler _ bytes / op, omitempty" "Associate Handler.
Statusmap[int]intjson: "status"Status of the operation.
Errorsintjson: "errors" "Associated error.
AllocationSites[]BenchmarkAllocationSitejson: "allocationSites, omitempty" "Public data associated with AllocationSites.
Steps[]BenchmarkStepResultjson: "steps, omitempty" "Public data associated with Steps.

BenchmarkStepResult

Declaration:

gox
type BenchmarkStepResult struct {
	Index             int                       `json:"index"`
	Type              string                    `json:"type"`
	Method            string                    `json:"method,omitempty"`
	URL               string                    `json:"url,omitempty"`
	Iterations        int                       `json:"iterations"`
	AllocationSamples int                       `json:"allocationSamples"`
	DurationNS        int64                     `json:"durationNs"`
	NsPerOp           float64                   `json:"nsPerOp"`
	OpsPerSec         float64                   `json:"opsPerSec"`
	BytesSentPerOp    float64                   `json:"bytesSentPerOp"`
	BytesRecvPerOp    float64                   `json:"bytesReceivedPerOp"`
	HandlerAllocsOp   float64                   `json:"handler_allocs/op,omitempty"`
	HandlerBytesOp    float64                   `json:"handler_bytes/op,omitempty"`
	AllocationSites   []BenchmarkAllocationSite `json:"allocationSites,omitempty"`
	Status            map[int]int               `json:"status"`
	Errors            int                       `json:"errors"`
	Error             string                    `json:"error,omitempty"`
}

BenchmarkStepResult defines a public type of API.

Fields

FieldTypeDescription
Indexintjson: "index" "Public data associated with Index.
Typestringjson: "type" "Declared type.
Methodstringjson: "method, omitempty" "HTTP method or Action name.
URLstringjson: "url, omitempty" "Structured request URL.
Iterationsintjson: "iterations" "Public data associated with Iterations.
AllocationSamplesintjson: "allocationSamples" "Public data associated with AllocationSamples.
DurationNSint64json: "durationNs" "Length recorded.
NsPerOpfloat64json: "nsPerOp" "Public data associated with NsPerOp.
OpsPerSecfloat64json: "opsPerSec" "Public data associated with OpsPerSec.
BytesSentPerOpfloat64json: "bytesSentPerOp" "Number of bytes.
BytesRecvPerOpfloat64json: "bytesReceivedPerOp" "Number of bytes.
HandlerAllocsOpfloat64json: "handler _ allocs / op, omitempty" "Associate Handler.
HandlerBytesOpfloat64json: "handler _ bytes / op, omitempty" "Associate Handler.
AllocationSites[]BenchmarkAllocationSitejson: "allocationSites, omitempty" "Public data associated with AllocationSites.
Statusmap[int]intjson: "status"Status of the operation.
Errorsintjson: "errors" "Associated error.
Errorstringjson: "error, omitempty" "Associated error.

BenchmarkAllocationSite

Declaration:

gox
type BenchmarkAllocationSite struct {
	File   string `json:"file"`
	Line   int    `json:"line"`
	Name   string `json:"name,omitempty"`
	Allocs uint64 `json:"allocs"`
	Bytes  uint64 `json:"bytes"`
}

BenchmarkAllocationSite defines a public type of API.

Fields

FieldTypeDescription
Filestringjson: "file" "Associated file.
Lineintjson: "line" "Associated code line.
Namestringjson: "name, omitempty" "Name of the value.
Allocsuint64json: "allocs" "Public data associated with Allocs.
Bytesuint64json: "bytes" "Number of bytes.

MatchValue

Declaration:

gox
type MatchValue struct {
	Expected any    `json:"expected"`
	Response any    `json:"response"`
	Match    bool   `json:"match"`
	Rule     string `json:"rule,omitempty"`
	Message  string `json:"message,omitempty"`
}

MatchValue defines a public type of API.

Fields

FieldTypeDescription
Expectedanyjson: "expected" "Expected type or value.
Responseanyjson: "response" "The associated response status.
Matchbooljson: "match" "Result or expression of coincidence.
Rulestringjson: "rule, omitempty" "Public data associated with Rule.
Messagestringjson: "message, omitempty" "A descriptive message.

HeaderMatchResult

Declaration:

gox
type HeaderMatchResult struct {
	Rule   string                `json:"rule,omitempty"`
	Match  bool                  `json:"match"`
	Fields map[string]MatchValue `json:"fields,omitempty"`
}

HeaderMatchResult defines a public type of API.

Fields

FieldTypeDescription
Rulestringjson: "rule, omitempty" "Public data associated with Rule.
Matchbooljson: "match" "Result or expression of coincidence.
Fieldsmap[string]MatchValuejson: "fields, omitempty" "Text fields.

BodyMatchResult

Declaration:

gox
type BodyMatchResult struct {
	Rule     string            `json:"rule,omitempty"`
	Expected any               `json:"expected,omitempty"`
	Response any               `json:"response,omitempty"`
	Match    bool              `json:"match"`
	Message  string            `json:"message,omitempty"`
	Rules    []BodyMatchResult `json:"rules,omitempty"`
	Findings     []BodyMatchFinding `json:"findings,omitempty"`
	JSONFindings []JSONMatchFinding `json:"json_findings,omitempty"`
	Diff         *BodyMatchDiff     `json:"diff,omitempty"`
}

BodyMatchResult defines a public type of API.

Fields

FieldTypeDescription
Rulestringjson: "rule, omitempty" "Public data associated with Rule.
Expectedanyjson: "expected, omitempty" "Expected type or value.
Responseanyjson: "response, omitempty" "The associated response status.
Matchbooljson: "match" "Result or expression of coincidence.
Messagestringjson: "message, omitempty" "A descriptive message.
Rules[]BodyMatchResultjson: "rules, omitempty" "Rules set.
Findings[]BodyMatchFindingjson: "findings, omitempty" "Public data associated with Findings.
JSONFindings[]JSONMatchFindingjson: "json _ findings, omitempty" "Public data associated with JSONFindings.
Diff*BodyMatchDiffjson: "diff, omitempty" "Public data associated with Diff.

BodyMatchFinding

Declaration:

gox
type BodyMatchFinding struct {
	Pattern string `json:"pattern,omitempty"`
	Found   bool   `json:"found"`
	Line    int    `json:"line,omitempty"`
	Column  int    `json:"column,omitempty"`
	Offset  int    `json:"offset,omitempty"`
	Snippet string `json:"snippet,omitempty"`
}

BodyMatchFinding defines a public type of API.

Fields

FieldTypeDescription
Patternstringjson: "pattern, omitempty" "Pattern used for coincidence.
Foundbooljson: "found" "Public data associated with Found.
Lineintjson: "line, omitempty" "Associated code line.
Columnintjson: "column, omitempty" "Public data associated with Column.
Offsetintjson: "offset, omitempty" "Public data associated with Offset.
Snippetstringjson: "snippet, omitempty" "Public data associated with Snippet.

BodyMatchDiff

Declaration:

gox
type BodyMatchDiff struct {
	Line            int    `json:"line,omitempty"`
	Column          int    `json:"column,omitempty"`
	Offset          int    `json:"offset,omitempty"`
	ExpectedSnippet string `json:"expected_snippet,omitempty"`
	ResponseSnippet string `json:"response_snippet,omitempty"`
}

BodyMatchDiff defines a public type of API.

Fields

FieldTypeDescription
Lineintjson: "line, omitempty" "Associated code line.
Columnintjson: "column, omitempty" "Public data associated with Column.
Offsetintjson: "offset, omitempty" "Public data associated with Offset.
ExpectedSnippetstringjson: "expected _ snippet, omitempty" "Public data associated with ExpectedSnippet.
ResponseSnippetstringjson: "response _ snippet, omitempty" "Public data associated with ResponseSnippet.

JSONMatchFinding

Declaration:

gox
type JSONMatchFinding struct {
	Path     string `json:"path,omitempty"`
	Expected any    `json:"expected,omitempty"`
	Response any    `json:"response,omitempty"`
	Found    bool   `json:"found"`
	Match    bool   `json:"match"`
	Message  string `json:"message,omitempty"`
}

JSONMatchFinding defines a public type of API.

Fields

FieldTypeDescription
Pathstringjson: "path, omitempty" "Route used.
Expectedanyjson: "expected, omitempty" "Expected type or value.
Responseanyjson: "response, omitempty" "The associated response status.
Foundbooljson: "found" "Public data associated with Found.
Matchbooljson: "match" "Result or expression of coincidence.
Messagestringjson: "message, omitempty" "A descriptive message.

ActionValueMatchResult

Declaration:

gox
type ActionValueMatchResult struct {
	Rule         string                `json:"rule,omitempty"`
	Expected     any                   `json:"expected,omitempty"`
	Response     any                   `json:"response,omitempty"`
	Match        bool                  `json:"match"`
	Fields       map[string]MatchValue `json:"fields,omitempty"`
	JSONFindings []JSONMatchFinding    `json:"json_findings,omitempty"`
	Message      string                `json:"message,omitempty"`
}

ActionValueMatchResult defines a public type of API.

Fields

FieldTypeDescription
Rulestringjson: "rule, omitempty" "Public data associated with Rule.
Expectedanyjson: "expected, omitempty" "Expected type or value.
Responseanyjson: "response, omitempty" "The associated response status.
Matchbooljson: "match" "Result or expression of coincidence.
Fieldsmap[string]MatchValuejson: "fields, omitempty" "Text fields.
JSONFindings[]JSONMatchFindingjson: "json _ findings, omitempty" "Public data associated with JSONFindings.
Messagestringjson: "message, omitempty" "A descriptive message.

ActionMatchResult

Declaration:

gox
type ActionMatchResult struct {
	Error  ActionValueMatchResult `json:"error,omitempty"`
	Result ActionValueMatchResult `json:"result,omitempty"`
	Match  bool                   `json:"match"`
}

ActionMatchResult defines a public type of API.

Fields

FieldTypeDescription
ErrorActionValueMatchResultjson: "error, omitempty" "Associated error.
ResultActionValueMatchResultjson: "result, omitempty" "Associated outcome.
Matchbooljson: "match" "Result or expression of coincidence.

StepResult.MarshalJSON

Declaration:

gox
func (s StepResult) MarshalJSON() ([]byte, error)

Serialize the value as JSON.

Returns

ReturnTypeDescription
value[]byteResult collection; can be nil when there are no values.
errerrornil if the operation ends correctly; otherwise, the error produced.

Behavior

The operation returns an error when it cannot complete the above contract.

Errors

MarshalJSON returns an error when the arguments, the status of the receiver or the underlying operation make it impossible to complete the call.

Usage syntax

gox
value, err := stepResult.MarshalJSON()

ExecuteResult.WriteOutput

Declaration:

gox
func (r ExecuteResult) WriteOutput(path string) error

Write WriteOutput.

Parameters

ParameterTypeDescription
pathstringType value string required by the operation.

Returns

ReturnTypeDescription
errerrornil if the operation ends correctly; otherwise, the error produced.

Behavior

The operation returns an error when it cannot complete the above contract.

Errors

WriteOutput returns an error when the arguments, the status of the receiver or the underlying operation make it impossible to complete the call.

Usage syntax

gox
err := executeResult.WriteOutput(value)

ExecuteResult.Error

Declaration:

gox
func (r ExecuteResult) Error() string

Returns the textual representation of the error.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := executeResult.Error()

See also

Next step

Continue with Exported API reserved for runtime.

Runtime API