Repository: httprunner/httprunner (language: python)

Issue:
AssertGreaterOrEqual("body.data.total", 1, "check total")断言失败
## 问题描述
大于等于的断言一直失败
#### response：
`{"code":0,"success":true,"message":"ok","data":{"categories":[{"id":"623869e1ebe8ba000145b3d2","name":"默认分类1","is_default":false},{"id":"61dcfca9bb6c6a00142a1cc9","name":"默认分类","is_default":false}],"total":2}}
`

#### 断言log
```
AssertGreaterOrEqual("body.data.total", 1, "check total")
{"level":"error","error":"do assertion failed, checkExpr: body.data.total, assertMethod: greater_or_equals, checkValue: 2, expectValue: 1","time":"2022-04-07T15:23:17+08:00","message":"run request step failed"}
```
<img width="685" alt="image" src="https://user-images.githubusercontent.com/15335697/162659890-341f4d78-2522-4c93-a5ad-f7b2470b6b05.png">

## 版本信息

请提供如下版本信息：

 - 	github.com/httprunner/hrp v0.8.0




Discussion / hints:

Fix patch:
diff --git a/hrp/internal/builtin/utils.go b/hrp/internal/builtin/utils.go
index 2e70f906e..47654912e 100644
--- a/hrp/internal/builtin/utils.go
+++ b/hrp/internal/builtin/utils.go
@@ -9,6 +9,7 @@ import (
 	"os"
 	"os/exec"
 	"path/filepath"
+	"reflect"
 	"strconv"
 	"strings"
 
@@ -198,6 +199,39 @@ func Interface2Float64(i interface{}) (float64, error) {
 	return 0, errors.New("failed to convert interface to float64")
 }
 
+func TypeNormalization(raw interface{}) interface{} {
+	rawValue := reflect.ValueOf(raw)
+	switch rawValue.Kind() {
+	case reflect.Int:
+		return rawValue.Int()
+	case reflect.Int8:
+		return rawValue.Int()
+	case reflect.Int16:
+		return rawValue.Int()
+	case reflect.Int32:
+		return rawValue.Int()
+	case reflect.Float32:
+		return rawValue.Float()
+	case reflect.Uint:
+		return rawValue.Uint()
+	case reflect.Uint8:
+		return rawValue.Uint()
+	case reflect.Uint16:
+		return rawValue.Uint()
+	case reflect.Uint32:
+		return rawValue.Uint()
+	default:
+		return raw
+	}
+}
+
+func InterfaceType(raw interface{}) string {
+	if raw == nil {
+		return ""
+	}
+	return reflect.TypeOf(raw).String()
+}
+
 var ErrUnsupportedFileExt = fmt.Errorf("unsupported file extension")
 
 // LoadFile loads file content with file extension and assigns to structObj
diff --git a/hrp/parser.go b/hrp/parser.go
index 1e5c6b077..46ab0f47a 100644
--- a/hrp/parser.go
+++ b/hrp/parser.go
@@ -117,7 +117,7 @@ func (p *Parser) Parse(raw interface{}, variablesMapping map[string]interface{})
 		return parsedMap, nil
 	default:
 		// other types, e.g. nil, int, float, bool
-		return raw, nil
+		return builtin.TypeNormalization(raw), nil
 	}
 }
 
diff --git a/hrp/response.go b/hrp/response.go
index 1396f2e20..af7268372 100644
--- a/hrp/response.go
+++ b/hrp/response.go
@@ -170,7 +170,9 @@ func (v *responseObject) Validate(iValidators []interface{}, variablesMapping ma
 			Str("checkExpr", validator.Check).
 			Str("assertMethod", assertMethod).
 			Interface("expectValue", expectValue).
+			Str("expectValueType", builtin.InterfaceType(expectValue)).
 			Interface("checkValue", checkValue).
+			Str("checkValueType", builtin.InterfaceType(checkValue)).
 			Bool("result", result).
 			Msgf("validate %s", checkItem)
 		if !result {
@@ -179,7 +181,9 @@ func (v *responseObject) Validate(iValidators []interface{}, variablesMapping ma
 				Str("checkExpr", validator.Check).
 				Str("assertMethod", assertMethod).
 				Interface("checkValue", checkValue).
+				Str("checkValueType", builtin.InterfaceType(checkValue)).
 				Interface("expectValue", expectValue).
+				Str("expectValueType", builtin.InterfaceType(expectValue)).
 				Msg("assert failed")
 			return errors.New("step validation failed")
 		}


Test patch:
diff --git a/hrp/parser_test.go b/hrp/parser_test.go
index 41b376b82..a0311a71b 100644
--- a/hrp/parser_test.go
+++ b/hrp/parser_test.go
@@ -632,7 +632,7 @@ func TestParseVariables(t *testing.T) {
 	}{
 		{
 			map[string]interface{}{"varA": "$varB", "varB": "$varC", "varC": "123", "a": 1, "b": 2},
-			map[string]interface{}{"varA": "123", "varB": "123", "varC": "123", "a": 1, "b": 2},
+			map[string]interface{}{"varA": "123", "varB": "123", "varC": "123", "a": int64(1), "b": int64(2)},
 		},
 		{
 			map[string]interface{}{"n": 34.5, "a": 12.3, "b": "$n", "varFoo2": "${max($a, $b)}"},