exec

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2018 License: BSD-3-Clause Imports: 15 Imported by: 5

README

Venom - Executor Exec

Step for execute a script

Input

Example


name: Title of TestSuite
testcases:
- name: Check if exit code != 1 and echo command response in less than 1s
  steps:
  - script: echo 'foo'
    assertions:
    - result.code ShouldEqual 0
    - result.timeseconds ShouldBeLessThan 1

Multiline script:

name: Title of TestSuite
testcases:
- name: multiline script
  steps:
  - script: |
            echo "Foo" \
            echo "Bar"

Output

executor
systemout
systemerr
err
code
timeseconds
timehuman
  • result.timeseconds & result.timehuman: time of execution
  • result.executor.executor.script: script executed
  • result.err: if exists, this field contains error
  • result.systemout: Standard Output of executed script
  • result.systemerr: Error Output of executed script
  • result.code: Exit Code

Default assertion

result.code ShouldEqual 0

Documentation

Index

Constants

View Source
const Name = "exec"

Name for test exec

Variables

This section is empty.

Functions

func New

func New() venom.Executor

New returns a new Test Exec

Types

type Executor

type Executor struct {
	Script string `json:"script,omitempty" yaml:"script,omitempty"`
}

Executor represents a Test Exec

func (Executor) GetDefaultAssertions

func (Executor) GetDefaultAssertions() *venom.StepAssertions

GetDefaultAssertions return default assertions for type exec

func (Executor) Run

func (Executor) Run(testCaseContext venom.TestCaseContext, l venom.Logger, step venom.TestStep, workdir string) (venom.ExecutorResult, error)

Run execute TestStep of type exec

func (Executor) ZeroValueResult added in v0.17.0

func (Executor) ZeroValueResult() venom.ExecutorResult

ZeroValueResult return an empty implemtation of this executor result

type Result

type Result struct {
	Executor      Executor    `json:"executor,omitempty" yaml:"executor,omitempty"`
	Systemout     string      `json:"systemout,omitempty" yaml:"systemout,omitempty"`
	SystemoutJSON interface{} `json:"systemoutjson,omitempty" yaml:"systemoutjson,omitempty"`
	Systemerr     string      `json:"systemerr,omitempty" yaml:"systemerr,omitempty"`
	SystemerrJSON interface{} `json:"systemerrjson,omitempty" yaml:"systemerrjson,omitempty"`
	Err           string      `json:"err,omitempty" yaml:"err,omitempty"`
	Code          string      `json:"code,omitempty" yaml:"code,omitempty"`
	TimeSeconds   float64     `json:"timeseconds,omitempty" yaml:"timeseconds,omitempty"`
	TimeHuman     string      `json:"timehuman,omitempty" yaml:"timehuman,omitempty"`
}

Result represents a step result

Jump to

Keyboard shortcuts

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