runner

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: MIT Imports: 21 Imported by: 1

Documentation

Overview

Package runner responsible for excute the test case

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTestCase

func RunTestCase(testcase *testing.TestCase, dataContext interface{}, ctx context.Context) (output interface{}, err error)

Deprecated RunTestCase runs the test case.

Types

type ReportRecord added in v0.0.4

type ReportRecord struct {
	Method    string
	API       string
	BeginTime time.Time
	EndTime   time.Time
	Error     error
}

func NewReportRecord added in v0.0.4

func NewReportRecord() *ReportRecord

NewReportRecord creates a record, and set the begin time to be now

func (*ReportRecord) Duration added in v0.0.4

func (r *ReportRecord) Duration() time.Duration

Duration returns the duration between begin and end time

func (*ReportRecord) ErrorCount added in v0.0.4

func (r *ReportRecord) ErrorCount() int

type ReportResult added in v0.0.4

type ReportResult struct {
	API     string
	Count   int
	Average time.Duration
	Max     time.Duration
	Min     time.Duration
	Error   int
}

type ReportResultSlice added in v0.0.4

type ReportResultSlice []ReportResult

func (ReportResultSlice) Len added in v0.0.4

func (r ReportResultSlice) Len() int

func (ReportResultSlice) Less added in v0.0.4

func (r ReportResultSlice) Less(i, j int) bool

func (ReportResultSlice) Swap added in v0.0.4

func (r ReportResultSlice) Swap(i, j int)

type ReportResultWithTotal added in v0.0.4

type ReportResultWithTotal struct {
	ReportResult
	Total time.Duration
}

type ReportResultWriter added in v0.0.4

type ReportResultWriter interface {
	Output([]ReportResult) error
}

func NewDiscardResultWriter added in v0.0.4

func NewDiscardResultWriter() ReportResultWriter

NewDiscardResultWriter creates a report result writer which discard everything

func NewMarkdownResultWriter added in v0.0.4

func NewMarkdownResultWriter(writer io.Writer) ReportResultWriter

func NewResultWriter added in v0.0.4

func NewResultWriter(writer io.Writer) ReportResultWriter

type TestCaseRunner added in v0.0.4

type TestCaseRunner interface {
	RunTestCase(testcase *testing.TestCase, dataContext interface{}, ctx context.Context) (output interface{}, err error)
	WithOutputWriter(io.Writer) TestCaseRunner
	WithTestReporter(TestReporter) TestCaseRunner
}

func NewSimpleTestCaseRunner added in v0.0.4

func NewSimpleTestCaseRunner() TestCaseRunner

NewSimpleTestCaseRunner creates the instance of the simple test case runner

type TestReporter added in v0.0.4

type TestReporter interface {
	PutRecord(*ReportRecord)
	GetAllRecords() []*ReportRecord
	ExportAllReportResults() (ReportResultSlice, error)
}

func NewDiscardTestReporter added in v0.0.4

func NewDiscardTestReporter() TestReporter

NewDiscardTestReporter creates a test reporter which discard everything

func NewmemoryTestReporter added in v0.0.4

func NewmemoryTestReporter() TestReporter

NewmemoryTestReporter creates a memory based test reporter

Jump to

Keyboard shortcuts

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