runtime

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitCode  = "ExitCode"
	Stdout    = "Stdout"
	Stderr    = "Stderr"
	LineCount = "LineCount"
)

Constants for defining the various tested properties

Variables

This section is empty.

Functions

func Start

func Start(tests []TestCase) <-chan TestResult

Start starts the given test suite

Types

type CommandResult

type CommandResult struct {
	Status            ResultStatus
	Stdout            string
	Stderr            string
	ExitCode          int
	FailureProperties []string
	Error             error
}

CommandResult holds the result for a specific test

type CommandUnderTest

type CommandUnderTest struct {
	Cmd     string
	Env     map[string]string
	Dir     string
	Timeout int
}

CommandUnderTest represents the command under test

type Expected

type Expected struct {
	Stdout    ExpectedOut
	Stderr    ExpectedOut
	LineCount int
	ExitCode  int
}

Expected is the expected output of the command under test

type ExpectedOut

type ExpectedOut struct {
	Contains  []string
	Lines     map[int]string
	Exactly   string
	LineCount int
}

type ResultStatus

type ResultStatus int

ResultStatus represents the status code of a test result

const (
	Success ResultStatus = iota
	Failed
	Skipped
)

Result status codes

type TestCase

type TestCase struct {
	Title    string
	Command  CommandUnderTest
	Expected Expected
	Result   CommandResult
}

TestCase represents a test case which will be executed by the runtime

type TestConfig

type TestConfig struct {
	Env     map[string]string
	Dir     string
	Timeout int
}

Config

type TestResult

type TestResult struct {
	TestCase         TestCase
	ValidationResult ValidationResult
	FailedProperty   string
}

CommandResult represents the TestCase and the ValidationResult

func Validate

func Validate(test TestCase) TestResult

Validate validates the test results with the expected values

type ValidationResult

type ValidationResult struct {
	Success bool
	Diff    string
}

ValidationResult will be returned after the validation was executed

Jump to

Keyboard shortcuts

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