venom: Index | Files | Directories

package venom

import ""


Package Files

assertion.go extract.go process.go process_files.go process_testcase.go process_teststep.go process_testsuite.go templater.go types.go venom.go venom_output.go


const (
    // DetailsLow prints only summary results
    DetailsLow = "low"
    // DetailsMedium summary with lines in failure
    DetailsMedium = "medium"
    // DetailsHigh all
    DetailsHigh = "high"


var (
    //Version is set with -ldflags "-X$(VERSION)"
    Version = "snapshot"

func RemoveNotPrintableChar Uses

func RemoveNotPrintableChar(in string) string

RemoveNotPrintableChar removes not printable chararacter from a string

type Aliases Uses

type Aliases map[string]string

Aliases contains list of aliases

type AssignStep Uses

type AssignStep struct {
    Assignments map[string]Assignment `json:"vars" yaml:"vars" mapstructure:"vars"`

type Assignment Uses

type Assignment struct {
    From  string `json:"from" yaml:"from"`
    Regex string `json:"regex" yaml:"regex"`

type CommonTestCaseContext Uses

type CommonTestCaseContext struct {
    TestCase TestCase
    Name     string

CommonTestCaseContext represents a Default TestCase Context

func (*CommonTestCaseContext) GetName Uses

func (tcc *CommonTestCaseContext) GetName() string

GetName Get the context name

func (*CommonTestCaseContext) SetTestCase Uses

func (tcc *CommonTestCaseContext) SetTestCase(tc TestCase)

SetTestCase set testcase in context

type Executor Uses

type Executor interface {
    // Run run a Test Step
    Run(TestCaseContext, Logger, TestStep, string) (ExecutorResult, error)

Executor execute a testStep.

type ExecutorResult Uses

type ExecutorResult map[string]interface{}

ExecutorResult represents an executor result on a test step

type ExecutorWrap Uses

type ExecutorWrap struct {
    // contains filtered or unexported fields

ExecutorWrap contains an executor implementation and some attributes

type Failure Uses

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:"-"`
    Error              error  `xml:"-" json:"-" yaml:"-"`

    Value   string         `xml:",cdata" json:"value" yaml:"value,omitempty"`
    Result  ExecutorResult `xml:"-" json:"-" yaml:"-"`
    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 H Uses

type H map[string]string

func ProcessVariableAssigments Uses

func ProcessVariableAssigments(tcName string, tcVars H, stepIn TestStep, l Logger) (H, bool, error)

func (*H) Add Uses

func (h *H) Add(k, v string)

func (*H) AddAll Uses

func (h *H) AddAll(h2 H)

func (*H) AddAllWithPrefix Uses

func (h *H) AddAllWithPrefix(p string, h2 H)

func (*H) AddWithPrefix Uses

func (h *H) AddWithPrefix(p, k, v string)

func (H) Clone Uses

func (h H) Clone() H

func (H) Get Uses

func (h H) Get(k string) string

type InnerResult Uses

type InnerResult struct {
    Value string `xml:",cdata" json:"value" yaml:"value"`

InnerResult is used by TestCase

type Logger Uses

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 basically an interface for logrus.Entry

type Property Uses

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 Skipped Uses

type Skipped struct {
    Value string `xml:",cdata" json:"value" yaml:"value,omitempty"`

Skipped contains data related to a skipped test.

type StepAssertions Uses

type StepAssertions struct {
    Assertions []string `json:"assertions,omitempty" yaml:"assertions,omitempty"`

StepAssertions contains step assertions

type StepExtracts Uses

type StepExtracts struct {
    Extracts map[string]string `json:"extracts,omitempty" yaml:"extracts,omitempty"`

StepExtracts contains "step extracts"

type Templater Uses

type Templater struct {
    Values map[string]string

Templater contains templating values on a testsuite

func (*Templater) Add Uses

func (tmpl *Templater) Add(prefix string, values map[string]string)

Add add data to templater

func (*Templater) ApplyOnMap Uses

func (tmpl *Templater) ApplyOnMap(mapStringInterface map[string]interface{}) (bool, map[string]interface{}, error)

ApplyOnMap executes the template on a context return true if there is an variable replaced

func (*Templater) ApplyOnStep Uses

func (tmpl *Templater) ApplyOnStep(stepNumber int, step TestStep) (TestStep, error)

ApplyOnStep executes the template on a test step

type TestCase Uses

type TestCase struct {
    XMLName   xml.Name               `xml:"testcase" json:"-" 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   []Skipped              `xml:"skipped,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:"-" hcl:"step" json:"steps" yaml:"steps"`
    Context   map[string]interface{} `xml:"-" json:"-" yaml:"context,omitempty"`

TestCase is a single test case with its result.

type TestCaseContext Uses

type TestCaseContext interface {
    Init() error
    Close() error
    SetTestCase(tc TestCase)
    GetName() string

TestCaseContext represents the context of a testcase

type TestStep Uses

type TestStep map[string]interface{}

TestStep represents a testStep

type TestSuite Uses

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"`
    Filename   string                 `xml:"-" json:"-" yaml:"-"`
    ShortName  string                 `xml:"-" json:"-" yaml:"-"`
    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" hcl:"testcase" json:"tests" yaml:"testcases"`
    Version    string                 `xml:"version,omitempty" hcl:"version" json:"version" yaml:"version,omitempty"`
    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:"-"`
    WorkDir    string                 `xml:"-" json:"-" yaml:"-"`

TestSuite is a single JUnit test suite which may contain many testcases.

type Tests Uses

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

type Venom Uses

type Venom struct {
    LogLevel  string
    LogOutput io.Writer

    PrintFunc func(format string, a ...interface{}) (n int, err error)

    IgnoreVariables []string
    Parallel        int

    EnableProfiling bool
    OutputFormat    string
    OutputDir       string
    StopOnFailure   bool
    // contains filtered or unexported fields

func New Uses

func New() *Venom

func (*Venom) AddVariables Uses

func (v *Venom) AddVariables(variables map[string]string)

func (*Venom) ContextWrap Uses

func (v *Venom) ContextWrap(tc *TestCase) (TestCaseContext, error)

ContextWrap initializes a context for a testcase no type -> parent context

func (*Venom) OutputResult Uses

func (v *Venom) OutputResult(tests Tests, elapsed time.Duration) error

OutputResult output result to sdtout, files...

func (*Venom) Parse Uses

func (v *Venom) Parse(path []string, exclude []string) error

Parse parses tests suite to check context and variables

func (*Venom) Process Uses

func (v *Venom) Process(path []string, exclude []string) (*Tests, error)

Process runs tests suite and return a Tests result

func (*Venom) RegisterExecutor Uses

func (v *Venom) RegisterExecutor(name string, e Executor)

RegisterExecutor register Test Executors

func (*Venom) RegisterTestCaseContext Uses

func (v *Venom) RegisterTestCaseContext(name string, tcc TestCaseContext)

RegisterTestCaseContext new register TestCaseContext

func (*Venom) RunTestStep Uses

func (v *Venom) RunTestStep(tcc TestCaseContext, e *ExecutorWrap, ts *TestSuite, tc *TestCase, stepNumber int, step TestStep, l Logger) ExecutorResult

RunTestStep executes a venom testcase is a venom context

func (*Venom) WrapExecutor Uses

func (v *Venom) WrapExecutor(t map[string]interface{}, tcc TestCaseContext) (*ExecutorWrap, error)

WrapExecutor initializes a test by name no type -> exec is default



Package venom imports 31 packages (graph) and is imported by 79 packages. Updated 2020-10-20. Refresh now. Tools for package owners.