executor

package
v0.0.0-...-7856175 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package executor provides test execution with HTTP traffic capture.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssertionResult

type AssertionResult struct {
	Type     string      `json:"type"`
	Target   string      `json:"target,omitempty"`
	Passed   bool        `json:"passed"`
	Message  string      `json:"message,omitempty"`
	Expected interface{} `json:"expected,omitempty"`
	Actual   interface{} `json:"actual,omitempty"`
}

AssertionResult captures the outcome of a single assertion.

type ExecutionSummary

type ExecutionSummary struct {
	Total         int           `json:"total"`
	Passed        int           `json:"passed"`
	Failed        int           `json:"failed"`
	TotalDuration time.Duration `json:"totalDuration"`
}

ExecutionSummary provides aggregate statistics.

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor runs API tests and captures HTTP traffic.

func New

func New(config ExecutorConfig) *Executor

New creates a new executor with traffic capture enabled.

func (*Executor) ExecutePlan

func (e *Executor) ExecutePlan(ctx context.Context, plan *apptest.TestPlan) ([]TestResult, error)

ExecutePlan runs all tests in a test plan.

func (*Executor) ExecuteTest

func (e *Executor) ExecuteTest(ctx context.Context, test *apptest.TestCase, target apptest.TargetSpec, vars map[string]string) (TestResult, error)

ExecuteTest runs a single test case.

func (*Executor) GetRecords

func (e *Executor) GetRecords() []ir.IRRecord

GetRecords returns all captured IR records.

func (*Executor) Results

func (e *Executor) Results() []TestResult

Results returns all test results.

func (*Executor) Summary

func (e *Executor) Summary() ExecutionSummary

Summary returns a summary of test results.

func (*Executor) WriteIR

func (e *Executor) WriteIR(path string) error

WriteIR writes captured traffic to an IR file.

type ExecutorConfig

type ExecutorConfig struct {
	// Timeout for individual requests
	Timeout time.Duration

	// Variables for template substitution
	Variables map[string]string

	// Base authentication (applied to all requests unless overridden)
	Auth *apptest.AuthSpec

	// Whether to continue on test failure
	ContinueOnFail bool

	// Output path for IR records (optional)
	IROutputPath string
}

ExecutorConfig configures the executor.

func DefaultExecutorConfig

func DefaultExecutorConfig() ExecutorConfig

DefaultExecutorConfig returns default configuration.

type SliceWriter

type SliceWriter struct {
	// contains filtered or unexported fields
}

SliceWriter is an IRWriter that stores records in memory.

func NewSliceWriter

func NewSliceWriter() *SliceWriter

NewSliceWriter creates a new in-memory writer.

func (*SliceWriter) Close

func (w *SliceWriter) Close() error

Close is a no-op for SliceWriter.

func (*SliceWriter) Flush

func (w *SliceWriter) Flush() error

Flush is a no-op for SliceWriter.

func (*SliceWriter) Records

func (w *SliceWriter) Records() []ir.IRRecord

Records returns all captured records.

func (*SliceWriter) Write

func (w *SliceWriter) Write(record *ir.IRRecord) error

Write adds a record to the slice.

type TestResult

type TestResult struct {
	TestID     string            `json:"testId"`
	TestName   string            `json:"testName"`
	Passed     bool              `json:"passed"`
	Duration   time.Duration     `json:"duration"`
	StatusCode int               `json:"statusCode,omitempty"`
	Error      string            `json:"error,omitempty"`
	Assertions []AssertionResult `json:"assertions,omitempty"`
}

TestResult captures the outcome of a single test.

Jump to

Keyboard shortcuts

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