change: remove unused session data in step result

This commit is contained in:
lilong.129
2024-11-19 21:00:09 +08:00
parent 3e9d4fee9e
commit a813f966d7
6 changed files with 25 additions and 24 deletions

View File

@@ -1 +1 @@
v5.0.0+2411192052
v5.0.0+2411192100

View File

@@ -59,18 +59,18 @@ type ActionResult struct {
// one testcase contains one or multiple steps
type StepResult struct {
Name string `json:"name" yaml:"name"` // step name
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
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
Name string `json:"name" yaml:"name"` // step name
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
ContentSize int64 `json:"content_size,omitempty" yaml:"content_size,omitempty"` // 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
}
// IStep represents interface for all types for teststeps, includes:

View File

@@ -753,9 +753,12 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err
}
return
}
sessionData := newSessionData()
sessionData.Validators = validateResults
stepResult.Data = sessionData
if len(validateResults) > 0 {
sessionData := &SessionData{
Validators: validateResults,
}
stepResult.Data = sessionData
}
stepResult.Success = true
return stepResult, nil
}

View File

@@ -301,7 +301,9 @@ func runStepRequest(r *SessionRunner, step IStep) (stepResult *StepResult, err e
return
}
sessionData := newSessionData()
sessionData := &SessionData{
ReqResps: &ReqResps{},
}
parser := r.caseRunner.parser
config := r.caseRunner.Config.Get()

View File

@@ -290,7 +290,9 @@ func runStepWebSocket(r *SessionRunner, step IStep) (stepResult *StepResult, err
stepResult.Elapsed = time.Since(start).Milliseconds()
}()
sessionData := newSessionData()
sessionData := &SessionData{
ReqResps: &ReqResps{},
}
parser := r.caseRunner.parser
config := r.caseRunner.Config.Get()

View File

@@ -227,12 +227,6 @@ type TestCaseInOut struct {
ExportVars map[string]interface{} `json:"export_vars" yaml:"export_vars"`
}
func newSessionData() *SessionData {
return &SessionData{
ReqResps: &ReqResps{},
}
}
type SessionData struct {
ReqResps *ReqResps `json:"req_resps" yaml:"req_resps"`
Address *Address `json:"address,omitempty" yaml:"address,omitempty"` // TODO