Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #60 from xucong053/main
Browse files Browse the repository at this point in the history
fix: no error is logged when the assertion fails
  • Loading branch information
debugtalk committed Jan 18, 2022
2 parents 3f0abd4 + a89e956 commit 486d549
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/boomer/stats.go
Expand Up @@ -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)
}
Expand Down
8 changes: 8 additions & 0 deletions response.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 486d549

Please sign in to comment.