api

package
v0.72.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallFunc

func CallFunc(funcName string, funcParams_f interface{}) interface{}

CallFunc for BuiltinFunc and User defined func (i.e. in js files)

func ConvertCsvRowToMap

func ConvertCsvRowToMap(csvHeader []string, csvRow []interface{}) map[string]interface{}

4. data file (*_dt) / data file (inputs)

func DispatchApi

func DispatchApi(wg *sync.WaitGroup, resultsExeChan chan testcase.TestCaseExecutionInfo, baseUrl string, tcData *testcase.TestCaseDataInfo)

func GetFuncLeavesSlice

func GetFuncLeavesSlice(value interface{}) []g4json.FieldDetails

func IfValidHttp

func IfValidHttp(tcData *testcase.TestCaseDataInfo) bool

func OpenOutFileForAppend

func OpenOutFileForAppend(logFile string) *os.File

func PrepMultipart

func PrepMultipart(reqPayload map[string]interface{}, path string) (*bytes.Buffer, string, error)

func PrepPostFormPayload

func PrepPostFormPayload(reqPayload map[string]interface{}) *strings.Reader

func PrepPostPayload

func PrepPostPayload(reqPayload map[string]interface{}) *strings.Reader

func RunMongoDB

func RunMongoDB(cmdStr string) (int, interface{}, string)

func RunMsSql added in v0.72.0

func RunMsSql(tgtDb string, stmt string) (int, []string, []map[string]interface{}, string)

for mssql

func RunPgSql

func RunPgSql(tgtDb string, stmt string) (int, []string, []map[string]interface{}, string)

for postgresql

func RunRedis

func RunRedis(cmdStr string, cmdKey string, cmdValue string) (int, interface{}, string)

func RunSql

func RunSql(tgtDb string, stmt string) (int, []string, []map[string]interface{}, string)

for mysql

func SaveHttpRespFile

func SaveHttpRespFile(actualBody []byte, outputsFile string)

func SaveJsonToCsvFile

func SaveJsonToCsvFile(tcDataStore *TcDataStore, sources []string, sourcesFields []string, targetHeader []string, outputsFile string)

func SaveJsonToExcelFile

func SaveJsonToExcelFile(tcDataStore *TcDataStore, sources []string, sourcesFields []string, targetHeader []string, outputsFile string)

Types

type TcDataStore

type TcDataStore struct {
	TcData *testcase.TestCaseDataInfo

	TcLocalVariables map[string]interface{}

	HttpExpStatus        map[string]interface{}
	HttpExpHeader        map[string]interface{}
	HttpExpBody          map[string]interface{}
	HttpActualStatusCode int
	HttpActualHeader     map[string][]string
	HttpActualBody       []byte

	HttpUrl string

	CmdSection     string // setUp, tearDown
	CmdGroupLength int

	CmdType          string // sql, redis, init, etc.
	CmdExecStatus    string
	CmdAffectedCount int
	CmdResults       interface{}
}

func InitTcDataStore

func InitTcDataStore(tcData *testcase.TestCaseDataInfo) *TcDataStore

func (*TcDataStore) CallHttp

func (tcDataStore *TcDataStore) CallHttp(baseUrl string)

func (*TcDataStore) CommandGroup

func (tcDataStore *TcDataStore) CommandGroup(cmdGroupOrigin []*testcase.CommandDetails) (string, [][]*testcase.TestMessage)

func (*TcDataStore) Compare

func (tcDataStore *TcDataStore) Compare() (string, []*testcase.TestMessage)

func (*TcDataStore) CompareHttpRespGroup

func (tcDataStore *TcDataStore) CompareHttpRespGroup(httpExpResp []map[string]interface{}) ([]bool, []*testcase.TestMessage)

func (*TcDataStore) CompareRespGroup

func (tcDataStore *TcDataStore) CompareRespGroup(cmdExpResp []map[string]interface{}) (bool, []*testcase.TestMessage)

for trial

func (*TcDataStore) CompareRespGroupSingleAssertion

func (tcDataStore *TcDataStore) CompareRespGroupSingleAssertion(v map[string]interface{}) (bool, *testcase.TestMessage)

for trial

func (*TcDataStore) EvaluateEmbeddedFunctions

func (tcDataStore *TcDataStore) EvaluateEmbeddedFunctions(value interface{}) interface{}

func (*TcDataStore) EvaluateTcEmbeddedFunctions

func (tcDataStore *TcDataStore) EvaluateTcEmbeddedFunctions(path string, res interface{})

func (*TcDataStore) GetContentByPath

func (tcDataStore *TcDataStore) GetContentByPath(res interface{}, jsonPath string) interface{}

------------------------

func (*TcDataStore) GetHeadersActualValue

func (tcDataStore *TcDataStore) GetHeadersActualValue(key string) interface{}

http response headers

func (*TcDataStore) GetKeysCount

func (tcDataStore *TcDataStore) GetKeysCount(s string, jsonPath string) interface{}

func (*TcDataStore) GetOutputsCsvData

func (tcDataStore *TcDataStore) GetOutputsCsvData(outputsData map[string][]interface{}) ([]string, []string)

func (*TcDataStore) GetOutputsDetailsDataForFieldSlice

func (tcDataStore *TcDataStore) GetOutputsDetailsDataForFieldSlice(valueSlice []interface{}) []interface{}

func (*TcDataStore) GetOutputsDetailsDataForFieldString

func (tcDataStore *TcDataStore) GetOutputsDetailsDataForFieldString(valueSlice []interface{}) []string

func (*TcDataStore) GetRedisActualValueByPath

func (tcDataStore *TcDataStore) GetRedisActualValueByPath(searchPath string) interface{}

redis

func (*TcDataStore) GetRenderTcVariables

func (tcDataStore *TcDataStore) GetRenderTcVariables(res string) string

trial

func (*TcDataStore) GetRes

func (tcDataStore *TcDataStore) GetRes(s string, jsonPath string) interface{}

func (*TcDataStore) GetResponseValue

func (tcDataStore *TcDataStore) GetResponseValue(searchPath string) interface{}

func (*TcDataStore) GetStatusActualValue

func (tcDataStore *TcDataStore) GetStatusActualValue() interface{}

http response status code

func (*TcDataStore) GetVariableContent

func (tcDataStore *TcDataStore) GetVariableContent(s string) interface{}

----- Variable's Content, supports json path expression

func (*TcDataStore) HandleCmdResultsForOut

func (tcDataStore *TcDataStore) HandleCmdResultsForOut(i int)

------

func (*TcDataStore) HandleCmdSource

func (tcDataStore *TcDataStore) HandleCmdSource(i int) string

func (*TcDataStore) HandleCmdStr

func (tcDataStore *TcDataStore) HandleCmdStr(i int) string

func (*TcDataStore) HandleHttpResultsForOut

func (tcDataStore *TcDataStore) HandleHttpResultsForOut()

func (*TcDataStore) HandleInitCmd

func (tcDataStore *TcDataStore) HandleInitCmd(i int) ([]bool, [][]*testcase.TestMessage)

init

func (*TcDataStore) HandleJsonFile

func (tcDataStore *TcDataStore) HandleJsonFile(i int) ([]bool, [][]*testcase.TestMessage)

file

func (*TcDataStore) HandleMongoDBCmd

func (tcDataStore *TcDataStore) HandleMongoDBCmd(i int) ([]bool, [][]*testcase.TestMessage)

mongodb

func (*TcDataStore) HandleOutFiles

func (tcDataStore *TcDataStore) HandleOutFiles(expOutFiles []*testcase.OutFilesDetails)

func (*TcDataStore) HandleRedisCmd

func (tcDataStore *TcDataStore) HandleRedisCmd(i int) ([]bool, [][]*testcase.TestMessage)

redis

func (*TcDataStore) HandleSingleCmdResult

func (tcDataStore *TcDataStore) HandleSingleCmdResult(i int) ([]bool, [][]*testcase.TestMessage)

func (*TcDataStore) HandleSqlCmd

func (tcDataStore *TcDataStore) HandleSqlCmd(lc string, i int) ([]bool, [][]*testcase.TestMessage)

mysql

func (*TcDataStore) IfCmdResultsPrimitive

func (tcDataStore *TcDataStore) IfCmdResultsPrimitive() bool

func (*TcDataStore) IterateFuncs

func (tcDataStore *TcDataStore) IterateFuncs(jsonStr string, funcLeavesSlice []g4json.FieldDetails, maxLevel int) string

func (*TcDataStore) MergeTestData

func (tcDataStore *TcDataStore) MergeTestData() map[string]interface{}

Note: here may occur: fatal error: concurrent map iteration and map write, => need to fix

func (*TcDataStore) PrepEmbeddedFunctions

func (tcDataStore *TcDataStore) PrepEmbeddedFunctions(path string)

for http: .request, .response, .session, .outGlobalVariables, .outLocalVariables, .outFiles for cmd (setUp, tearDown): .cmd, .cmdResponse, .session, .outGlobalVariables, .outLocalVariables, .outFiles

func (*TcDataStore) ReWriteTcData

func (tcDataStore *TcDataStore) ReWriteTcData(path string, res interface{}, jsonStr string)

trial

func (*TcDataStore) RenderExpresionA

func (tcDataStore *TcDataStore) RenderExpresionA(source interface{}) string

func (*TcDataStore) RenderExpresionB

func (tcDataStore *TcDataStore) RenderExpresionB(source interface{}) interface{}

func (*TcDataStore) RenderTcVariables

func (tcDataStore *TcDataStore) RenderTcVariables(path string, res interface{})

func (*TcDataStore) RunHttp

func (tcDataStore *TcDataStore) RunHttp(baseUrl string) (string, []*testcase.TestMessage)

func (*TcDataStore) RunTcSetUp

func (tcDataStore *TcDataStore) RunTcSetUp() (string, [][]*testcase.TestMessage)

Note: for each SetUp, TesrDown, it may have more than one Command (including sql) for each Command, it may have more than one assertion

func (*TcDataStore) RunTcTearDown

func (tcDataStore *TcDataStore) RunTcTearDown() (string, [][]*testcase.TestMessage)

func (*TcDataStore) WriteOutGlobalVariables

func (tcDataStore *TcDataStore) WriteOutGlobalVariables(expOutGlobalVariables map[string]interface{})

func (*TcDataStore) WriteOutTcLocalVariables

func (tcDataStore *TcDataStore) WriteOutTcLocalVariables(expOutLocalVariables map[string]interface{})

func (*TcDataStore) WriteOutputsDataToFile

func (tcDataStore *TcDataStore) WriteOutputsDataToFile()

func (*TcDataStore) WriteSession

func (tcDataStore *TcDataStore) WriteSession(expTcSession map[string]interface{})

Jump to

Keyboard shortcuts

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