core

package
v0.0.0-...-516eae0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package core contains fundamental things related to tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteTests

func ExecuteTests(tests Tests, progressReadInterval time.Duration, executor TestExecutor)

ExecuteTests executes all test and calls callbacks

Types

type ProgressState

type ProgressState int
const (
	ProgressStart ProgressState = iota
	ProgressDoing
	ProgressDone
)

type Test

type Test interface {
	// Name returns uniq name of the test
	Name() string

	// Start starts execution of the test
	Start()

	// Done returns true only if test execution ended
	Done() bool

	// Progress returns current progress of test execution in range [0,1]
	Progress() float64
}

Test represents test that can be executed

type TestExecutor

type TestExecutor interface {
	// OnExecutionStart called before execution is started
	OnExecutionStart(count int)

	// OnExecutionEnd called after execution is ended
	OnExecutionEnd(duration time.Duration)

	// OnTestStart called before test is started
	OnTestStart(name string, index int)

	// OnTestProgress called every time progress updates
	OnTestProgress(progress float64, state ProgressState)

	// OnTestEnd called after test is ended
	OnTestEnd(duration time.Duration)
}

TestExecutor represents handler of test execution

type Tests

type Tests []Test

Tests represents slice of tests

Jump to

Keyboard shortcuts

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