diff --git a/internal/boomer/stats.go b/internal/boomer/stats.go index 53b4f707..57af9654 100644 --- a/internal/boomer/stats.go +++ b/internal/boomer/stats.go @@ -66,6 +66,7 @@ func (s *requestStats) logTransaction(name string, success bool, responseTime in s.transactionPassed++ } else { s.transactionFailed++ + s.get(name, "transaction").logError("") } s.get(name, "transaction").log(responseTime, contentLength) } diff --git a/response.go b/response.go index e57608fe..77abb4dc 100644 --- a/response.go +++ b/response.go @@ -2,12 +2,14 @@ package hrp import ( "encoding/json" + "fmt" "io/ioutil" "net/http" "strings" "testing" "github.com/jmespath/go-jmespath" + "github.com/pkg/errors" "github.com/rs/zerolog/log" "github.com/httprunner/hrp/internal/builtin" @@ -131,6 +133,12 @@ func (v *responseObject) Validate(validators []Validator, variablesMapping map[s Msgf("validate %s", checkItem) if !result { v.t.Fail() + return errors.New(fmt.Sprintf( + "do assertion failed, assertMethod: %v, expectValue: %v, checkValue: %v", + assertMethod, + expectValue, + checkValue, + )) } } return nil