results

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package results provides structured result writing for E2E test scenarios

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparison

type Comparison struct {
	Timestamp    time.Time         `json:"timestamp"`
	BaselineID   string            `json:"baseline_id"`
	CurrentID    string            `json:"current_id"`
	BaselineDate time.Time         `json:"baseline_date"`
	CurrentDate  time.Time         `json:"current_date"`
	Diffs        []ScenarioDiff    `json:"diffs"`
	MetricsDiff  map[string]Diff   `json:"metrics_diff,omitempty"`
	Overall      ComparisonSummary `json:"overall"`
}

Comparison represents a comparison between two test runs

func Compare

func Compare(baseline, current *TestRun) *Comparison

Compare compares two test runs and produces a comparison report

type ComparisonSummary

type ComparisonSummary struct {
	StatusChanges    int  `json:"status_changes"`
	Improvements     int  `json:"improvements"`
	Regressions      int  `json:"regressions"`
	MetricsImproved  int  `json:"metrics_improved"`
	MetricsRegressed int  `json:"metrics_regressed"`
	OverallImproved  bool `json:"overall_improved"`
}

ComparisonSummary provides high-level comparison statistics

type Diff

type Diff struct {
	Baseline  float64 `json:"baseline"`
	Current   float64 `json:"current"`
	Absolute  float64 `json:"absolute"`
	Percent   float64 `json:"percent"`
	Improved  bool    `json:"improved"`
	Regressed bool    `json:"regressed"`
}

Diff represents a numeric difference

type ScenarioDiff

type ScenarioDiff struct {
	ScenarioName     string          `json:"scenario_name"`
	BaselineSuccess  bool            `json:"baseline_success"`
	CurrentSuccess   bool            `json:"current_success"`
	StatusChanged    bool            `json:"status_changed"`
	DurationChange   time.Duration   `json:"duration_change_ns"`
	DurationChangeMs int64           `json:"duration_change_ms"`
	MetricsDiff      map[string]Diff `json:"metrics_diff,omitempty"`
}

ScenarioDiff represents the difference between scenario results

type Summary

type Summary struct {
	TotalScenarios  int     `json:"total_scenarios"`
	PassedScenarios int     `json:"passed_scenarios"`
	FailedScenarios int     `json:"failed_scenarios"`
	SuccessRate     float64 `json:"success_rate"`
	TotalErrors     int     `json:"total_errors"`
	TotalWarnings   int     `json:"total_warnings"`
	AllPassed       bool    `json:"all_passed"`
}

Summary provides high-level statistics for the test run

type TestRun

type TestRun struct {
	ID          string                `json:"id"`
	Timestamp   time.Time             `json:"timestamp"`
	Duration    time.Duration         `json:"duration_ns"`
	DurationStr string                `json:"duration"`
	Config      TestRunConfig         `json:"config"`
	Scenarios   []scenarios.Result    `json:"scenarios"`
	Metrics     *client.MetricsReport `json:"metrics,omitempty"`
	Summary     Summary               `json:"summary"`
	Environment map[string]string     `json:"environment,omitempty"`
}

TestRun represents a complete E2E test run

func CreateTestRun

func CreateTestRun(
	config TestRunConfig,
	scenarioResults []scenarios.Result,
	metrics *client.MetricsReport,
	duration time.Duration,
) *TestRun

CreateTestRun creates a new TestRun with computed summary

type TestRunConfig

type TestRunConfig struct {
	Variant    string   `json:"variant"` // "structural", "statistical", or "semantic"
	MLEnabled  bool     `json:"ml_enabled"`
	Scenarios  []string `json:"scenarios"`
	BaseURL    string   `json:"base_url"`
	MetricsURL string   `json:"metrics_url"`
}

TestRunConfig captures the configuration for a test run

type Writer

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

Writer handles persisting test results to disk

func NewWriter

func NewWriter(outputDir string) *Writer

NewWriter creates a new results writer

func (*Writer) GetLatestRun

func (w *Writer) GetLatestRun() (*TestRun, error)

GetLatestRun returns the most recent test run

func (*Writer) ListRuns

func (w *Writer) ListRuns() ([]string, error)

ListRuns returns all result files in the output directory

func (*Writer) LoadRun

func (w *Writer) LoadRun(filepath string) (*TestRun, error)

LoadRun loads a test run from disk

func (*Writer) WriteComparison

func (w *Writer) WriteComparison(comparison *Comparison) (string, error)

WriteComparison writes a comparison report to disk

func (*Writer) WriteLatest

func (w *Writer) WriteLatest(run *TestRun) (string, error)

WriteLatest writes results and also creates/updates a "latest" symlink

func (*Writer) WriteRun

func (w *Writer) WriteRun(run *TestRun) (string, error)

WriteRun writes a complete test run to disk

Jump to

Keyboard shortcuts

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