Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestCaseHarness ¶
type TestCaseHarness struct { // Logger is to be used for all logs generated from the test function. Logger *logger.Logger // Executable is the program to be tested. Executable *executable.Executable // contains filtered or unexported fields }
TestCaseHarness is passed to your TestCase's TestFunc.
If the program is a long-lived program that must be alive during the duration of the test (like a Redis server), do something like this at the start of your test function:
if err := harness.Executable.Start(); err != nil { return err } harness.RegisterTeardownFunc(func() { harness.Executable.Kill() })
If the program is a script that must be executed and then checked for output (like a Git command), use it like this:
result, err := harness.Executable.Run("cat-file", "-p", "sha") if err != nil { return err }
func (*TestCaseHarness) NewExecutable ¶
func (s *TestCaseHarness) NewExecutable() *executable.Executable
func (*TestCaseHarness) RegisterTeardownFunc ¶
func (s *TestCaseHarness) RegisterTeardownFunc(teardownFunc func())
func (*TestCaseHarness) RunTeardownFuncs ¶
func (s *TestCaseHarness) RunTeardownFuncs()
Click to show internal directories.
Click to hide internal directories.