agentExec

package
v0.0.0-...-add256a Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerApiPath = "api/v1"
)

Variables

View Source
var (
	DemoTestSite = GetDemoSite()
)
View Source
var (
	ExecContextStore sync.Map
)
View Source
var (
	GovaluateFunctions = map[string]govaluate.ExpressionFunction{
		"length": func(args ...interface{}) (interface{}, error) {
			length := len(args[0].(string))
			return (float64)(length), nil
		},
		"match": func(args ...interface{}) (interface{}, error) {
			str := args[0].(string)
			regx := regexp.MustCompile("args[1].(string)")

			ret := regx.MatchString(str)
			return ret, nil
		},
		"uuid": func(args ...interface{}) (interface{}, error) {
			ret := _stringUtils.Uuid()
			return ret, nil
		},
	}
)

Functions

func AppendGojaLogs

func AppendGojaLogs(execUuid string, val string)

func AppendGojaVariables

func AppendGojaVariables(execUuid string, val domain.ExecVariable)

func ClearCookie

func ClearCookie(processorId uint, cookieName string, execUuid string) (err error)

func ClearExecContext

func ClearExecContext(execUuid string)

func ClearVariable

func ClearVariable(processorId uint, variableName string, execUuid string) (err error)

func ComputerScopeHierarchy

func ComputerScopeHierarchy(processor *Processor, scopeHierarchyMap *map[uint]*[]uint)

func CountInterfaceStat

func CountInterfaceStat(execUuid string, result *agentDomain.ScenarioExecResult) agentDomain.InterfaceStat

func CountScriptAssertionStat

func CountScriptAssertionStat(execUuid string, output string, result *agentDomain.ScenarioExecResult) agentDomain.InterfaceStat

func CountSkip

func CountSkip(execUuid string, executedProcessorIds map[uint]bool, skippedChildren []*Processor) agentDomain.InterfaceStat

func DealwithCookies

func DealwithCookies(req *domain.BaseRequest, processorId uint, execUuid string)

func DealwithDatabaseCondition

func DealwithDatabaseCondition(condition domain.InterfaceExecCondition,
	postConditions *[]domain.InterfaceExecCondition, execUuid string)

func DealwithDealwithCheckPointCondition

func DealwithDealwithCheckPointCondition(condition domain.InterfaceExecCondition, resp domain.DebugResponse,
	status *consts.ResultStatus, postConditions *[]domain.InterfaceExecCondition, execUuid string)

func DealwithExtractorCondition

func DealwithExtractorCondition(condition domain.InterfaceExecCondition, resp domain.DebugResponse,
	postConditions *[]domain.InterfaceExecCondition, execUuid string)

func DealwithResponseDefineCondition

func DealwithResponseDefineCondition(condition domain.InterfaceExecCondition, resp domain.DebugResponse,
	resultStatus *consts.ResultStatus, postConditions *[]domain.InterfaceExecCondition)

func DealwithScriptCondition

func DealwithScriptCondition(condition domain.InterfaceExecCondition, resultStatus *consts.ResultStatus,
	projectId uint, conditions *[]domain.InterfaceExecCondition, execUuid string, isPostCondition bool, tenantId consts.TenantId)

func DownloadUploadedFile

func DownloadUploadedFile(uri string, execUuid string) (ret string, err error)

func EvaluateGovaluateExpressionByProcessorScope

func EvaluateGovaluateExpressionByProcessorScope(expression string, scopeId uint, execUuid string) (ret interface{}, params domain.VarKeyValuePair, err error)

called by agent processor interface

func EvaluateGovaluateExpressionWithDebugVariables

func EvaluateGovaluateExpressionWithDebugVariables(expression string, execUuid string) (ret interface{}, params domain.VarKeyValuePair, err error)

called by checkpoint

func EvaluateVariablePropExpressionValue

func EvaluateVariablePropExpressionValue(variable domain.ExecVariable, propExpression string) (
	ret domain.ExecVariable, ok bool)

like {name.prop}

func ExecCheckPoint

func ExecCheckPoint(checkpoint *domain.CheckpointBase, resp domain.DebugResponse, processorId uint, execUuid string) (err error)

func ExecDbOpt

func ExecDbOpt(opt *domain.DatabaseOptBase) (err error)

func ExecExtract

func ExecExtract(extractor *domain.ExtractorBase, resp domain.DebugResponse) (err error)

func ExecPostConditions

func ExecPostConditions(execObj *InterfaceExecObj, resp domain.DebugResponse, execUuid string) (resultStatus consts.ResultStatus, err error)

func ExecPreConditions

func ExecPreConditions(execObj *InterfaceExecObj, execUuid string) (err error)

func ExecResponseDefine

func ExecResponseDefine(responseDefine *domain.ResponseDefineBase, res domain.DebugResponse) (err error)

func ExecScript

func ExecScript(scriptObj *domain.ScriptBase, tenantId consts.TenantId, projectId uint, execUuid string) (err error)

func GenRequestUrlWithBaseUrlAndPathParam

func GenRequestUrlWithBaseUrlAndPathParam(req *domain.BaseRequest, debugInterfaceId uint, baseUrl string, execUuid string)

func GetContentProps

func GetContentProps(req *domain.BaseRequest, resp *domain.DebugResponse)

func GetCookie

func GetCookie(processorId uint, cookieName, domain string, execUuid string) (cookie domain.ExecCookie)

func GetCurrDebugInterfaceId

func GetCurrDebugInterfaceId(execUuid string) (ret uint)

func GetCurrEnvironmentId

func GetCurrEnvironmentId(execUuid string) (id int)

func GetCurrRequest

func GetCurrRequest(execUuid string) (ret domain.BaseRequest)

func GetCurrResponse

func GetCurrResponse(execUuid string) (ret domain.DebugResponse)

func GetCurrScenarioProcessorId

func GetCurrScenarioProcessorId(execUuid string) (ret uint)

func GetDatapoolCursor

func GetDatapoolCursor(execUuid string) (ret map[string]int)

func GetDemoSite

func GetDemoSite() (ret string)

func GetExecScene

func GetExecScene(execUuid string) (ret domain.ExecScene)

func GetForceStopExec

func GetForceStopExec(execUuid string) (ret bool)

func GetGojaLogs

func GetGojaLogs(execUuid string) (ret *[]string)

func GetGojaVariables

func GetGojaVariables(execUuid string) (ret *[]domain.ExecVariable)

func GetInterfaceStat

func GetInterfaceStat(execUuid string) (ret *agentDomain.InterfaceStat)

func GetIsRunning

func GetIsRunning(execUuid string) (ret bool)

func GetProcessorList

func GetProcessorList(processor *Processor, list *[]*Processor)

func GetReqValueFromGoja

func GetReqValueFromGoja(execUuid string, tenantId consts.TenantId, projectId uint) (err error)

func GetRequestProps

func GetRequestProps(req *domain.BaseRequest)

func GetRespValueFromGoja

func GetRespValueFromGoja(execUuid string, tenantId consts.TenantId, projectId uint) (err error)

func GetScopeHierarchy

func GetScopeHierarchy(execUuid string) (ret map[uint]*[]uint)

func GetScopedCookies

func GetScopedCookies(execUuid string) (ret map[uint][]domain.ExecCookie)

func GetScopedVariables

func GetScopedVariables(execUuid string) (ret map[uint][]domain.ExecVariable)

func GetServerToken

func GetServerToken(execUuid string) (ret string)

func GetServerUrl

func GetServerUrl(execUuid string) (ret string)

func GetValidScopeIds

func GetValidScopeIds(processorId uint, execUuid string) (ret *[]uint)

func GetVariable

func GetVariable(processorId uint, nameOrExpr string, execUuid string) (ret domain.ExecVariable, err error)

GetVariable @Param processorId int true "Processor Id" @Param nameOrExpr string true "Variable name(email) or prop expression(address.city)"

func GetVariableFromList

func GetVariableFromList(name string, list []domain.GlobalVar) (ret domain.ExecVariable, err error)

func InitDebugExecContext

func InitDebugExecContext(execUuid string) (variables []domain.ExecVariable)

func InitJsRuntime

func InitJsRuntime(tenantId consts.TenantId, projectId uint, execUuid string)

func InitScenarioExecContext

func InitScenarioExecContext(execObj *ScenarioExecObj) (variables []domain.ExecVariable)

func InitUserExecContext

func InitUserExecContext(execUuid string)

func Invoke

func Invoke(req *domain.BaseRequest) (resp domain.DebugResponse, err error)

func ListScopeCookie

func ListScopeCookie(processorId uint, execUuid string) (cookies []domain.ExecCookie)

func MergeGlobalParams

func MergeGlobalParams(globalParams, selfGlobalParam []domain.GlobalParam) (ret []domain.GlobalParam)

func OpenMySqlDb

func OpenMySqlDb(opt *domain.DatabaseOptBase) (db *gorm.DB, err error)

func OpenOracle

func OpenOracle(opt *domain.DatabaseOptBase) (db *sql.DB, err error)

func OpenPostgreSQL

func OpenPostgreSQL(opt *domain.DatabaseOptBase) (db *gorm.DB, err error)

func OpenSqlServer

func OpenSqlServer(opt *domain.DatabaseOptBase) (db *gorm.DB, err error)

func ParseChaiAssertion

func ParseChaiAssertion(output string) (status, name, checkpoint string)

func ReadDataFromExcel

func ReadDataFromExcel(url string) (ret []domain.VarKeyValuePair, err error)

func ReadDataFromText

func ReadDataFromText(url, separator string) (ret []domain.VarKeyValuePair, err error)

func ReplaceDatapoolVariInGovaluateExpress

func ReplaceDatapoolVariInGovaluateExpress(expression string, execUuid string) (ret string)

func ReplacePathParams

func ReplacePathParams(uri string, pathParams []domain.Param) (ret string)

func ReplaceVariableValue

func ReplaceVariableValue(value string, execUuid string) (ret string)

func ReplaceVariableValueInBody

func ReplaceVariableValueInBody(value string, execUuid string) (ret string)

func ReplaceVariables

func ReplaceVariables(req *domain.BaseRequest, execUuid string)

func ResetGojaLogs

func ResetGojaLogs(execUuid string)

func ResetGojaVariables

func ResetGojaVariables(execUuid string)

func ResetStat

func ResetStat(execUuid string)

func SetCookie

func SetCookie(processorId uint, cookieName string, cookieValue string, domainName string, expireTime *time.Time, execUuid string) (err error)

func SetCurrDebugInterfaceId

func SetCurrDebugInterfaceId(execUuid string, val uint)

func SetCurrEnvironmentId

func SetCurrEnvironmentId(execUuid string, id int)

func SetCurrRequest

func SetCurrRequest(execUuid string, val domain.BaseRequest)

func SetCurrResponse

func SetCurrResponse(execUuid string, val domain.DebugResponse)

func SetCurrScenarioProcessor

func SetCurrScenarioProcessor(execUuid string, val *Processor)

func SetCurrScenarioProcessorId

func SetCurrScenarioProcessorId(execUuid string, val uint)

func SetDatapoolCursor

func SetDatapoolCursor(execUuid string, val map[string]int)

func SetExecScene

func SetExecScene(execUuid string, val domain.ExecScene)

func SetForceStopExec

func SetForceStopExec(execUuid string, val bool)

func SetGojaLogs

func SetGojaLogs(execUuid string, val *[]string)

func SetGojaVariables

func SetGojaVariables(execUuid string, val *[]domain.ExecVariable)

func SetInterfaceStat

func SetInterfaceStat(execUuid string, val *agentDomain.InterfaceStat)

func SetIsRunning

func SetIsRunning(execUuid string, val bool)

func SetReqValueToGoja

func SetReqValueToGoja(req *domain.BaseRequest)

func SetRespValueToGoja

func SetRespValueToGoja(resp *domain.DebugResponse)

func SetScopeHierarchy

func SetScopeHierarchy(execUuid string, val map[uint]*[]uint)

func SetScopedCookies

func SetScopedCookies(execUuid string, val map[uint][]domain.ExecCookie)

func SetScopedVariables

func SetScopedVariables(execUuid string, val map[uint][]domain.ExecVariable)

func SetServerToken

func SetServerToken(execUuid string, val string)

func SetServerUrl

func SetServerUrl(execUuid string, val string)

func SetValueToGoja

func SetValueToGoja(name string, value interface{})

func SetVariable

func SetVariable(processorId uint, variableName string, variableValue interface{},
	variableType consts.ExtractorResultType, scope consts.ExtractorScope, execUuid string) (
	newVariable domain.ExecVariable, err error)

SetVariable @Param processorId int true "Processor Id, 0 if NOT executed by a scenario processor"

Types

type CaseExecProcessor

type CaseExecProcessor struct {
	Title    string `json:"tile"`
	Key      string `json:"key"`
	ExecUUid string `json:"execUUid"`
	Category string `json:"type"`

	Children []*CaseExecProcessor `json:"children"`

	Data *InterfaceExecObj `json:"data"`
}

type CasesExecReq

type CasesExecReq struct {
	ExecUuid  string `json:"execUuid"`
	ServerUrl string `json:"serverUrl"`
	Token     string `json:"token"`

	UserId     uint          `json:"projectId"`
	ProjectId  uint          `json:"projectId"`
	BaseCaseId uint          `json:"baseCaseId"`
	UsedBy     consts.UsedBy `json:"usedBy"`

	ExecObj  casesHelper.AlternativeCase `json:"cases"`
	ExecType string                      `json:"type"`

	EnvironmentId uint            `json:"environmentId"`
	TenantId      consts.TenantId `json:"tenantId"`
}

type IProcessorEntity

type IProcessorEntity interface {
	Run(*Processor, *Session) error
}

type InterfaceExecObj

type InterfaceExecObj struct {
	DebugData domain.DebugData `json:"debugData"`

	PreConditions  []domain.InterfaceExecCondition `json:"preConditions"`
	PostConditions []domain.InterfaceExecCondition `json:"postConditions"`

	ExecScene domain.ExecScene `json:"execScene"`
	TenantId  consts.TenantId  `json:"tenantId"`
}

type MessageExecObj

type MessageExecObj struct {
	Count uint `json:"count"`
}

type MessageExecReq

type MessageExecReq struct {
	UserId    uint            `json:"userId"`
	ServerUrl string          `json:"serverUrl"`
	Token     string          `json:"token"`
	TenantId  consts.TenantId `json:"tenantId"`
}

type PlanExecObj

type PlanExecObj struct {
	Name      string            `json:"name"`
	Scenarios []ScenarioExecObj `json:"scenarios"`

	ServerUrl string `json:"serverUrl"`
	Token     string `json:"token"`
}

type PlanExecReq

type PlanExecReq struct {
	ExecUuid      string          `json:"execUuid"`
	ServerUrl     string          `json:"serverUrl"`
	Token         string          `json:"token"`
	PlanId        int             `json:"planId"`
	EnvironmentId int             `json:"environmentId"`
	TenantId      consts.TenantId `json:"tenantId"`
}

type Processor

type Processor struct {
	ProcessorBase
	Entity  IProcessorEntity `json:"entity"`
	Disable bool             `json:"disable"`
}

func GetCurrScenarioProcessor

func GetCurrScenarioProcessor(execUuid string) (ret *Processor)

func (*Processor) AddResultToParent

func (p *Processor) AddResultToParent() (err error)

func (*Processor) AppendNewChildProcessor

func (p *Processor) AppendNewChildProcessor(category consts.ProcessorCategory, typ consts.ProcessorType) (child Processor)

func (*Processor) Error

func (p *Processor) Error(s *Session, err interface{})

func (*Processor) RestoreEntity

func (p *Processor) RestoreEntity() (err error)

func (*Processor) Run

func (p *Processor) Run(s *Session) (err error)

type ProcessorAssertion

type ProcessorAssertion struct {
	ID uint `json:"id" yaml:"id"`
	ProcessorEntityBase

	Expression string `json:"expression" yaml:"expression"`
}

func (ProcessorAssertion) Run

func (entity ProcessorAssertion) Run(processor *Processor, session *Session) (err error)

type ProcessorBase

type ProcessorBase struct {
	ID uint `json:"id"`

	Name     string            `json:"name"`
	Comments string            `json:"comments"`
	Method   consts.HttpMethod `json:"method" yaml:"method"`

	ParentId   uint `json:"parentId"`
	ScenarioId uint `json:"scenarioId"`
	ProjectId  uint `json:"projectId"`
	UseID      uint `json:"useId"`

	EntityCategory      consts.ProcessorCategory `json:"entityCategory"`
	EntityType          consts.ProcessorType     `json:"entityType"`
	EntityId            uint                     `json:"entityId"`
	EndpointInterfaceId uint                     `json:"endpointInterfaceId"`

	Ordr      int             `json:"ordr"`
	Children  []*Processor    `json:"children"`
	Slots     iris.Map        `json:"slots"`
	IsDir     bool            `json:"isDir"`
	EntityRaw json.RawMessage `json:"entityRaw"`

	Parent                *Processor                      `json:"-"`
	Result                *agentDomain.ScenarioExecResult `json:"result"`
	ProcessorInterfaceSrc consts.ProcessorInterfaceSrc    `json:"processorInterfaceSrc"`

	Round string `json:"round"`

	Session Session `json:"-"`
}

type ProcessorCookie

type ProcessorCookie struct {
	ID uint `json:"id" yaml:"id"`
	ProcessorEntityBase

	CookieName   string     `json:"cookieName" yaml:"cookieName"`
	VariableName string     `json:"variableName" yaml:"variableName"`
	RightValue   string     `json:"rightValue" yaml:"rightValue"`
	Domain       string     `json:"domain" yaml:"domain"`
	ExpireTime   *time.Time `json:"expireTime" yaml:"expireTime"`

	Children []interface{} `json:"children" yaml:"children" gorm:"-"`
}

func (ProcessorCookie) Run

func (entity ProcessorCookie) Run(processor *Processor, session *Session) (err error)

type ProcessorCustomCode

type ProcessorCustomCode struct {
	ID uint `json:"id" yaml:"id"`
	ProcessorEntityBase
	TenantId consts.TenantId `json:"tenantId"`
	Content  string          `gorm:"type:longtext;" json:"content" yaml:"content"`
	Desc     string          `json:"desc" yaml:"desc"`
}

func (ProcessorCustomCode) Run

func (entity ProcessorCustomCode) Run(processor *Processor, session *Session) (err error)

type ProcessorData

type ProcessorData struct {
	ID uint `json:"id" yaml:"id"`
	ProcessorEntityBase

	Src          consts.DataItSrc  `json:"src" yaml:"src"`
	Type         consts.DataItType `json:"type,omitempty" yaml:"type,omitempty"`
	Url          string            `json:"url,omitempty" yaml:"url,omitempty"`
	DatapoolId   uint              `json:"datapoolId,omitempty" yaml:"datapoolId,omitempty"`
	DatapoolName string            `json:"datapoolName,omitempty" yaml:"datapoolName,omitempty"`
	Separator    string            `json:"separator,omitempty" yaml:"separator,omitempty"`

	RepeatTimes int `json:"repeatTimes,omitempty" yaml:"repeatTimes,omitempty"`

	IsLoop int  `json:"isLoop,omitempty" yaml:"isLoop,omitempty"`
	IsRand bool `json:"isRand,omitempty" yaml:"isRand,omitempty"`
	IsOnce bool `json:"isOnce,omitempty" yaml:"isOnce,omitempty"`

	VariableName string `json:"variableName,omitempty" yaml:"variableName,omitempty"`
}

func (*ProcessorData) GenerateLoopList

func (entity *ProcessorData) GenerateLoopList(session *Session) (ret agentDomain.ExecIterator, err error)

func (ProcessorData) Run

func (entity ProcessorData) Run(processor *Processor, session *Session) (err error)

type ProcessorEntityBase

type ProcessorEntityBase struct {
	Name     string `gorm:"-" json:"name"`
	Comments string `json:"comments"`
	Default  string `json:"default"`

	ProcessorID       uint                     `json:"processorID" yaml:"processorID"`
	ProcessorCategory consts.ProcessorCategory `json:"processorCategory" yaml:"processorCategory"`
	ProcessorType     consts.ProcessorType     `json:"processorType" yaml:"processorType"`
	ParentID          uint                     `json:"parentID" yaml:"parentID"`
}

type ProcessorGroup

type ProcessorGroup struct {
	ID uint `json:"id" yaml:"id"`
	ProcessorEntityBase
}

func (ProcessorGroup) Run

func (entity ProcessorGroup) Run(processor *Processor, session *Session) (err error)

type ProcessorInterface

type ProcessorInterface struct {
	ID uint `json:"id"`
	ProcessorEntityBase

	domain.BaseRequest
	Response domain.DebugResponse `json:"response"`

	BaseUrl string `json:"baseUrl"`

	PreConditions  []domain.InterfaceExecCondition `json:"preConditions"`
	PostConditions []domain.InterfaceExecCondition `json:"postConditions"`
}

func (*ProcessorInterface) DealwithCheckpointCondition

func (entity *ProcessorInterface) DealwithCheckpointCondition(condition domain.InterfaceExecCondition,
	interfaceStatus *consts.ResultStatus, conditions *[]domain.InterfaceExecCondition,
	detail *map[string]interface{}, execUuid string)

func (*ProcessorInterface) DealwithDatabaseOptCondition

func (entity *ProcessorInterface) DealwithDatabaseOptCondition(condition domain.InterfaceExecCondition,
	processorId, parentId uint, conditions *[]domain.InterfaceExecCondition, execUuid string)

func (*ProcessorInterface) DealwithExtractorCondition

func (entity *ProcessorInterface) DealwithExtractorCondition(condition domain.InterfaceExecCondition,
	processorId, parentId uint, conditions *[]domain.InterfaceExecCondition, execUuid string)

func (*ProcessorInterface) DealwithResponseDefineCondition

func (entity *ProcessorInterface) DealwithResponseDefineCondition(condition domain.InterfaceExecCondition,
	interfaceStatus *consts.ResultStatus, conditions *[]domain.InterfaceExecCondition,
	detail *map[string]interface{}, execUuid string)

func (*ProcessorInterface) DealwithScriptCondition

func (entity *ProcessorInterface) DealwithScriptCondition(condition domain.InterfaceExecCondition,
	interfaceStatus *consts.ResultStatus, tenantId consts.TenantId, projectId uint, conditions *[]domain.InterfaceExecCondition,
	execUuid string, isPostCondition bool)

func (*ProcessorInterface) ExecPostConditions

func (entity *ProcessorInterface) ExecPostConditions(processor *Processor, detail *map[string]interface{}, session *Session) (
	interfaceStatus consts.ResultStatus, err error)

func (*ProcessorInterface) ExecPreConditions

func (entity *ProcessorInterface) ExecPreConditions(processor *Processor, session *Session) (err error)

func (*ProcessorInterface) GenResultFromResponse

func (entity *ProcessorInterface) GenResultFromResponse(
	processor *Processor, baseRequest domain.BaseRequest, requestEndTime, requestStartTime time.Time,
	detail *map[string]interface{}, session *Session, err error) (ok bool)

func (ProcessorInterface) Run

func (entity ProcessorInterface) Run(processor *Processor, session *Session) (err error)

type ProcessorLogic

type ProcessorLogic struct {
	ID uint `json:"id" yaml:"id"`
	ProcessorEntityBase

	Expression string `json:"expression" yaml:"expression"`
}

func (ProcessorLogic) Run

func (entity ProcessorLogic) Run(processor *Processor, session *Session) (err error)

type ProcessorLoop

type ProcessorLoop struct {
	ID uint `json:"id" yaml:"id"`
	ProcessorEntityBase

	Times int    `json:"times" yaml:"times"` // time
	Range string `json:"range" yaml:"range"` // range

	InType   string `json:"inType" yaml:"inType"`     // in
	Variable string `json:"variable" yaml:"variable"` // array
	List     string `json:"list" yaml:"list"`         // list

	Step         string `json:"step" yaml:"step"`
	IsRand       bool   `json:"isRand" yaml:"isRand"`
	VariableName string `json:"variableName" yaml:"variableName"`

	UntilExpression   string `json:"untilExpression" yaml:"untilExpression"` // until
	BreakIfExpression string `json:"breakIfExpression" yaml:"breakIfExpression"`
}

func (*ProcessorLoop) GenerateLoopList

func (entity *ProcessorLoop) GenerateLoopList() (ret agentDomain.ExecIterator, err error)

func (*ProcessorLoop) GenerateLoopRange

func (entity *ProcessorLoop) GenerateLoopRange() (ret agentDomain.ExecIterator, err error)

func (*ProcessorLoop) GenerateLoopTimes

func (entity *ProcessorLoop) GenerateLoopTimes() (ret agentDomain.ExecIterator, err error)

func (*ProcessorLoop) GenerateLoopVariable

func (entity *ProcessorLoop) GenerateLoopVariable(execUuid string) (ret agentDomain.ExecIterator, err error)

func (ProcessorLoop) Run

func (entity ProcessorLoop) Run(processor *Processor, session *Session) (err error)

type ProcessorMsg

type ProcessorMsg struct {
	ProcessorBase
}

type ProcessorPrint

type ProcessorPrint struct {
	ID uint `json:"id" yaml:"id"`
	ProcessorEntityBase

	RightValue string `json:"rightValue" yaml:"rightValue"`
}

func (ProcessorPrint) Run

func (entity ProcessorPrint) Run(processor *Processor, session *Session) (err error)

type ProcessorRoot

type ProcessorRoot struct {
	ID uint `json:"id" yaml:"id"`
	ProcessorEntityBase
}

func (ProcessorRoot) Run

func (entity ProcessorRoot) Run(processor *Processor, session *Session) (err error)

type ProcessorTimer

type ProcessorTimer struct {
	ID uint `json:"id" yaml:"id"`
	ProcessorEntityBase

	SleepTime int `json:"sleepTime" yaml:"sleepTime"`
}

func (ProcessorTimer) Run

func (entity ProcessorTimer) Run(processor *Processor, session *Session) (err error)

type ProcessorVariable

type ProcessorVariable struct {
	ID uint `json:"id" yaml:"id"`
	ProcessorEntityBase

	VariableName string `json:"variableName" yaml:"variableName"`
	Expression   string `json:"expression" yaml:"expression"`
}

func (ProcessorVariable) Run

func (entity ProcessorVariable) Run(processor *Processor, session *Session) (err error)

type Report

type Report struct {
	ID uint `json:"id"`

	Name string `json:"name"`
	Desc string `json:"desc"`

	ProgressStatus consts.ProgressStatus `json:"progressStatus"`
	ResultStatus   consts.ResultStatus   `json:"resultStatus"`

	StartTime *time.Time `json:"startTime"`
	EndTime   *time.Time `json:"endTime"`
	Duration  int64      `json:"duration"` // sec

	TotalInterfaceNum int `json:"totalInterfaceNum"`
	PassInterfaceNum  int `json:"passInterfaceNum"`
	FailInterfaceNum  int `json:"failInterfaceNum"`

	TotalRequestNum int `json:"totalRequestNum"`
	PassRequestNum  int `json:"passRequestNum"`
	FailRequestNum  int `json:"failRequestNum"`

	TotalAssertionNum int `json:"totalAssertionNum"`
	PassAssertionNum  int `json:"passAssertionNum"`
	FailAssertionNum  int `json:"failAssertionNum"`

	InterfaceStatusMap map[uint]map[consts.ResultStatus]int `json:"interfaceStatusMap"`

	Payload string `json:"payload"`

	ScenarioId uint `json:"scenarioId"`
	ProjectId  uint `json:"projectId"`

	Logs []*agentDomain.ScenarioExecResult `json:"logs"`
}

type ScenarioExecObj

type ScenarioExecObj struct {
	ScenarioExecObjBase
	RootProcessor *Processor `json:"rootProcessor"`
}

type ScenarioExecObjBase

type ScenarioExecObjBase struct {
	ScenarioId uint   `json:"scenarioId"`
	Name       string `json:"name"`

	BaseUrl string `json:"baseUrl"`

	ExecScene domain.ExecScene `json:"execScene"`

	ExecUuid  string          `json:"execUuid"`
	ServerUrl string          `json:"serverUrl"`
	Token     string          `json:"token"`
	TenantId  consts.TenantId `json:"tenantId"`
}

type ScenarioExecObjMsg

type ScenarioExecObjMsg struct {
	ScenarioExecObjBase
	RootProcessor *ProcessorMsg `json:"rootProcessor"`
}

type ScenarioExecReq

type ScenarioExecReq struct {
	ExecUuid   string          `json:"execUuid"`
	ServerUrl  string          `json:"serverUrl"`
	Token      string          `json:"token"`
	TenantId   consts.TenantId `json:"tenantId"`
	ScenarioId int             `json:"scenarioId"`

	EnvironmentId int `json:"environmentId"`
}

type Session

type Session struct {
	ExecUuid   string
	ScenarioId uint
	Name       string
	TenantId   consts.TenantId `json:"tenantId"`

	HttpClient  *http.Client
	Http2Client *http.Client
	Failfast    bool

	RootProcessor *Processor
	Report        *Report

	WsMsg *websocket.Message
}

func NewSession

func NewSession(req *ScenarioExecObj, failfast bool, wsMsg *websocket.Message) (ret *Session)

func (*Session) Run

func (s *Session) Run()

type UserContext

type UserContext struct {
	IsRunning     bool
	ForceStopExec bool

	ServerUrl   string
	ServerToken string

	// used to exchange request and response data between goja and go
	CurrRequest  domain.BaseRequest
	CurrResponse domain.DebugResponse

	CurrScenarioProcessor   *Processor
	CurrScenarioProcessorId uint
	CurrDebugInterfaceId    uint
	CurrEnvironmentId       int

	ScopedVariables map[uint][]domain.ExecVariable // for scenario and debug
	ScopedCookies   map[uint][]domain.ExecCookie   // only for scenario
	ScopeHierarchy  map[uint]*[]uint               // only for scenario (processId -> ancestorProcessIds)

	ExecScene      domain.ExecScene // for scenario and debug, from server
	DatapoolCursor map[string]int   // only for scenario

	// for report data
	InterfaceStat *agentDomain.InterfaceStat

	// for goja js engine
	GojaVariables *[]domain.ExecVariable
	GojaLogs      *[]string
}

func GetUserExecContext

func GetUserExecContext(execUuid string) (val *UserContext)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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