Documentation ¶
Index ¶
- Constants
- Variables
- func Exit(format string, args ...interface{})
- func OutputResult(format string, resume, resumeFailures bool, outputDir string, tests Tests, ...) error
- func RegisterExecutor(name string, e Executor)
- func RegisterTestCaseContext(name string, tcc TestCaseContext)
- func ShouldContainSubstring(actual interface{}, expected ...interface{}) string
- type Aliases
- type CommonTestCaseContext
- type Executor
- type ExecutorResult
- type ExecutorWrap
- type Failure
- type InnerResult
- type Logger
- type Property
- type StepAssertions
- type StepExtracts
- type Templater
- type TestCase
- type TestCaseContext
- type TestStep
- type TestSuite
- type Tests
Constants ¶
const ( // DetailsLow prints only summary results DetailsLow = "low" // DetailsMedium prints progress bar and summary DetailsMedium = "medium" // DetailsHigh prints progress bar and details DetailsHigh = "high" )
const ( // ContextKey is key for Test Case Context. this // can be used by executors for getting context ContextKey = "tcContext" )
const Version = "0.14.0"
Version of Venom One Line for this, used by release.sh script Keep "const Version on one line"
Variables ¶
var PrintFunc = fmt.Printf
PrintFunc used by venom to print output
Functions ¶
func Exit ¶
func Exit(format string, args ...interface{})
Exit func display an error message on stderr and exit 1
func OutputResult ¶
func OutputResult(format string, resume, resumeFailures bool, outputDir string, tests Tests, elapsed time.Duration, detailsLevel string) error
OutputResult output result to sdtout, files...
func RegisterExecutor ¶
RegisterExecutor register Test Executors
func RegisterTestCaseContext ¶
func RegisterTestCaseContext(name string, tcc TestCaseContext)
RegisterTestCaseContext new register TestCaseContext
func ShouldContainSubstring ¶ added in v0.0.4
func ShouldContainSubstring(actual interface{}, expected ...interface{}) string
ShouldContainSubstring receives exactly more than 2 string parameters and ensures that the first contains the second as a substring.
Types ¶
type CommonTestCaseContext ¶
type CommonTestCaseContext struct { TestCaseContext TestCase TestCase Name string }
CommonTestCaseContext represents a Default TestCase Context
func (*CommonTestCaseContext) GetName ¶
func (t *CommonTestCaseContext) GetName() string
GetName Get the context name
func (*CommonTestCaseContext) SetTestCase ¶
func (t *CommonTestCaseContext) SetTestCase(tc TestCase)
SetTestCase set testcase in context
type Executor ¶
type Executor interface { // Run run a Test Step Run(TestCaseContext, Logger, TestStep) (ExecutorResult, error) }
Executor execute a testStep.
type ExecutorResult ¶
ExecutorResult represents an executor result on a test step
func RunTestStep ¶ added in v0.0.7
func RunTestStep(tcc TestCaseContext, e *ExecutorWrap, ts *TestSuite, tc *TestCase, step TestStep, templater *Templater, l Logger, detailsLevel string) ExecutorResult
RunTestStep executes a venom testcase is a venom context
type ExecutorWrap ¶ added in v0.0.7
type ExecutorWrap struct {
// contains filtered or unexported fields
}
ExecutorWrap contains an executor implementation and some attributes
func WrapExecutor ¶ added in v0.0.7
func WrapExecutor(t map[string]interface{}, tcc TestCaseContext) (*ExecutorWrap, error)
WrapExecutor initializes a test by name no type -> exec is default
type Failure ¶
type Failure struct { Value string `xml:",cdata" json:"value" yaml:"value,omitempty"` Type string `xml:"type,attr,omitempty" json:"type" yaml:"type,omitempty"` Message string `xml:"message,attr,omitempty" json:"message" yaml:"message,omitempty"` }
Failure contains data related to a failed test.
type InnerResult ¶
type InnerResult struct {
Value string `xml:",cdata" json:"value" yaml:"value"`
}
InnerResult is used by TestCase
type Logger ¶ added in v0.0.7
type Logger interface { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warnf(format string, args ...interface{}) Warningf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) }
Logger is basicaly an interface for logrus.Entry
type Property ¶
type Property struct { XMLName xml.Name `xml:"property" json:"-" yaml:"-"` Name string `xml:"name,attr" json:"name" yaml:"-"` Value string `xml:"value,attr" json:"value" yaml:"-"` }
Property represents a key/value pair used to define properties.
type StepAssertions ¶
type StepAssertions struct {
Assertions []string `json:"assertions,omitempty" yaml:"assertions,omitempty"`
}
StepAssertions contains step assertions
type StepExtracts ¶
type StepExtracts struct {
Extracts map[string]string `json:"extracts,omitempty" yaml:"extracts,omitempty"`
}
StepExtracts contains "step extracts"
type Templater ¶
Templater contains templating values on a testsuite
func (*Templater) ApplyOnContext ¶ added in v0.10.0
ApplyOnContext executes the template on a context
type TestCase ¶
type TestCase struct { XMLName xml.Name `xml:"testcase" json:"-" yaml:"-"` Assertions string `xml:"assertions,attr,omitempty" json:"assertions" yaml:"-"` Classname string `xml:"classname,attr,omitempty" json:"classname" yaml:"-"` Errors []Failure `xml:"error,omitempty" json:"errors" yaml:"errors,omitempty"` Failures []Failure `xml:"failure,omitempty" json:"failures" yaml:"failures,omitempty"` Name string `xml:"name,attr" json:"name" yaml:"name"` Skipped int `xml:"skipped,attr,omitempty" json:"skipped" yaml:"skipped,omitempty"` Status string `xml:"status,attr,omitempty" json:"status" yaml:"status,omitempty"` Systemout InnerResult `xml:"system-out,omitempty" json:"systemout" yaml:"systemout,omitempty"` Systemerr InnerResult `xml:"system-err,omitempty" json:"systemerr" yaml:"systemerr,omitempty"` Time string `xml:"time,attr,omitempty" json:"time" yaml:"time,omitempty"` TestSteps []TestStep `xml:"-" json:"steps" yaml:"steps"` Context map[string]interface{} `xml:"-" json:"-" yaml:"context,omitempty"` }
TestCase is a single test case with its result.
type TestCaseContext ¶
type TestCaseContext interface { Init() error Close() error SetTestCase(tc TestCase) GetName() string }
TestCaseContext represents the context of a testcase
func ContextWrap ¶ added in v0.0.7
func ContextWrap(tc *TestCase) (TestCaseContext, error)
ContextWrap initializes a context for a testcase no type -> parent context
type TestSuite ¶
type TestSuite 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:"-"` Properties []Property `xml:"-" json:"properties" yaml:"-"` Skipped int `xml:"skipped,attr,omitempty" json:"skipped" yaml:"skipped,omitempty"` Total int `xml:"tests,attr" json:"total" yaml:"total,omitempty"` TestCases []TestCase `xml:"testcase" json:"tests" yaml:"testcases"` Time string `xml:"time,attr,omitempty" json:"time" yaml:"-"` Timestamp string `xml:"timestamp,attr,omitempty" json:"timestamp" yaml:"-"` Vars map[string]interface{} `xml:"-" json:"-" yaml:"vars"` Templater *Templater `xml:"-" json:"-" yaml:"-"` }
TestSuite is a single JUnit test suite which may contain many testcases.
type Tests ¶
type Tests struct { XMLName xml.Name `xml:"testsuites" json:"-" yaml:"-"` Total int `xml:"-" json:"total"` TotalOK int `xml:"-" json:"ok"` TotalKO int `xml:"-" json:"ko"` TotalSkipped int `xml:"-" json:"skipped"` TestSuites []TestSuite `xml:"testsuite" json:"test_suites"` }
Tests contains all informations about tests in a pipeline build