From 9d8ebadd8e120adbd82bc12e66bcdbc8a421addb Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Wed, 4 Sep 2024 14:10:28 +0800 Subject: [PATCH] feat: add ActionResult --- hrp/step.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hrp/step.go b/hrp/step.go index 94e9287c..328f8343 100644 --- a/hrp/step.go +++ b/hrp/step.go @@ -18,17 +18,27 @@ const ( stepTypeSuffixValidation StepType = "_validation" ) +// one step contains one or multiple actions +type ActionResult struct { + Name string `json:"name"` // action name + StartTime int64 `json:"start_time"` // action start time + Elapsed int64 `json:"elapsed_ms"` // action elapsed time(ms) + Error error `json:"error"` // action execution result +} + +// one testcase contains one or multiple steps type StepResult struct { Name string `json:"name" yaml:"name"` // step name - Identifier string `json:"identifier" yaml:"identifier"` // step identifier + Identifier string `json:"identifier,omitempty" yaml:"identifier,omitempty"` // step identifier StartTime int64 `json:"start_time" yaml:"time"` // step start time StepType StepType `json:"step_type" yaml:"step_type"` // step type, testcase/request/transaction/rendezvous Success bool `json:"success" yaml:"success"` // step execution result Elapsed int64 `json:"elapsed_ms" yaml:"elapsed_ms"` // step execution time in millisecond(ms) HttpStat map[string]int64 `json:"httpstat,omitempty" yaml:"httpstat,omitempty"` // httpstat in millisecond(ms) - Data interface{} `json:"data,omitempty" yaml:"data,omitempty"` // step data, *StepResult or []*StepResult + Data interface{} `json:"data,omitempty" yaml:"data,omitempty"` // step data ContentSize int64 `json:"content_size" yaml:"content_size"` // response body length ExportVars map[string]interface{} `json:"export_vars,omitempty" yaml:"export_vars,omitempty"` // extract variables + Actions []*ActionResult `json:"actions,omitempty" yaml:"actions,omitempty"` // store action execution info Attachments interface{} `json:"attachments,omitempty" yaml:"attachments,omitempty"` // store extra step information, such as error message or screenshots }