testsuite

package
v0.0.0-...-afd21db Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Insecure       bool
	Detail         bool
	StopWhenFailed bool
}

Config for test runner

type Task

type Task struct {
	Name        string
	Method      string
	BaseURL     string
	Config      *Config
	Path        string
	ContentType string
	RequestBody string
	Headers     map[string]string
	Captures    map[string]string
	Captured    map[string]string
	Variables   map[string]string
	Cookies     []*http.Cookie
	UploadList  request.UploadFiles
}

Task is task for setup and teardown

func NewTask

func NewTask(t *TestCase) *Task

NewTask to create a new task

func (*Task) MergeVariables

func (t *Task) MergeVariables(vars map[string]string)

MergeVariables merge a given set of vars to local one

func (*Task) Run

func (t *Task) Run() error

Run executes test case

func (*Task) SetCookies

func (t *Task) SetCookies(c []*http.Cookie)

func (*Task) Value

func (t *Task) Value(k string) (string, bool)

Value return a value of corresponding captured key

type TestCase

type TestCase struct {
	Name         string
	Method       string
	BaseURL      string
	Config       *Config
	Path         string
	ContentType  string
	RequestBody  string
	Headers      map[string]string
	Expectations []assertable.Row
	Captures     map[string]string
	Setups       []*Task
	Teardowns    []*Task
	Variables    map[string]string
	Captured     map[string]string
	Cookies      []*http.Cookie
	UploadList   request.UploadFiles
}

TestCase holds a test case

func NewTestCase

func NewTestCase(name string) *TestCase

NewTestCase creates a new testcase

func (*TestCase) Run

func (tc *TestCase) Run() error

Run executes test case

func (*TestCase) SetContentType

func (tc *TestCase) SetContentType(ct string)

SetContentType set a corresponding content type

type TestStat

type TestStat struct {
	Total   int
	Success int
}

TestStat contains test result

type TestSuite

type TestSuite struct {
	Name      string
	BaseURL   string
	Config    *Config
	TestCases []*TestCase
	Stat      TestStat
	Variables map[string]string
}

TestSuite holds a test suite

func (*TestSuite) Run

func (ts *TestSuite) Run() error

Run executes test case

type TestSuites

type TestSuites struct {
	Suites  []*TestSuite
	BaseURL string
	Config  *Config

	Variables map[string]string
	// contains filtered or unexported fields
}

TestSuites is several test suites

func (*TestSuites) Run

func (ts *TestSuites) Run()

Run executes test suite

func (*TestSuites) SetBaseURL

func (ts *TestSuites) SetBaseURL(url string)

SetBaseURL to set base url

func (*TestSuites) SetConfig

func (ts *TestSuites) SetConfig(conf *Config)

SetConfig to set configuration

func (*TestSuites) SetVariables

func (ts *TestSuites) SetVariables(v map[string]string)

SetVariables to set variables to test suites

func (*TestSuites) Stat

func (ts *TestSuites) Stat() TestStat

Stat returns test stat

func (*TestSuites) Summary

func (ts *TestSuites) Summary() int

Summary prints test summary

type TestSuitesInterface

type TestSuitesInterface interface {
	Run()
	Summary() int
	SetVariables(map[string]string)
	SetBaseURL(string)
	SetConfig(*Config)
	Stat() TestStat
}

TestSuitesInterface is interface of TestSuites

Jump to

Keyboard shortcuts

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