clitest

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: BSD-3-Clause Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncTestCommand added in v1.2.0

type AsyncTestCommand interface {
	// Run starts the wrapped command on a new goroutine and waits for it to finish.
	// The goroutine will finish if the process comes to a stop, or the Stop() method
	// is called
	Run()
	// AssertStillRunning checks for the command to still be running.
	AssertStillRunning()
	// Stop signals the command to stop and waits for it to finish.
	Stop()
	// AssertStoppedRunning checks for the command to have finished.
	AssertStoppedRunning()
	// AssertSuccess checks for the command to have finished and asserts success.
	AssertSuccess()
	// AssertFailure checks for the command to have finished and asserts failure.
	AssertFailure()
	// Successful returns true if the command dos not have an error.
	Successful() bool
	// Failed returns true if the command dos not have an error.
	Failed() bool
	// GetOutput returns the stdout and stderr of the command.
	GetOutput() string
	// PrintOutput prints the output of the command to standard output.
	PrintOutput()
	// Error returns the error for the command if one exists.
	Error() error
}

AsyncTestCommand defines the behaviour of a long running command.

func NewAsyncCommand added in v1.2.0

func NewAsyncCommand(name string, args ...string) AsyncTestCommand

NewAsyncCommand returns an instance of an AsyncTestCommand

type LoginCommand added in v1.2.0

type LoginCommand interface {
	TestCommand
	LoginAndAssertSuccess(username, password string)
	LoginAndAssertFailure(username, password string)
	WithCredentials(username, password string) LoginCommand
}

LoginCommand adds login behaviour to a TestCommand.

func NewLoginCommand added in v1.2.0

func NewLoginCommand(name string, args ...string) LoginCommand

NewLoginCommand creates a LoginCommand

type TestCommand added in v1.2.0

type TestCommand interface {
	// Run executes the command without checking its result.
	Run()
	// RunAndAssertSuccess executes the wrapped command and expects a successful execution.
	RunAndAssertSuccess()
	// RunAndAssertFailure executes the wrapped command and expects a failed execution.
	RunAndAssertFailure()
	// Successful returns true if the command dos not have an error.
	Successful() bool
	// Failed returns true if the command dos not have an error.
	Failed() bool
	// GetOutput returns the stdout and stderr of the command.
	GetOutput() string
	// PrintOutput prints the output of the command to standard output.
	PrintOutput()
	// Error returns the error for the command if one exists.
	Error() error
}

TestCommand defines the behaviour for a synchronous OS wrapper.

func NewCommand added in v1.2.0

func NewCommand(name string, args ...string) TestCommand

NewCommand returns an instance of a TestCommand

Jump to

Keyboard shortcuts

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