mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-31 21:39:41 +08:00
feat: record execution data for report #25
This commit is contained in:
16
response.go
16
response.go
@@ -79,7 +79,7 @@ type responseObject struct {
|
||||
t *testing.T
|
||||
parser *parser
|
||||
respObjMeta interface{}
|
||||
validationResults map[string]interface{}
|
||||
validationResults []*validationResult
|
||||
}
|
||||
|
||||
func (v *responseObject) Extract(extractors map[string]string) map[string]interface{} {
|
||||
@@ -122,9 +122,23 @@ func (v *responseObject) Validate(validators []Validator, variablesMapping map[s
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
validResult := &validationResult{
|
||||
Validator: Validator{
|
||||
Check: validator.Check,
|
||||
Expect: expectValue,
|
||||
Assert: assertMethod,
|
||||
Message: validator.Message,
|
||||
},
|
||||
CheckValue: checkValue,
|
||||
CheckResult: "fail",
|
||||
}
|
||||
|
||||
// do assertion
|
||||
result := assertFunc(v.t, expectValue, checkValue)
|
||||
if result {
|
||||
validResult.CheckResult = "pass"
|
||||
}
|
||||
v.validationResults = append(v.validationResults, validResult)
|
||||
log.Info().
|
||||
Str("assertMethod", assertMethod).
|
||||
Interface("expectValue", expectValue).
|
||||
|
||||
Reference in New Issue
Block a user