tests

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package test provides interfaces for running TTCN-3 test cases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPass

func IsPass(e Event) bool

IsPass returns true if the event is an StopEvent with a pass verdict. For all other verdicts or events types IsPass will return false.

Types

type Controller

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

Controller is responsible for running test cases. Essentially you put jobs in and events come out.

func (*Controller) EnqueueJob

func (c *Controller) EnqueueJob(job *Job) error

EnqueueJob puts a job in the queue.

func (*Controller) Events

func (c *Controller) Events() <-chan Event

Events returns a channel that emits events.

func (*Controller) NewController

func (c *Controller) NewController(e Executor) *Controller

NewController creates a new Controller for executing tests using the given executor.

type ErrorEvent

type ErrorEvent struct {
	Err error
	// contains filtered or unexported fields
}

ErrorEvent is an error event.

func NewErrorEvent

func NewErrorEvent(err error) ErrorEvent

NewError wraps an error into an ErrorEvent. It uses time.Now() as the time when the event happened.

func (ErrorEvent) Error

func (e ErrorEvent) Error() string

func (ErrorEvent) Time

func (e ErrorEvent) Time() time.Time

func (ErrorEvent) Unwrap

func (e ErrorEvent) Unwrap() error

type Event

type Event interface {
	Time() time.Time // Time when the event happened.
}

Event provides information regarding test execution.

type Executor

type Executor interface {
	// Execute runs the test job.
	Execute(*Job) <-chan Event
}

type Job

type Job struct {
	// Name is the fully qualified name of the test or control function.
	Name string

	// Args is the list of arguments to pass to the test.
	Args []string

	// Timeout is the duration after which the job will be stopped.
	Timeout time.Duration

	// Module Parameters
	ModulePars map[string]string

	// Env specifies the environment variables to pass to the job.
	Env []string

	// Config provides the project configuration
	*project.Config
}

Job describes the test or control function to be executed.

func UnwrapJob

func UnwrapJob(e Event) *Job

UnwrapJob returns the job that caused the event or nil if no such job is available.

type JobError

type JobError struct {
	*Job
	Err error
}

JobError describes an error that occurred during the execution of a test or control function.

func (*JobError) Error

func (e *JobError) Error() string

func (*JobError) Unwrap

func (e *JobError) Unwrap() error

type StartEvent

type StartEvent struct {
	Name string

	*Job
	// contains filtered or unexported fields
}

StartEvent is an event that is emitted when the test is started.

func NewStartEvent

func NewStartEvent(job *Job, name string) StartEvent

NewStartEvent creates a new StartEvent.

func (StartEvent) Time

func (e StartEvent) Time() time.Time

type StopEvent

type StopEvent struct {
	Name    string
	Verdict string

	*Job
	// contains filtered or unexported fields
}

StopEvent is an event that is emitted when the test is stopped.

func NewStopEvent

func NewStopEvent(job *Job, name string, verdict string) StopEvent

NewStopEvent creates a new StopEvent.

func (StopEvent) Time

func (e StopEvent) Time() time.Time

type TickerEvent

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

TickerEvent is an event that is emitted periodically during the test execution.

func NewTickerEvent

func NewTickerEvent() TickerEvent

NewTickerEvent creates a new TickerEvent.

func (TickerEvent) Time

func (e TickerEvent) Time() time.Time

Jump to

Keyboard shortcuts

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