mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-31 13:29:35 +08:00
refactor: IStep interface
This commit is contained in:
16
validate.go
16
validate.go
@@ -1,9 +1,11 @@
|
||||
package httpboomer
|
||||
|
||||
import "fmt"
|
||||
|
||||
// implements IStep interface
|
||||
type stepRequestValidation struct {
|
||||
runner *Runner
|
||||
TStep *TStep
|
||||
step *TStep
|
||||
}
|
||||
|
||||
func (s *stepRequestValidation) AssertEqual(jmesPath string, expected interface{}, msg string) *stepRequestValidation {
|
||||
@@ -13,14 +15,18 @@ func (s *stepRequestValidation) AssertEqual(jmesPath string, expected interface{
|
||||
Expect: expected,
|
||||
Message: msg,
|
||||
}
|
||||
s.TStep.Validators = append(s.TStep.Validators, validator)
|
||||
s.step.Validators = append(s.step.Validators, validator)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *stepRequestValidation) ToStruct() *TStep {
|
||||
return s.TStep
|
||||
func (s *stepRequestValidation) Name() string {
|
||||
return s.step.Name
|
||||
}
|
||||
|
||||
func (s *stepRequestValidation) Type() string {
|
||||
return fmt.Sprintf("request-%v", s.step.Request.Method)
|
||||
}
|
||||
|
||||
func (s *stepRequestValidation) Run() error {
|
||||
return s.runner.runStep(s.TStep)
|
||||
return s.runner.runStep(s.step)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user