testing

package
v0.3.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package testing provides automated test execution for Drover tasks

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

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

Runner executes tests based on configuration

func NewRunner

func NewRunner(config *TestConfig, baseDir string) *Runner

NewRunner creates a new test runner

func (*Runner) Run

func (r *Runner) Run(worktreePath string, taskID string) *TestResult

Run executes tests for a task in the given worktree directory

func (*Runner) SetVerbose

func (r *Runner) SetVerbose(v bool)

SetVerbose enables or disables verbose logging

type TestConfig

type TestConfig struct {
	Mode    TestMode      `json:"mode"`              // How to handle test failures
	Scope   TestScope     `json:"scope"`             // Which tests to run
	Timeout time.Duration `json:"timeout"`           // Maximum time to wait for tests
	Command string        `json:"command,omitempty"` // Custom test command (optional)
}

TestConfig configures automated test execution

func DefaultTestConfig

func DefaultTestConfig() *TestConfig

DefaultTestConfig returns the default test configuration

type TestMode

type TestMode string

TestMode defines how test failures are handled

const (
	// TestModeStrict means test failures block task completion
	TestModeStrict TestMode = "strict"
	// TestModeLenient means test failures are logged but don't block completion
	TestModeLenient TestMode = "lenient"
	// TestModeDisabled means tests are not run
	TestModeDisabled TestMode = "disabled"
)

type TestResult

type TestResult struct {
	Success  bool          `json:"success"`
	Passed   int           `json:"passed"`
	Failed   int           `json:"failed"`
	Skipped  int           `json:"skipped"`
	Total    int           `json:"total"`
	Duration time.Duration `json:"duration"`
	Output   string        `json:"output"`
	Error    string        `json:"error,omitempty"`
	RunTests bool          `json:"run_tests"` // Whether tests were actually run
}

TestResult represents the outcome of running tests

type TestScope

type TestScope string

TestScope defines which tests to run

const (
	// TestScopeAll runs all project tests
	TestScopeAll TestScope = "all"
	// TestScopeDiff runs only tests affected by changed files
	TestScopeDiff TestScope = "diff"
	// TestScopeSkip skips running tests if no changes detected
	TestScopeSkip TestScope = "skip"
)

Jump to

Keyboard shortcuts

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