mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-10 17:43:00 +08:00
feat: add parameterization support for test cases and steps with configuration options
This commit is contained in:
@@ -543,6 +543,26 @@ func (s *StepRequest) WithVariables(variables map[string]interface{}) *StepReque
|
||||
return s
|
||||
}
|
||||
|
||||
// WithParameters sets parameters for step-level data driven
|
||||
func (s *StepRequest) WithParameters(parameters map[string]interface{}) *StepRequest {
|
||||
s.Parameters = parameters
|
||||
return s
|
||||
}
|
||||
|
||||
// WithParametersSetting sets parameters setting for step-level data driven
|
||||
func (s *StepRequest) WithParametersSetting(options ...ParametersOption) *StepRequest {
|
||||
if s.ParametersSetting == nil {
|
||||
s.ParametersSetting = &TParamsConfig{}
|
||||
}
|
||||
|
||||
// apply all options
|
||||
for _, option := range options {
|
||||
option(s.ParametersSetting)
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// SetupHook adds a setup hook for current teststep.
|
||||
func (s *StepRequest) SetupHook(hook string) *StepRequest {
|
||||
s.SetupHooks = append(s.SetupHooks, hook)
|
||||
@@ -557,7 +577,7 @@ func (s *StepRequest) HTTP2() *StepRequest {
|
||||
return s
|
||||
}
|
||||
|
||||
// Loop specify running times for the current step
|
||||
// Loop sets loop count for step execution.
|
||||
func (s *StepRequest) Loop(times int) *StepRequest {
|
||||
s.Loops = times
|
||||
return s
|
||||
|
||||
Reference in New Issue
Block a user