Documentation ΒΆ
Index ΒΆ
- Variables
- func BoolVarFromCtx(ctx context.Context, varname string) bool
- func Debug(ctx context.Context, format string, args ...interface{})
- func Dump(va interface{}) (map[string]interface{}, error)
- func DumpString(va interface{}) (map[string]string, error)
- func DumpStringPreserveCase(va interface{}) (map[string]string, error)
- func DumpWithPrefix(va interface{}, prefix string) (map[string]interface{}, error)
- func Error(ctx context.Context, format string, args ...interface{})
- func Fatal(ctx context.Context, format string, args ...interface{})
- func GetExecutorResult(r interface{}) map[string]interface{}
- func Info(ctx context.Context, format string, args ...interface{})
- func InitTestLogger(t *testing.T)
- func IntVarFromCtx(ctx context.Context, varname string) int
- func JSONUnmarshal(btes []byte, i interface{}) error
- func OSExit(exitCode int)
- func RemoveNotPrintableChar(in string) string
- func StringMapInterfaceVarFromCtx(ctx context.Context, varname string) map[string]interface{}
- func StringMapStringVarFromCtx(ctx context.Context, varname string) map[string]string
- func StringSliceVarFromCtx(ctx context.Context, varname string) []string
- func StringVarFromCtx(ctx context.Context, varname string) string
- func VarFromCtx(ctx context.Context, varname string) interface{}
- func Warn(ctx context.Context, format string, args ...interface{})
- func Warning(ctx context.Context, format string, args ...interface{})
- func WithFormatterLowerFirstKey() dump.KeyFormatterFunc
- type Assertion
- type AssertionApplied
- type AssertionsApplied
- type AssignStep
- type Assignment
- type ContextKey
- type Executor
- type ExecutorRunner
- type ExecutorWithSetup
- type Failure
- type FailureXML
- type H
- type InnerResult
- type Range
- type RangeData
- type Skipped
- type Status
- type StepAssertions
- type TestCase
- type TestCaseInput
- type TestCaseXML
- type TestStep
- type TestStepResult
- type TestSuite
- type TestSuiteInput
- type TestSuiteXML
- type Tests
- type TestsHTML
- type TestsXML
- type UserExecutor
- type Venom
- func (v *Venom) AddVariables(variables map[string]interface{})
- func (v *Venom) GetExecutorRunner(ctx context.Context, ts TestStep, h H) (context.Context, ExecutorRunner, error)
- func (v *Venom) InitLogger() error
- func (v *Venom) OutputResult() error
- func (v *Venom) Parse(ctx context.Context, path []string) error
- func (v *Venom) Print(format string, a ...interface{})
- func (v *Venom) Println(format string, a ...interface{})
- func (v *Venom) PrintlnIndentedTrace(s string, indent string)
- func (v *Venom) PrintlnTrace(s string)
- func (v *Venom) Process(ctx context.Context, path []string) error
- func (v *Venom) RegisterExecutorBuiltin(name string, e Executor)
- func (v *Venom) RegisterExecutorPlugin(name string, e Executor)
- func (v *Venom) RegisterExecutorUser(name string, e Executor)
- func (v *Venom) RunTestStep(ctx context.Context, e ExecutorRunner, tc *TestCase, tsResult *TestStepResult, ...)
- func (v *Venom) RunUserExecutor(ctx context.Context, runner ExecutorRunner, tcIn *TestCase, ...) (interface{}, error)
Constants ΒΆ
This section is empty.
Variables ΒΆ
var ( //Version is set with -ldflags "-X github.com/ovh/venom/venom.Version=$(VERSION)" Version = "snapshot" IsTest = "" )
var Cyan = color.New(color.FgCyan).SprintFunc()
var Gray = color.New(color.Attribute(90)).SprintFunc()
var Green = color.New(color.FgGreen).SprintFunc()
var Red = color.New(color.FgRed).SprintFunc()
var Yellow = color.New(color.FgYellow).SprintFunc()
Functions ΒΆ
func BoolVarFromCtx ΒΆ added in v1.0.0
func DumpString ΒΆ added in v1.0.0
DumpString dumps v as a map[string]string{}, key in lowercase
func DumpStringPreserveCase ΒΆ added in v1.0.0
DumpStringPreserveCase dumps v as a map[string]string{}
func DumpWithPrefix ΒΆ added in v1.1.0
Dump dumps v as a map[string]interface{}.
func GetExecutorResult ΒΆ added in v1.0.0
func GetExecutorResult(r interface{}) map[string]interface{}
func InitTestLogger ΒΆ added in v1.0.0
func JSONUnmarshal ΒΆ added in v1.0.0
func RemoveNotPrintableChar ΒΆ added in v0.16.0
RemoveNotPrintableChar removes not printable character from a string
func StringMapInterfaceVarFromCtx ΒΆ added in v1.0.0
func StringMapStringVarFromCtx ΒΆ added in v1.0.0
func StringSliceVarFromCtx ΒΆ added in v1.0.0
func StringVarFromCtx ΒΆ added in v1.0.0
func VarFromCtx ΒΆ added in v1.0.0
func WithFormatterLowerFirstKey ΒΆ added in v1.1.0
func WithFormatterLowerFirstKey() dump.KeyFormatterFunc
Types ΒΆ
type Assertion ΒΆ added in v1.1.0
type Assertion interface{}
Assertion (usually a string, but could be a dictionary when using logical operators)
type AssertionApplied ΒΆ added in v1.1.0
type AssertionsApplied ΒΆ added in v1.1.0
type AssertionsApplied struct { OK bool `json:"ok" yml:"-"` Assertions []AssertionApplied `json:"assertions" yml:"-"` // contains filtered or unexported fields }
type AssignStep ΒΆ added in v0.27.0
type AssignStep struct {
Assignments map[string]Assignment `json:"vars" yaml:"vars" mapstructure:"vars"`
}
type Assignment ΒΆ added in v0.27.0
type ContextKey ΒΆ
type ContextKey string
ContextKey can be added in context to store contextual infos. Also used by logger.
type Executor ΒΆ
type Executor interface { // Run run a Test Step Run(context.Context, TestStep) (interface{}, error) }
Executor execute a testStep.
type ExecutorRunner ΒΆ added in v1.0.0
type ExecutorWithSetup ΒΆ added in v1.0.0
type Failure ΒΆ
type Failure struct { TestcaseClassname string `xml:"-" json:"-" yaml:"-"` TestcaseName string `xml:"-" json:"-" yaml:"-"` TestcaseLineNumber int `xml:"-" json:"-" yaml:"-"` StepNumber int `xml:"-" json:"-" yaml:"-"` Assertion string `xml:"-" json:"-" yaml:"-"` AssertionRequired bool `xml:"-" json:"-" yaml:"-"` Error error `xml:"-" json:"-" yaml:"-"` Value string `json:"value" yaml:"value,omitempty"` }
Failure contains data related to a failed test.
type FailureXML ΒΆ added in v1.1.0
type H ΒΆ added in v0.27.0
type H map[string]interface{}
func AllVarsFromCtx ΒΆ added in v1.0.0
func (*H) AddAllWithPrefix ΒΆ added in v0.27.0
func (*H) AddWithPrefix ΒΆ added in v0.27.0
type InnerResult ΒΆ
type InnerResult struct {
Value string `xml:",cdata" json:"value" yaml:"value"`
}
InnerResult is used by TestCase
type RangeData ΒΆ added in v1.1.0
type RangeData struct { Key string Value interface{} }
RangeData contains a single iterable user value
type Skipped ΒΆ added in v0.16.0
type Skipped struct {
Value string `xml:",cdata" json:"value" yaml:"value,omitempty"`
}
Skipped contains data related to a skipped test.
type StepAssertions ΒΆ
type StepAssertions struct {
Assertions []Assertion `json:"assertions,omitempty" yaml:"assertions,omitempty"`
}
StepAssertions contains step assertions
type TestCase ΒΆ
type TestCase struct { TestCaseInput Skipped []Skipped `json:"skipped" yaml:"-"` Status Status `json:"status" yaml:"-"` Duration float64 `json:"duration" yaml:"-"` Start time.Time `json:"start" yaml:"-"` End time.Time `json:"end" yaml:"-"` TestStepResults []TestStepResult `json:"results" yaml:"-"` TestSuiteVars H `json:"-" yaml:"-"` IsExecutor bool `json:"-" yaml:"-"` IsEvaluated bool `json:"-" yaml:"-"` // contains filtered or unexported fields }
type TestCaseInput ΒΆ added in v1.1.0
type TestCaseInput struct { Name string `json:"name" yaml:"name"` Vars H `json:"vars" yaml:"vars"` Skip []string `json:"skip" yaml:"skip"` RawTestSteps []json.RawMessage `json:"steps" yaml:"steps"` }
type TestCaseXML ΒΆ added in v1.1.0
type TestCaseXML struct { XMLName xml.Name `xml:"testcase" json:"-" yaml:"-"` Classname string `xml:"classname,attr,omitempty" json:"classname" yaml:"-"` Errors []FailureXML `xml:"error,omitempty" json:"errors" yaml:"errors,omitempty"` Failures []FailureXML `xml:"failure,omitempty" json:"failures" yaml:"failures,omitempty"` Name string `xml:"name,attr" json:"name" yaml:"name"` Skipped []Skipped `xml:"skipped,omitempty" json:"skipped" yaml:"skipped,omitempty"` Systemout InnerResult `xml:"system-out,omitempty" json:"systemout" yaml:"systemout,omitempty"` Systemerr InnerResult `xml:"system-err,omitempty" json:"systemerr" yaml:"systemerr,omitempty"` Time float64 `xml:"time,attr,omitempty" json:"time" yaml:"time,omitempty"` }
TestCase is a single test case with its result.
type TestStep ΒΆ
type TestStep map[string]interface{}
TestStep represents a testStep
func (TestStep) StringSliceValue ΒΆ added in v1.0.0
type TestStepResult ΒΆ added in v1.1.0
type TestStepResult struct { Name string `json:"name"` Errors []Failure `json:"errors"` Skipped []Skipped `json:"skipped" yaml:"skipped"` Status Status `json:"status" yaml:"status"` Raw interface{} `json:"raw" yaml:"raw"` Interpolated interface{} `json:"interpolated" yaml:"interpolated"` Number int `json:"number" yaml:"number"` RangedIndex int `json:"rangedIndex" yaml:"rangedIndex"` RangedEnable bool `json:"rangedEnable" yaml:"rangedEnable"` InputVars map[string]string `json:"inputVars" yaml:"-"` ComputedVars H `json:"computedVars" yaml:"-"` ComputedInfo []string `json:"computedInfos" yaml:"-"` AssertionsApplied AssertionsApplied `json:"assertionsApplied" yaml:"-"` Retries int `json:"retries" yaml:"retries"` Systemout string `json:"systemout"` Systemerr string `json:"systemerr"` Duration float64 `json:"duration"` Start time.Time `json:"start"` End time.Time `json:"end"` }
type TestSuite ΒΆ
type TestSuite struct { Name string `json:"name" yaml:"name"` TestCases []TestCase `json:"testcases" yaml:"testcases"` Vars H `json:"vars" yaml:"vars"` // computed ShortName string `json:"shortname" yaml:"-"` Filename string `json:"filename" yaml:"-"` Filepath string `json:"filepath" yaml:"-"` ComputedVars H `json:"computed_vars" yaml:"-"` WorkDir string `json:"workdir" yaml:"_"` Status Status `json:"status" yaml:"status"` Duration float64 `json:"duration" yaml:"-"` Start time.Time `json:"start" yaml:"-"` End time.Time `json:"end" yaml:"-"` NbTestcasesFail int `json:"nbTestcasesFail" yaml:"-"` NbTestcasesPass int `json:"nbTestcasesPass" yaml:"-"` NbTestcasesSkip int `json:"nbTestcasesSkip" yaml:"-"` }
type TestSuiteInput ΒΆ added in v1.1.0
type TestSuiteInput struct { Name string `json:"name" yaml:"name"` TestCases []TestCaseInput `json:"testcases" yaml:"testcases"` Vars H `json:"vars" yaml:"vars"` }
type TestSuiteXML ΒΆ added in v1.1.0
type TestSuiteXML struct { XMLName xml.Name `xml:"testsuite" json:"-" yaml:"-"` Disabled int `xml:"disabled,attr,omitempty" json:"disabled" yaml:""` Errors int `xml:"errors,attr,omitempty" json:"errors" yaml:"-"` Failures int `xml:"failures,attr,omitempty" json:"failures" yaml:"-"` Hostname string `xml:"hostname,attr,omitempty" json:"hostname" yaml:"-"` ID string `xml:"id,attr,omitempty" json:"id" yaml:"-"` Name string `xml:"name,attr" json:"name" yaml:"name"` Package string `xml:"package,attr,omitempty" json:"package" yaml:"-"` Skipped int `xml:"skipped,attr,omitempty" json:"skipped" yaml:"skipped,omitempty"` Total int `xml:"tests,attr" json:"total" yaml:"total,omitempty"` TestCases []TestCaseXML `xml:"testcase" json:"testcases" yaml:"testcases"` Version string `xml:"version,omitempty" json:"version" yaml:"version,omitempty"` Time string `xml:"time,attr,omitempty" json:"time" yaml:"-"` Timestamp string `xml:"timestamp,attr,omitempty" json:"timestamp" yaml:"-"` }
TestSuite is a single JUnit test suite which may contain many testcases.
type Tests ΒΆ
type Tests struct { TestSuites []TestSuite `json:"test_suites" yml:"tests_suites"` Status Status `json:"status" yml:"status"` NbTestsuitesFail int `json:"nbTestsuitesFail" yaml:"-"` NbTestsuitesPass int `json:"nbTestsuitesPass" yaml:"-"` NbTestsuitesSkip int `json:"nbTestsuitesSkip" yaml:"-"` Duration float64 `json:"duration" yaml:"-"` Start time.Time `json:"start" yaml:"-"` End time.Time `json:"end" yaml:"-"` }
type TestsXML ΒΆ added in v1.1.0
type TestsXML struct { XMLName xml.Name `xml:"testsuites" json:"-" yaml:"-"` TestSuites []TestSuiteXML `xml:"testsuite" json:"test_suites"` }
type UserExecutor ΒΆ added in v1.0.0
type UserExecutor struct { Executor string `json:"executor" yaml:"executor"` Input H `json:"input" yaml:"input"` RawTestSteps []json.RawMessage `json:"steps" yaml:"steps"` Output json.RawMessage `json:"output" yaml:"output"` Filename string `json:"-" yaml:"-"` }
func (UserExecutor) Run ΒΆ added in v1.0.0
func (ux UserExecutor) Run(ctx context.Context, step TestStep) (interface{}, error)
Run is not implemented on user executor
func (UserExecutor) ZeroValueResult ΒΆ added in v1.0.0
func (ux UserExecutor) ZeroValueResult() interface{}
type Venom ΒΆ added in v0.17.0
type Venom struct { LogOutput io.Writer PrintFunc func(format string, a ...interface{}) (n int, err error) Tests Tests LibDir string OutputFormat string OutputDir string StopOnFailure bool HtmlReport bool Verbose int // contains filtered or unexported fields }
func (*Venom) AddVariables ΒΆ added in v0.17.0
func (*Venom) GetExecutorRunner ΒΆ added in v1.0.0
func (v *Venom) GetExecutorRunner(ctx context.Context, ts TestStep, h H) (context.Context, ExecutorRunner, error)
GetExecutorRunner initializes a test by name no type -> exec is default
func (*Venom) InitLogger ΒΆ added in v1.0.0
InitLogger initializes venom logger
func (*Venom) OutputResult ΒΆ added in v0.17.0
OutputResult output result to sdtout, files...
func (*Venom) PrintlnIndentedTrace ΒΆ added in v1.1.0
func (*Venom) PrintlnTrace ΒΆ added in v1.0.0
func (*Venom) RegisterExecutorBuiltin ΒΆ added in v1.0.0
RegisterExecutorBuiltin register builtin executors
func (*Venom) RegisterExecutorPlugin ΒΆ added in v1.0.0
RegisterExecutorPlugin register plugin executors
func (*Venom) RegisterExecutorUser ΒΆ added in v1.0.0
RegisterExecutorUser register User sxecutors
func (*Venom) RunTestStep ΒΆ added in v0.17.0
func (v *Venom) RunTestStep(ctx context.Context, e ExecutorRunner, tc *TestCase, tsResult *TestStepResult, stepNumber int, rangedIndex int, step TestStep)
RunTestStep executes a venom testcase is a venom context
func (*Venom) RunUserExecutor ΒΆ added in v1.0.0
func (v *Venom) RunUserExecutor(ctx context.Context, runner ExecutorRunner, tcIn *TestCase, tsIn *TestStepResult, step TestStep) (interface{}, error)