driver

package
v0.0.0-...-c113622 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ACC_ENV_KEY = "USDKACC"
View Source
const ACC_SKIP_REASON = "skip test for non-acc environment"

Variables

This section is empty.

Functions

func IsAcc

func IsAcc() bool

check test env is acceptance testing or not

Types

type FixtureFunc

type FixtureFunc func(step *Step) (interface{}, error)

func SetupClientFixture

func SetupClientFixture(factory func() (ucloud.ServiceClient, error)) FixtureFunc

SetupClientFixture is a help function for setup client fixture

type Retries

type Retries struct {
	Headers []string        `json:"headers"`
	Rows    [][]interface{} `json:"rows"`
}

type Scenario

type Scenario struct {
	PreCheck func()
	Id       string
	Title    string
	Steps    []*Step
	Owners   []string
	Vars     func(*Scenario) map[string]interface{}
	Spec     *Specification
	// contains filtered or unexported fields
}

func (*Scenario) GetVar

func (scenario *Scenario) GetVar(name string) interface{}

GetVar will return the variable of Scenario

func (*Scenario) Must

func (scenario *Scenario) Must(v interface{}, err error) interface{}

Must will check error is nil and return the value

func (*Scenario) Report

func (scenario *Scenario) Report() ScenarioReport

func (*Scenario) Run

func (scenario *Scenario) Run(t *testing.T)

Run will run the scenario test case

func (*Scenario) SetVar

func (scenario *Scenario) SetVar(name string, value interface{})

SetVar will set the variable of Scenario

type ScenarioExecution

type ScenarioExecution struct {
	Duration  float64 `json:"duration"`
	StartTime float64 `json:"start_time"`
	EndTime   float64 `json:"end_time"`
}

type ScenarioReport

type ScenarioReport struct {
	Title        string            `json:"title"`
	Id           string            `json:"id"`
	Steps        []StepReport      `json:"steps"`
	Status       string            `json:"status"`
	Execution    ScenarioExecution `json:"execution"`
	Owners       []string          `json:"owners"`
	PassedCount  int               `json:"passed_count"`
	FailedCount  int               `json:"failed_count"`
	SkippedCount int               `json:"skipped_count"`
	Errors       executionErrors   `json:"errors,omitempty"`
}

type Specification

type Specification struct {
	Scenarios []*Scenario
	// contains filtered or unexported fields
}

func (*Specification) AddFixture

func (spec *Specification) AddFixture(name string, fixture FixtureFunc)

AddFixture is a help function for dependency injection

func (*Specification) AddScenario

func (spec *Specification) AddScenario(scenario *Scenario)

func (*Specification) ParallelTest

func (spec *Specification) ParallelTest(t *testing.T, sce *Scenario)

ParallelTest is a help function for parallel testing

func (*Specification) Report

func (spec *Specification) Report() SpecificationReport

type SpecificationExecution

type SpecificationExecution struct {
	Duration  float64 `json:"duration"`
	StartTime float64 `json:"start_time"`
	EndTime   float64 `json:"end_time"`
}

type SpecificationReport

type SpecificationReport struct {
	Status       string                 `json:"status"`
	Execution    SpecificationExecution `json:"execution"`
	Scenarios    []ScenarioReport       `json:"scenarios"`
	PassedCount  int                    `json:"passed_count"`
	FailedCount  int                    `json:"failed_count"`
	SkippedCount int                    `json:"skipped_count"`
}

type Step

type Step struct {
	T *testing.T

	MaxRetries    int
	RetryInterval time.Duration
	StartupDelay  time.Duration
	FastFail      bool
	Title         string
	Scenario      *Scenario

	Invoker    func(*Step) (interface{}, error)
	Validators func(*Step) []TestValidator
	// contains filtered or unexported fields
}

func (*Step) AppendError

func (step *Step) AppendError(err error)

func (*Step) AppendRetriesRows

func (step *Step) AppendRetriesRows(row []interface{})

func (*Step) LoadFixture

func (step *Step) LoadFixture(name string) (interface{}, error)

LoadFixture is a function for load fixture by the name from map fixture function

func (*Step) Must

func (step *Step) Must(v interface{}, err error) interface{}

Must will check error is nil and return the value

func (*Step) Report

func (step *Step) Report() StepReport

func (*Step) SetRetriesHeaders

func (step *Step) SetRetriesHeaders(headers []string)

type StepExecution

type StepExecution struct {
	MaxRetries    int     `json:"max_retries"`
	RetryInterval float64 `json:"retry_interval"`
	StartupDelay  float64 `json:"startup_delay"`
	FastFail      bool    `json:"fast_fail"`
	Duration      float64 `json:"duration"`
	StartTime     float64 `json:"start_time"`
	EndTime       float64 `json:"end_time"`
}

type StepReport

type StepReport struct {
	Title     string          `json:"title"`
	Status    string          `json:"status"`
	Execution StepExecution   `json:"execution"`
	Retries   Retries         `json:"retries"`
	Errors    executionErrors `json:"errors,omitempty"`
}

type TestValidator

type TestValidator func(interface{}) error

Jump to

Keyboard shortcuts

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