btesting

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTracker = &Tracker{}

Functions

This section is empty.

Types

type BehaviorDriven

type BehaviorDriven struct {
	// contains filtered or unexported fields
}

func New

func New(t *testing.T, junitFile string, step bool) *BehaviorDriven

func (*BehaviorDriven) Describe

func (b *BehaviorDriven) Describe(name string, fn func(s *Scenario))

func (*BehaviorDriven) Execute

func (b *BehaviorDriven) Execute(format string)

type Case

type Case struct {
	Name string
	// contains filtered or unexported fields
}

func NewCase

func NewCase(t *testing.T, s *Scenario, name string, depth int, fn, before, after *hook, route string) *Case

type HTTPMatcher

type HTTPMatcher struct {
	// contains filtered or unexported fields
}

func (*HTTPMatcher) LastResponse

func (m *HTTPMatcher) LastResponse() *HttpResponse

func (*HTTPMatcher) ResetConnection

func (m *HTTPMatcher) ResetConnection()

func (*HTTPMatcher) SetLastResponse

func (m *HTTPMatcher) SetLastResponse(res *http.Response, err error)

func (*HTTPMatcher) StatusCode

func (m *HTTPMatcher) StatusCode(code int, msgAndArgs ...interface{})

type HttpResponse

type HttpResponse struct {
	*http.Response
}

func (*HttpResponse) FindCookie

func (h *HttpResponse) FindCookie(name string) *http.Cookie

type JUnitMessage

type JUnitMessage struct {
	Message string `xml:"message,attr"`
}

type JUnitProperty

type JUnitProperty struct {
	Name  string `xml:"name,attr"`
	Value string `xml:"value,attr"`
}

type JUnitStderr

type JUnitStderr struct {
	XMLName xml.Name `xml:"system-err"`
	Text    string   `xml:",chardata"`
}

type JUnitStdout

type JUnitStdout struct {
	XMLName xml.Name `xml:"system-out"`
	Text    string   `xml:",chardata"`
}

type JUnitTestCase

type JUnitTestCase struct {
	XMLName xml.Name `xml:"testcase"`
	// Name of the test case
	Name string `xml:"name,attr"`
	// Assertions is the number of assertions in this test case
	Assertions int    `xml:"assertions,attr,omitempty"`
	ClassName  string `xml:"classname,attr"`
	Status     string `xml:"status,attr,omitempty"`
	// Time in seconds to execute the test case
	Time    int `xml:"time,attr,omitempty"`
	Skipped *JUnitMessage
	Error   *JUnitMessage
	Failure *JUnitMessage
	Stdout  *JUnitStdout
	Stderr  *JUnitStderr
}

type JUnitTestSuite

type JUnitTestSuite struct {
	XMLName xml.Name `xml:"testsuite"`
	Name    string   `xml:"name,attr,omitempty"`
	// Tests is total number of tests in the suite. This value is required.
	Tests int `xml:"tests,attr"`
	// Failures is total number of failed tests in the suite
	Failures int `xml:"failures,attr,omitempty"`
	// Errors is total number of tests in the suite that is with error result
	Errors int `xml:"errors,attr,omitempty"`
	// Disabled is total number of disabled tests in the suite
	Disabled int `xml:"disabled,attr,omitempty"`
	// Time in seconds to execute in the suite
	Time int `xml:"time,attr,omitempty"`
	// Timestamp when tests were executed. The format is ISO8601 (2014-01-21T16:17:18)
	Timestamp string `xml:"timestamp,attr,omitempty"`
	// Hostname that tests were executed
	Hostname   string          `xml:"hostname,attr,omitempty"`
	Properties []JUnitProperty `xml:"properties>property,omitempty"`
	TestCases  []JUnitTestCase `xml:"testcase"`
}

type JUnitTestSuites

type JUnitTestSuites struct {
	XMLName    xml.Name         `xml:"testsuites"`
	TestSuites []JUnitTestSuite `xml:"testsuite"`
	Name       string           `xml:"name,attr,omitempty"`
	// Tests is total number of tests from all suites
	Tests int `xml:"tests,attr,omitempty"`
	// Errors is total number of tests with error result from all suites
	Errors int `xml:"errors,attr,omitempty"`
	// Failures is total number of failed tests from all suites
	Failures int `xml:"failures,attr,omitempty"`
	// Disabled is total number of disabled tests from all suites
	Disabled int `xml:"disabled,attr,omitempty"`
	// Time in seconds to execute all test suites
	Time int `xml:"time,attr,omitempty"`
}

func NewJUnitTestSuites

func NewJUnitTestSuites(tracker *Tracker) *JUnitTestSuites

type Matcher

type Matcher struct {
	*HTTPMatcher

	T testingT
	// contains filtered or unexported fields
}

func NewMatcher

func NewMatcher(t *testing.T, route string) *Matcher

func (*Matcher) Contains

func (m *Matcher) Contains(s, contains interface{}, msgAndArgs ...interface{})

func (*Matcher) Done

func (m *Matcher) Done()

func (*Matcher) Empty

func (m *Matcher) Empty(object interface{}, msgAndArgs ...interface{})

func (*Matcher) Equal

func (m *Matcher) Equal(expected, actual interface{}, msgAndArgs ...interface{})

func (*Matcher) Fail

func (m *Matcher) Fail(msg ...string)

func (*Matcher) Failed

func (m *Matcher) Failed() bool

func (*Matcher) Failf

func (m *Matcher) Failf(format string, args ...interface{})

func (*Matcher) False

func (m *Matcher) False(value bool, msgAndArgs ...interface{})

func (*Matcher) FileExists

func (m *Matcher) FileExists(path string, msgANdArgs ...interface{})

func (*Matcher) Len

func (m *Matcher) Len(object interface{}, len int, msgAndArgs ...interface{})

func (*Matcher) Log

func (m *Matcher) Log(msg string)

func (*Matcher) Logf

func (m *Matcher) Logf(format string, args ...interface{})

func (*Matcher) Must

func (m *Matcher) Must(err error) bool

func (*Matcher) NoError

func (m *Matcher) NoError(err error, msg ...string)

func (*Matcher) NotEmpty

func (m *Matcher) NotEmpty(object interface{}, msgAndArgs ...interface{})

func (*Matcher) NotNil

func (m *Matcher) NotNil(object interface{}, msg ...string)

func (*Matcher) True

func (m *Matcher) True(value bool, msgAndArgs ...interface{})

type MockServer

type MockServer struct {
	Port int
	// contains filtered or unexported fields
}

func NewMockServer

func NewMockServer() (*MockServer, error)

func (*MockServer) Requests

func (s *MockServer) Requests() []*http.Request

func (*MockServer) Start

func (s *MockServer) Start() error

func (*MockServer) Stop

func (s *MockServer) Stop() error

type MockTCPServer

type MockTCPServer struct {
	Port int
	// contains filtered or unexported fields
}

func NewMockTCPServer

func NewMockTCPServer() (*MockTCPServer, error)

func (*MockTCPServer) Start

func (s *MockTCPServer) Start() error

func (*MockTCPServer) Stop

func (s *MockTCPServer) Stop() error

type Scenario

type Scenario struct {
	Name string
	// contains filtered or unexported fields
}

func NewScenario

func NewScenario(t *testing.T, parent *Scenario, name string, depth int, fn func(s *Scenario), route string) *Scenario

func (*Scenario) AfterAll

func (f *Scenario) AfterAll(fn func(m *Matcher))

func (*Scenario) AfterEach

func (f *Scenario) AfterEach(fn func(m *Matcher))

func (*Scenario) BeforeAll

func (f *Scenario) BeforeAll(fn func(m *Matcher))

func (*Scenario) BeforeEach

func (f *Scenario) BeforeEach(fn func(m *Matcher))

func (*Scenario) Context

func (f *Scenario) Context(name string, fn func(s *Scenario))

func (*Scenario) Defer

func (f *Scenario) Defer(fn func())

func (*Scenario) It

func (f *Scenario) It(name string, fn func(m *Matcher))

func (*Scenario) SAfterAll

func (f *Scenario) SAfterAll(fn func(m *Matcher))

func (*Scenario) SAfterEach

func (f *Scenario) SAfterEach(fn func(m *Matcher))

func (*Scenario) SBeforeAll

func (f *Scenario) SBeforeAll(fn func(m *Matcher))

func (*Scenario) SBeforeEach

func (f *Scenario) SBeforeEach(fn func(m *Matcher))

func (*Scenario) SSubject

func (f *Scenario) SSubject(fn func(m *Matcher))

func (*Scenario) Step

func (f *Scenario) Step(name string, fn func(s *Scenario))

func (*Scenario) Subject

func (f *Scenario) Subject(fn func(m *Matcher))

type Tracker

type Tracker struct {
	Suites []*testSuite
}

func (*Tracker) Save

func (t *Tracker) Save(path string)

Jump to

Keyboard shortcuts

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