testcase

package
v0.71.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCsvDataFilesForJsonFile added in v0.71.2

func GetCsvDataFilesForJsonFile(jsonFile string, suffix string) []string

func GetTcNameSet added in v0.71.2

func GetTcNameSet(tcArray []*TestCaseDataInfo) []string

func IfCaseNameDuplicated added in v0.71.2

func IfCaseNameDuplicated(tcInfos []*TestCaseDataInfo) bool

Types

type CommandDetails

type CommandDetails struct {
	CmdType            string                   `json:"cmdType"`
	CmdSource          string                   `json:"cmdSource"`
	Cmd                interface{}              `json:"cmd"`
	CmdResponse        []map[string]interface{} `json:"cmdResponse"`
	OutGlobalVariables map[string]interface{}   `json:"outGlobalVariables"`
	OutLocalVariables  map[string]interface{}   `json:"outLocalVariables"`
	Session            map[string]interface{}   `json:"session"`
	OutFiles           []*OutFilesDetails       `json:"outFiles"`
}

type MultipartForm added in v0.71.2

type MultipartForm struct {
	Name       string                 `json:"name"`
	Value      string                 `json:"value"`
	Type       string                 `json:"type"`
	MIMEHeader map[string]interface{} `json:"mIMEHeader"`
}

type MutationInfo

type MutationInfo struct {
	FieldPath    []string
	CurrValue    interface{}
	FieldType    string // the json supported types
	FieldSubType string // like ip/email/phone/etc.
	MutatedValue interface{}
}

type OutFilesDetails

type OutFilesDetails struct {
	TargetFile    string
	TargetHeader  []string
	Sources       []string
	SourcesFields []string
	Operation     string
	Data          map[string][]interface{}
}

func (*OutFilesDetails) GetData

func (tcOutFiles *OutFilesDetails) GetData() map[string][]interface{}

func (*OutFilesDetails) GetOperation

func (tcOutFiles *OutFilesDetails) GetOperation() string

func (*OutFilesDetails) GetSources

func (tcOutFiles *OutFilesDetails) GetSources() []string

func (*OutFilesDetails) GetSourcesFields

func (tcOutFiles *OutFilesDetails) GetSourcesFields() []string

func (*OutFilesDetails) GetTargetFileName

func (tcOutFiles *OutFilesDetails) GetTargetFileName() string

outFiles

func (*OutFilesDetails) GetTargetHeader

func (tcOutFiles *OutFilesDetails) GetTargetHeader() []string

type OutputsDetails

type OutputsDetails struct {
	FileName string
	Format   string
	Data     map[string][]interface{}
}

func (*OutputsDetails) GetOutputsDetailsData

func (tcOutDetails *OutputsDetails) GetOutputsDetailsData() map[string][]interface{}

func (*OutputsDetails) GetOutputsDetailsFileName

func (tcOutDetails *OutputsDetails) GetOutputsDetailsFileName() string

outputs

func (*OutputsDetails) GetOutputsDetailsFormat

func (tcOutDetails *OutputsDetails) GetOutputsDetailsFormat() string

type Payload added in v0.71.2

type Payload struct {
	TextJson      interface{}            `json:"textJson"`
	Text          interface{}            `json:"text"`
	MultipartForm *MultipartForm         `json:"multipartForm"`
	Form          map[string]interface{} `json:"form"`
}

type Request

type Request struct {
	Method      string                 `json:"method"`
	Path        string                 `json:"path"`
	Headers     map[string]interface{} `json:"headers"`
	QueryString map[string]interface{} `json:"queryString"`
	Payload     map[string]interface{} `json:"payload"`
}

type TcConsoleResults

type TcConsoleResults struct {
	TcName           string
	Priority         string
	ParentTestCase   string
	JsonFilePath     string
	CsvFile          string
	CsvRow           string
	MutationInfoStr  interface{}
	SetUpResult      string
	HttpResult       string
	TearDownResult   string
	TestResult       string // Ready, Running, Success, Fail, ParentReady, ParentRunning, ParentFailed
	ActualStatusCode int
	HttpTestMessages []*TestMessage
}

type TcReportResults

type TcReportResults struct {
	TcName                string
	IfGlobalSetUpTearDown string // SetUp, TearDown
	// CaseType string // Normal, Scenario, Mutation, Fuzz
	Priority             string
	ParentTestCase       string
	FunctionAreas        []string
	TestSuite            string
	SetUpResult          string // Success, Fail
	SetUpTestMessages    [][]*TestMessage
	Path                 string
	Method               string
	JsonFilePath         string
	CsvFile              string
	CsvRow               string
	MutationArea         string
	MutationCategory     string
	MutationRule         string
	MutationInfo         interface{}
	HttpResult           string // Success, Fail
	ActualStatusCode     int
	StartTime            string
	EndTime              string
	HttpTestMessages     []*TestMessage
	StartTimeUnixNano    int64
	EndTimeUnixNano      int64
	DurationUnixNano     int64
	DurationUnixMillis   int64
	TearDownResult       string // Success, Fail
	TearDownTestMessages [][]*TestMessage
	TestResult           string // Success, Fail, ParentFailed
	HttpUrl              string
	CaseOrigin           interface{}
	GlobalVariables      interface{}
	Session              interface{}
	LocalVariables       interface{}
	ActualHeader         interface{}
	ActualBody           interface{}
}

for report format

type TestCase

type TestCase map[string]*TestCaseBasics

test case type,

func (*TestCase) AddRequestHeader

func (tc *TestCase) AddRequestHeader(key string, newValue string)

func (*TestCase) AddRequestQueryString

func (tc *TestCase) AddRequestQueryString(key string, newValue string)

func (*TestCase) ComposeReqQueryString

func (tc *TestCase) ComposeReqQueryString() string

func (*TestCase) ComposeReqQueryStringEncode

func (tc *TestCase) ComposeReqQueryStringEncode() string

to encode the query, also avoid the impact if string itself contains char '&'

func (*TestCase) DelReqPayload

func (tc *TestCase) DelReqPayload(key string)

func (*TestCase) DelRequestHeader

func (tc *TestCase) DelRequestHeader(key string)

func (*TestCase) DelRequestQueryString

func (tc *TestCase) DelRequestQueryString(key string)

func (*TestCase) FunctionAreas added in v0.71.2

func (tc *TestCase) FunctionAreas() []string

func (*TestCase) IfGlobalSetUpTestCase

func (tc *TestCase) IfGlobalSetUpTestCase() bool

func (*TestCase) IfGlobalTearDownTestCase

func (tc *TestCase) IfGlobalTearDownTestCase() bool

func (*TestCase) Inputs

func (tc *TestCase) Inputs() []interface{}

func (*TestCase) OutFiles

func (tc *TestCase) OutFiles() []*OutFilesDetails

func (*TestCase) OutGlobalVariables

func (tc *TestCase) OutGlobalVariables() map[string]interface{}

func (*TestCase) OutLocalVariables

func (tc *TestCase) OutLocalVariables() map[string]interface{}

func (*TestCase) Outputs

func (tc *TestCase) Outputs() []*OutputsDetails

func (*TestCase) ParentTestCase

func (tc *TestCase) ParentTestCase() string

func (*TestCase) Priority

func (tc *TestCase) Priority() string

func (*TestCase) ReqHeaders

func (tc *TestCase) ReqHeaders() map[string]interface{}

func (*TestCase) ReqMethod

func (tc *TestCase) ReqMethod() string

func (*TestCase) ReqPath

func (tc *TestCase) ReqPath() string

func (*TestCase) ReqPayload

func (tc *TestCase) ReqPayload() map[string]interface{}

func (*TestCase) ReqQueryString

func (tc *TestCase) ReqQueryString() map[string]interface{}

func (*TestCase) Request

func (tc *TestCase) Request() *Request

type Request struct

func (*TestCase) Response added in v0.71.2

func (tc *TestCase) Response() []map[string]interface{}

func (*TestCase) Session

func (tc *TestCase) Session() map[string]interface{}

func (*TestCase) SetInputs

func (tc *TestCase) SetInputs(newValue string)

func (*TestCase) SetParentTestCase

func (tc *TestCase) SetParentTestCase(newValue string)

func (*TestCase) SetPriority

func (tc *TestCase) SetPriority(newValue string)

!! --------------------------------------- !! --- test case type - set !! ---------------------------------------

func (*TestCase) SetRequestHeader

func (tc *TestCase) SetRequestHeader(key string, newValue string)

request header

func (*TestCase) SetRequestMethod

func (tc *TestCase) SetRequestMethod(newValue string)

func (*TestCase) SetRequestPath

func (tc *TestCase) SetRequestPath(newValue string)

func (*TestCase) SetRequestPayload

func (tc *TestCase) SetRequestPayload(key string, newValue interface{})

request query Payload

func (*TestCase) SetRequestQueryString

func (tc *TestCase) SetRequestQueryString(key string, newValue string)

request query string

func (*TestCase) SetTestSuite added in v0.71.2

func (tc *TestCase) SetTestSuite(newValue string)

func (*TestCase) SetUp

func (tc *TestCase) SetUp() []*CommandDetails

func (*TestCase) TcName

func (tc *TestCase) TcName() string

test case type - get

func (*TestCase) TearDown

func (tc *TestCase) TearDown() []*CommandDetails

func (*TestCase) TestCaseBasics

func (tc *TestCase) TestCaseBasics() *TestCaseBasics

func (*TestCase) TestSuite added in v0.71.2

func (tc *TestCase) TestSuite() string

func (*TestCase) UpdateTcName

func (tc *TestCase) UpdateTcName(newKey string)

func (*TestCase) UrlEncode

func (tc *TestCase) UrlEncode(baseUrl string) string

func (*TestCase) UrlRaw

func (tc *TestCase) UrlRaw(baseUrl string) string

type TestCaseBasics

type TestCaseBasics struct {
	Priority                 string                   `json:"priority"`
	ParentTestCase           string                   `json:"parentTestCase"`
	FunctionAreas            []string                 `json:"functionAreas"`
	TestSuite                string                   `json:"testSuite"`
	IfGlobalSetUpTestCase    bool                     `json:"ifGlobalSetUpTestCase"`
	IfGlobalTearDownTestCase bool                     `json:"ifGlobalTearDownTestCase"`
	SetUp                    []*CommandDetails        `json:"setUp"`
	Inputs                   []interface{}            `json:"inputs"`
	Request                  *Request                 `json:"request"`
	Response                 []map[string]interface{} `json:"response"`
	Outputs                  []*OutputsDetails        `json:"outputs"`
	OutFiles                 []*OutFilesDetails       `json:"outFiles"`
	OutGlobalVariables       map[string]interface{}   `json:"outGlobalVariables"`
	OutLocalVariables        map[string]interface{}   `json:"outLocalVariables"`
	Session                  map[string]interface{}   `json:"session"`
	TearDown                 []*CommandDetails        `json:"tearDown"`
}

type TestCaseDataInfo

type TestCaseDataInfo struct {
	TestCase         *TestCase
	JsonFilePath     string
	CsvFile          string
	CsvRow           string
	MutationArea     string
	MutationCategory string
	MutationRule     string
	MutationInfoStr  interface{}
	MutationInfo     MutationInfo
}

test case data type, includes testcase

func ConstructTcInfosWithDt added in v0.71.2

func ConstructTcInfosWithDt(jsonFile string, csvFileList []string) []*TestCaseDataInfo

not using "text/template"

func ConstructTcInfosWithoutDt added in v0.71.2

func ConstructTcInfosWithoutDt(jsonFile string) []*TestCaseDataInfo

func InitFullTcSlice added in v0.71.2

func InitFullTcSlice(filePathSlice []string) []*TestCaseDataInfo

func (*TestCaseDataInfo) FunctionAreas added in v0.71.2

func (tcData *TestCaseDataInfo) FunctionAreas() []string

func (*TestCaseDataInfo) ParentTestCase

func (tcData *TestCaseDataInfo) ParentTestCase() string

func (*TestCaseDataInfo) Priority

func (tcData *TestCaseDataInfo) Priority() string

func (*TestCaseDataInfo) ReqMethod

func (tcData *TestCaseDataInfo) ReqMethod() string

func (*TestCaseDataInfo) ReqPath

func (tcData *TestCaseDataInfo) ReqPath() string

func (*TestCaseDataInfo) TcName

func (tcData *TestCaseDataInfo) TcName() string

!! --------------------------------------- !! --- test case data type !! ---------------------------------------

func (*TestCaseDataInfo) TestSuite added in v0.71.2

func (tcData *TestCaseDataInfo) TestSuite() string

type TestCaseExecutionInfo

type TestCaseExecutionInfo struct {
	TestCaseDataInfo     *TestCaseDataInfo
	SetUpResult          string
	SetUpTestMessages    [][]*TestMessage
	HttpResult           string
	ActualStatusCode     int
	StartTime            string
	EndTime              string
	HttpTestMessages     []*TestMessage
	StartTimeUnixNano    int64
	EndTimeUnixNano      int64
	DurationUnixNano     int64
	ActualBody           []byte
	ActualHeader         map[string][]string
	HttpUrl              string
	TearDownResult       string
	TearDownTestMessages [][]*TestMessage
	TestResult           string // Ready, Running, Success, Fail, ParentReady, ParentRunning, ParentFailed
	LocalVariables       interface{}
}

test case execution type, includes testdata

func (*TestCaseExecutionInfo) ParentTestCase

func (tcExecution *TestCaseExecutionInfo) ParentTestCase() string

func (*TestCaseExecutionInfo) Priority

func (tcExecution *TestCaseExecutionInfo) Priority() string

func (*TestCaseExecutionInfo) ReqMethod

func (tcExecution *TestCaseExecutionInfo) ReqMethod() string

func (*TestCaseExecutionInfo) ReqPath

func (tcExecution *TestCaseExecutionInfo) ReqPath() string

func (*TestCaseExecutionInfo) SetTestResult

func (tcExecution *TestCaseExecutionInfo) SetTestResult(value string)

func (*TestCaseExecutionInfo) TcConsoleResults

func (tcExecution *TestCaseExecutionInfo) TcConsoleResults() *TcConsoleResults

for report

func (*TestCaseExecutionInfo) TcName

func (tcExecution *TestCaseExecutionInfo) TcName() string

test case execution type

func (*TestCaseExecutionInfo) TcReportResults

func (tcExecution *TestCaseExecutionInfo) TcReportResults() *TcReportResults

func (*TestCaseExecutionInfo) TestCase

func (tcExecution *TestCaseExecutionInfo) TestCase() *TestCase

type TestCases

type TestCases []TestCase

type TestMessage

type TestMessage struct {
	AssertionResults string
	ReponsePart      string // Status, Headers, Body
	FieldName        interface{}
	AssertionKey     interface{}
	ActualValue      interface{}
	ExpValue         interface{}
}

Jump to

Keyboard shortcuts

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