mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-08 01:09:44 +08:00
fix: no error is logged when the assertion fails
This commit is contained in:
@@ -66,6 +66,7 @@ func (s *requestStats) logTransaction(name string, success bool, responseTime in
|
|||||||
s.transactionPassed++
|
s.transactionPassed++
|
||||||
} else {
|
} else {
|
||||||
s.transactionFailed++
|
s.transactionFailed++
|
||||||
|
s.get(name, "transaction").logError("")
|
||||||
}
|
}
|
||||||
s.get(name, "transaction").log(responseTime, contentLength)
|
s.get(name, "transaction").log(responseTime, contentLength)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package hrp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -131,6 +133,12 @@ func (v *responseObject) Validate(validators []Validator, variablesMapping map[s
|
|||||||
Msgf("validate %s", checkItem)
|
Msgf("validate %s", checkItem)
|
||||||
if !result {
|
if !result {
|
||||||
v.t.Fail()
|
v.t.Fail()
|
||||||
|
return errors.New(fmt.Sprintf(
|
||||||
|
"do assertion failed, assertMethod: %v, expectValue: %v, checkValue: %v",
|
||||||
|
assertMethod,
|
||||||
|
expectValue,
|
||||||
|
checkValue,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user