fix: return checkExpr info when do assertion failed

This commit is contained in:
buyuxiang
2022-02-28 17:45:28 +08:00
parent cf9190ab18
commit 31e2fb61de

View File

@@ -160,7 +160,7 @@ func (v *responseObject) Validate(validators []Validator, variablesMapping map[s
} }
v.validationResults = append(v.validationResults, validResult) v.validationResults = append(v.validationResults, validResult)
log.Info(). log.Info().
Str("jmespath", validator.Check). Str("checkExpr", validator.Check).
Str("assertMethod", assertMethod). Str("assertMethod", assertMethod).
Interface("expectValue", expectValue). Interface("expectValue", expectValue).
Interface("checkValue", checkValue). Interface("checkValue", checkValue).
@@ -169,7 +169,7 @@ func (v *responseObject) Validate(validators []Validator, variablesMapping map[s
if !result { if !result {
v.t.Fail() v.t.Fail()
return errors.New(fmt.Sprintf( return errors.New(fmt.Sprintf(
"do assertion failed, jmespath: %v, assertMethod: %v, checkValue: %v, expectValue: %v", "do assertion failed, checkExpr: %v, assertMethod: %v, checkValue: %v, expectValue: %v",
validator.Check, validator.Check,
assertMethod, assertMethod,
checkValue, checkValue,