Repository: httprunner/httprunner (language: python)

Issue:
支持指定 Python 自定义虚拟环境
## 背景描述

debugtalk.py 中引用了第三方依赖时，如果全局虚拟环境中没有安装该依赖，则会报错

```test
10:54AM ERR init plugin failed: /Users/bytedance/Desktop/demo-py/.debugtalk_gen.py error="connect grpc plugin failed: Unrecognized remote plugin message: \n\nThis usually means that the plugin is either invalid or simply\nneeds to be recompiled to support the latest protocol."
10:54AM ERR [Run] init session runner failed error="init plugin failed: connect grpc plugin failed: Unrecognized remote plugin message: \n\nThis usually means that the plugin is either invalid or simply\nneeds to be recompiled to support the latest protocol."
```

## 需求描述

1. 用户可以选择虚拟环境为全局/项目级别，解决依赖版本冲突问题
2. debugtalk.py 中引用了未安装的第三方依赖时，`hrp build` 实现自动检测和安装 @xucong053

大型数字被处理为科学计数法
## 问题描述

有一个接口，参数是用户的 uid，psw，还有一个随机数，我用${get_random()}调用 debugtalk.py 里写的方法。具体的测试用例如下：

```yaml
-
    name: ******
    request:
        method: GET
        url: ******
        params:
            dispatcher: $dispatcher
            password: $password
            rand: ${get_random()}
    validate:
        - eq: ["status_code", 200]
        - eq: ["body.error", 0]
    extract:
        totle_user_info: "body.msg"
```

get_random 方法如下:

```py
def get_random(f=10000000, t=99999999) -> int:
    return int(randint(f, t))
```

这是 hrp 运行之测试报告日志里的截图：

![image](https://user-images.githubusercontent.com/3657070/173176012-6952584e-608b-41de-9473-2c681743a12f.png)

## 版本信息

请提供如下版本信息：

 - HttpRunner 版本：v4.0.0



Discussion / hints:
在 #1346 中已经实现了自动安装缺失的第三方依赖；后续还需要再支持让用户指定虚拟环境，解决版本依赖的问题。


Fix patch:
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index a19ddf859..d7ea9f408 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -1,5 +1,18 @@
 # Release History
 
+## v4.1.3 (2022-06-14)
+
+**go version**
+
+- feat #1342: support specify custom python3 venv, priority is greater than $HOME/.hrp/venv
+- feat: assert python3 package installed and version matched
+- refactor: build plugin mechanism, cancel automatic installation of dependencies
+- fix #1352: avoid conversion to exponential notation
+
+**python version**
+
+- fix: unexpected changes in step variables
+
 ## v4.1.2 (2022-06-09)
 
 - feat: add Dockerfile
diff --git a/docs/cmd/hrp.md b/docs/cmd/hrp.md
index 7a58c5654..702798308 100644
--- a/docs/cmd/hrp.md
+++ b/docs/cmd/hrp.md
@@ -37,4 +37,4 @@ Copyright 2017 debugtalk
 * [hrp startproject](hrp_startproject.md)	 - create a scaffold project
 * [hrp wiki](hrp_wiki.md)	 - visit https://httprunner.com
 
-###### Auto generated by spf13/cobra on 9-Jun-2022
+###### Auto generated by spf13/cobra on 14-Jun-2022
diff --git a/docs/cmd/hrp_boom.md b/docs/cmd/hrp_boom.md
index a13c1168e..802d8f823 100644
--- a/docs/cmd/hrp_boom.md
+++ b/docs/cmd/hrp_boom.md
@@ -42,4 +42,4 @@ hrp boom [flags]
 
 * [hrp](hrp.md)	 - Next-Generation API Testing Solution.
 
-###### Auto generated by spf13/cobra on 9-Jun-2022
+###### Auto generated by spf13/cobra on 14-Jun-2022
diff --git a/docs/cmd/hrp_build.md b/docs/cmd/hrp_build.md
index 8b886d771..3202ee3ec 100644
--- a/docs/cmd/hrp_build.md
+++ b/docs/cmd/hrp_build.md
@@ -28,4 +28,4 @@ hrp build $path ... [flags]
 
 * [hrp](hrp.md)	 - Next-Generation API Testing Solution.
 
-###### Auto generated by spf13/cobra on 9-Jun-2022
+###### Auto generated by spf13/cobra on 14-Jun-2022
diff --git a/docs/cmd/hrp_convert.md b/docs/cmd/hrp_convert.md
index 8105d41e8..a1cf7236c 100644
--- a/docs/cmd/hrp_convert.md
+++ b/docs/cmd/hrp_convert.md
@@ -22,4 +22,4 @@ hrp convert $path... [flags]
 
 * [hrp](hrp.md)	 - Next-Generation API Testing Solution.
 
-###### Auto generated by spf13/cobra on 9-Jun-2022
+###### Auto generated by spf13/cobra on 14-Jun-2022
diff --git a/docs/cmd/hrp_run.md b/docs/cmd/hrp_run.md
index ad37cb40e..ffbe28fc5 100644
--- a/docs/cmd/hrp_run.md
+++ b/docs/cmd/hrp_run.md
@@ -35,4 +35,4 @@ hrp run $path... [flags]
 
 * [hrp](hrp.md)	 - Next-Generation API Testing Solution.
 
-###### Auto generated by spf13/cobra on 9-Jun-2022
+###### Auto generated by spf13/cobra on 14-Jun-2022
diff --git a/docs/cmd/hrp_startproject.md b/docs/cmd/hrp_startproject.md
index 05c015dae..e608327db 100644
--- a/docs/cmd/hrp_startproject.md
+++ b/docs/cmd/hrp_startproject.md
@@ -21,4 +21,4 @@ hrp startproject $project_name [flags]
 
 * [hrp](hrp.md)	 - Next-Generation API Testing Solution.
 
-###### Auto generated by spf13/cobra on 9-Jun-2022
+###### Auto generated by spf13/cobra on 14-Jun-2022
diff --git a/docs/cmd/hrp_wiki.md b/docs/cmd/hrp_wiki.md
index dcfd35eaf..196d0bba8 100644
--- a/docs/cmd/hrp_wiki.md
+++ b/docs/cmd/hrp_wiki.md
@@ -16,4 +16,4 @@ hrp wiki [flags]
 
 * [hrp](hrp.md)	 - Next-Generation API Testing Solution.
 
-###### Auto generated by spf13/cobra on 9-Jun-2022
+###### Auto generated by spf13/cobra on 14-Jun-2022
diff --git a/examples/demo-with-go-plugin/proj.json b/examples/demo-with-go-plugin/proj.json
index 477b6be77..fac542f71 100644
--- a/examples/demo-with-go-plugin/proj.json
+++ b/examples/demo-with-go-plugin/proj.json
@@ -1,5 +1,5 @@
 {
     "project_name": "demo-with-go-plugin",
-    "create_time": "2022-06-09T23:39:14.781583+08:00",
-    "hrp_version": "v4.1.2"
+    "create_time": "2022-06-14T13:19:05.262039+08:00",
+    "hrp_version": "v4.1.3"
 }
diff --git a/examples/demo-with-py-plugin/.debugtalk_gen.py b/examples/demo-with-py-plugin/.debugtalk_gen.py
index 880c145f7..7199a7575 100644
--- a/examples/demo-with-py-plugin/.debugtalk_gen.py
+++ b/examples/demo-with-py-plugin/.debugtalk_gen.py
@@ -1,67 +1,15 @@
-# NOTE: Generated By hrp v4.1.2, DO NOT EDIT!
+# NOTE: Generated By hrp v4.1.3, DO NOT EDIT!
 
-import logging
-import time
-import funppy
+import sys
+import os
 
-from typing import List
+sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
 
-
-def get_user_agent():
-    return "hrp/funppy"
-
-
-def sleep(n_secs):
-    time.sleep(n_secs)
-
-
-def sum(*args):
-    result = 0
-    for arg in args:
-        result += arg
-    return result
-
-
-def sum_ints(*args: List[int]) -> int:
-    result = 0
-    for arg in args:
-        result += arg
-    return result
-
-
-def sum_two_int(a: int, b: int) -> int:
-    return a + b
-
-
-def sum_two_string(a: str, b: str) -> str:
-    return a + b
-
-
-def sum_strings(*args: List[str]) -> str:
-    result = ""
-    for arg in args:
-        result += arg
-    return result
-
-
-def concatenate(*args: List[str]) -> str:
-    result = ""
-    for arg in args:
-        result += str(arg)
-    return result
-
-
-def setup_hook_example(name):
-    logging.warning("setup_hook_example")
-    return f"setup_hook_example: {name}"
-
-
-def teardown_hook_example(name):
-    logging.warning("teardown_hook_example")
-    return f"teardown_hook_example: {name}"
+from debugtalk import *
 
 
 if __name__ == "__main__":
+    import funppy
     funppy.register("get_user_agent", get_user_agent)
     funppy.register("sleep", sleep)
     funppy.register("sum", sum)
diff --git a/examples/demo-with-py-plugin/proj.json b/examples/demo-with-py-plugin/proj.json
index 1cf81b3a4..e0ae18165 100644
--- a/examples/demo-with-py-plugin/proj.json
+++ b/examples/demo-with-py-plugin/proj.json
@@ -1,5 +1,5 @@
 {
     "project_name": "demo-with-py-plugin",
-    "create_time": "2022-06-09T23:39:14.922843+08:00",
-    "hrp_version": "v4.1.2"
+    "create_time": "2022-06-14T13:19:05.680344+08:00",
+    "hrp_version": "v4.1.3"
 }
diff --git a/go.mod b/go.mod
index 633c73b72..6d70a8559 100644
--- a/go.mod
+++ b/go.mod
@@ -10,7 +10,7 @@ require (
 	github.com/go-openapi/spec v0.20.6
 	github.com/google/uuid v1.3.0
 	github.com/gorilla/websocket v1.4.1
-	github.com/httprunner/funplugin v0.4.9
+	github.com/httprunner/funplugin v0.5.0
 	github.com/jinzhu/copier v0.3.2
 	github.com/jmespath/go-jmespath v0.4.0
 	github.com/json-iterator/go v1.1.12
diff --git a/go.sum b/go.sum
index 466fe49c4..3f8193600 100644
--- a/go.sum
+++ b/go.sum
@@ -253,8 +253,8 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p
 github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
 github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M=
 github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
-github.com/httprunner/funplugin v0.4.9 h1:gmF1sP5D4/nvdocqgOAyT3GpVDz3fL4ErZ17WHo8x9U=
-github.com/httprunner/funplugin v0.4.9/go.mod h1:vPyeJIfbpGe0epZZtAV0wCn16gLY9+imSw/zfxq0Lcc=
+github.com/httprunner/funplugin v0.5.0 h1:Laoe8URu71qeyST9wvRtGSkDWc8Y3T1IrnvFSTHmO84=
+github.com/httprunner/funplugin v0.5.0/go.mod h1:vPyeJIfbpGe0epZZtAV0wCn16gLY9+imSw/zfxq0Lcc=
 github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
 github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
 github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA=
diff --git a/hrp/boomer.go b/hrp/boomer.go
index caef351ce..839ebd151 100644
--- a/hrp/boomer.go
+++ b/hrp/boomer.go
@@ -29,9 +29,16 @@ type HRPBoomer struct {
 	pluginsMutex *sync.RWMutex       // avoid data race
 }
 
-func (b *HRPBoomer) SetClientTransport() {
+func (b *HRPBoomer) SetClientTransport() *HRPBoomer {
 	// set client transport for high concurrency load testing
 	b.hrpRunner.SetClientTransport(b.GetSpawnCount(), b.GetDisableKeepAlive(), b.GetDisableCompression())
+	return b
+}
+
+// SetPython3Venv specifies python3 venv.
+func (b *HRPBoomer) SetPython3Venv(venv string) *HRPBoomer {
+	b.hrpRunner.SetPython3Venv(venv)
+	return b
 }
 
 // Run starts to run load test for one or multiple testcases.
diff --git a/hrp/build.go b/hrp/build.go
index 3184fa3c8..6c97a2079 100644
--- a/hrp/build.go
+++ b/hrp/build.go
@@ -4,217 +4,110 @@ import (
 	"bufio"
 	_ "embed"
 	"fmt"
-	"io"
+	"html/template"
 	"os"
 	"os/exec"
 	"path/filepath"
 	"regexp"
 	"strings"
-	"text/template"
 
+	"github.com/httprunner/funplugin/shared"
 	"github.com/pkg/errors"
 	"github.com/rs/zerolog/log"
 
-	"github.com/httprunner/funplugin/shared"
 	"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
 	"github.com/httprunner/httprunner/v4/hrp/internal/version"
 )
 
-const (
-	funppy                  = `import funppy`
-	fungo                   = `"github.com/httprunner/funplugin/fungo"`
-	regexPythonFunctionName = `def ([a-zA-Z_]\w*)\(.*\)`
-	regexGoImports          = `import \(([\s\S]*?)\)`
-	regexGoImport           = `import (\"[\s\S]*\")`
-	regexGoFunctionName     = `func ([A-Z][a-zA-Z_]\w*)\(.*\)`
-	regexGoFunctionContent  = `func [\s\S]*?\n}`
-)
-
 //go:embed internal/scaffold/templates/plugin/debugtalkPythonTemplate
 var pyTemplate string
 
 //go:embed internal/scaffold/templates/plugin/debugtalkGoTemplate
 var goTemplate string
 
-type TemplateContent struct {
-	Version       string   // hrp version
-	Fun           string   // funplugin package
-	Regexps       *Regexps // match import/function
-	Imports       []string // python/go import
-	FromImports   []string // python from...import...
-	Functions     []string // python/go function
-	FunctionNames []string // function name set by user
-	Packages      []string // python packages
-}
+// regex for finding all function names
+var (
+	regexPyFunctionName = regexp.MustCompile(`def ([a-zA-Z_]\w*)\(.*\)`)
+	regexGoFunctionName = regexp.MustCompile(`func ([A-Z][a-zA-Z_]\w*)\(.*\)`)
+)
 
-type Regexps struct {
-	Import          *regexp.Regexp
-	Imports         *regexp.Regexp
-	FunctionName    *regexp.Regexp
-	FunctionContent *regexp.Regexp // including function define and body
+type pluginTemplateContent struct {
+	Version       string   // hrp version
+	FunctionNames []string // function names
 }
 
-func (t *TemplateContent) parseGoContent(path string) error {
-	log.Info().Str("path", path).Msg("start to parse debugtalk.go")
+func findAllFunctionNames(t *regexp.Regexp, path string) (functionNames []string, err error) {
+	log.Info().Str("path", path).Msg("find all function names from plugin file")
 
 	content, err := os.ReadFile(path)
 	if err != nil {
 		log.Error().Err(err).Msg("failed to read file")
-		return err
+		return nil, errors.Wrap(err, "read file failed")
 	}
-	originalContent := string(content)
 
-	// parse imports
-	importSlice := t.Regexps.Imports.FindAllStringSubmatch(originalContent, -1)
-	if len(importSlice) != 0 {
-		imports := strings.Replace(importSlice[0][1], "\t", "", -1)
-		for _, elem := range strings.Split(imports, "\n") {
-			t.Imports = append(t.Imports, strings.TrimSpace(elem))
-		}
-	}
-	// parse import
-	importSlice = t.Regexps.Import.FindAllStringSubmatch(originalContent, -1)
-	if len(importSlice) != 0 {
-		for _, elem := range importSlice {
-			t.Imports = append(t.Imports, strings.TrimSpace(elem[1]))
-		}
-	}
-	// import fungo package
-	if !builtin.Contains(t.Imports, fungo) {
-		t.Imports = append(t.Imports, t.Fun)
-	}
-
-	// parse function name
-	functionNameSlice := t.Regexps.FunctionName.FindAllStringSubmatch(originalContent, -1)
+	// find all function names
+	functionNameSlice := t.FindAllStringSubmatch(string(content), -1)
 	for _, elem := range functionNameSlice {
 		name := strings.Trim(elem[1], " ")
-		if name == "main" {
-			continue
-		}
-		t.FunctionNames = append(t.FunctionNames, name)
+		functionNames = append(functionNames, name)
 	}
 
-	// parse function content
-	functionContentSlice := t.Regexps.FunctionContent.FindAllStringSubmatch(originalContent, -1)
-	for _, f := range functionContentSlice {
-		if strings.Contains(f[0], "func main") {
-			continue
-		}
-		t.Functions = append(t.Functions, strings.Trim(f[0], "\n"))
-	}
-	return nil
+	return
 }
 
-func (t *TemplateContent) parsePyContent(path string) error {
-	file, err := os.Open(path)
+func generate(data *pluginTemplateContent, tmpl, output string) error {
+	file, err := os.Create(output)
 	if err != nil {
-		log.Error().Err(err).Str("path", path).Msg("failed to open file")
+		log.Error().Err(err).Msg("open output file failed")
 		return err
 	}
 	defer file.Close()
 
-	r := bufio.NewReader(file)
-
-	// record content excluding import and main
-	content := ""
-
-	// parse python content line by line
-	for {
-		l, _, err := r.ReadLine()
-		if err == io.EOF {
-			break
-		}
-		line := string(l)
-
-		if strings.HasPrefix(line, "import") {
-			t.Imports = append(t.Imports, strings.Trim(line, " "))
-			// e.g. import module as md
-			// import package.module
-			t.Packages = append(t.Packages, strings.Split(strings.Split(line, " ")[1], ".")[0])
-		} else if strings.HasPrefix(line, "from") {
-			t.FromImports = append(t.FromImports, strings.Trim(line, " "))
-			// e.g. from package.module import function
-			// from module import function
-			// from package import module
-			t.Packages = append(t.Packages, strings.Split(strings.Split(line, " ")[1], ".")[0])
-		} else {
-			// no parse content at under of `if __name__ == "__main__"`
-			if strings.HasPrefix(line, "if __name__") {
-				break
-			}
-			if strings.HasPrefix(line, "def") {
-				functionNameSlice := t.Regexps.FunctionName.FindAllStringSubmatch(line, -1)
-				if len(functionNameSlice) == 0 {
-					continue
-				}
-				t.FunctionNames = append(t.FunctionNames, functionNameSlice[0][1])
-			}
-			content += line + "\n"
-		}
-	}
-	// function content
-	t.Functions = append(t.Functions, strings.Trim(content, "\n"))
-
-	// import funppy
-	if !builtin.Contains(t.Imports, t.Fun) {
-		t.Imports = append(t.Imports, t.Fun)
-	}
-	return nil
-}
-
-func (t *TemplateContent) genDebugTalk(path string, templ string) error {
-	file, err := os.Create(path)
-	if err != nil {
-		log.Error().Err(err).Msg("open file failed")
-		return err
-	}
-	defer file.Close()
 	writer := bufio.NewWriter(file)
-	tmpl := template.Must(template.New("debugtalk").Parse(templ))
-	err = tmpl.Execute(writer, t)
+	err = template.Must(template.New("debugtalk").Parse(tmpl)).Execute(writer, data)
 	if err != nil {
-		log.Error().Err(err).Msg("execute applies a parsed template to the specified data object failed")
+		log.Error().Err(err).Msg("execute template parsing failed")
 		return err
 	}
+
 	err = writer.Flush()
 	if err == nil {
-		log.Info().Str("path", path).Msg("generate debugtalk success")
+		log.Info().Str("output", output).Msg("generate debugtalk success")
 	} else {
-		log.Error().Str("path", path).Msg("generate debugtalk failed")
+		log.Error().Str("output", output).Msg("generate debugtalk failed")
 	}
 	return err
 }
 
 // buildGo builds debugtalk.go to debugtalk.bin
 func buildGo(path string, output string) error {
-	templateContent := &TemplateContent{
-		Version: version.VERSION,
-		Fun:     fungo,
-		Regexps: &Regexps{
-			Import:          regexp.MustCompile(regexGoImport),
-			Imports:         regexp.MustCompile(regexGoImports),
-			FunctionName:    regexp.MustCompile(regexGoFunctionName),
-			FunctionContent: regexp.MustCompile(regexGoFunctionContent),
-		},
+	functionNames, err := findAllFunctionNames(regexGoFunctionName, path)
+	if err != nil {
+		return errors.Wrap(err, "find all function names failed")
+	}
+	// filter main and init function
+	var filteredFunctionNames []string
+	for _, name := range functionNames {
+		if name == "main" || name == "init" {
+			continue
+		}
+		filteredFunctionNames = append(filteredFunctionNames, name)
 	}
 
-	pluginDir := filepath.Dir(path)
-
-	// check go sdk in tempDir
-	if err := builtin.ExecCommandInDir(exec.Command("go", "version"), pluginDir); err != nil {
-		return errors.Wrap(err, "go sdk not installed")
+	templateContent := &pluginTemplateContent{
+		Version:       version.VERSION,
+		FunctionNames: filteredFunctionNames,
 	}
 
-	// parse debugtalk.go in pluginDir
-	err := templateContent.parseGoContent(path)
+	pluginDir := filepath.Dir(path)
+	err = generate(templateContent, goTemplate, filepath.Join(pluginDir, PluginGoSourceGenFile))
 	if err != nil {
-		return err
+		return errors.Wrap(err, "generate hashicorp plugin failed")
 	}
 
-	// generate debugtalk.go in pluginDir
-	err = templateContent.genDebugTalk(filepath.Join(pluginDir, PluginGoSourceGenFile), goTemplate)
-	if err != nil {
-		return err
+	// check go sdk in tempDir
+	if err := builtin.ExecCommandInDir(exec.Command("go", "version"), pluginDir); err != nil {
+		return errors.Wrap(err, "go sdk not installed")
 	}
 
 	if !builtin.IsFilePathExists(filepath.Join(pluginDir, "go.mod")) {
@@ -227,71 +120,66 @@ func buildGo(path string, output string) error {
 		// funplugin version should be locked
 		funplugin := fmt.Sprintf("github.com/httprunner/funplugin@%s", shared.Version)
 		if err := builtin.ExecCommandInDir(exec.Command("go", "get", funplugin), pluginDir); err != nil {
-			return err
+			return errors.Wrap(err, "go get funplugin failed")
 		}
 	}
 
 	// add missing and remove unused modules
 	if err := builtin.ExecCommandInDir(exec.Command("go", "mod", "tidy"), pluginDir); err != nil {
-		return err
+		return errors.Wrap(err, "go mod tidy failed")
 	}
 
+	// specify output file path
 	if output == "" {
 		dir, _ := os.Getwd()
 		output = filepath.Join(dir, PluginHashicorpGoBuiltFile)
 	} else if builtin.IsFolderPathExists(output) {
 		output = filepath.Join(output, PluginHashicorpGoBuiltFile)
 	}
-	outputPath, err := filepath.Abs(output)
-	if err != nil {
-		return err
-	}
+	outputPath, _ := filepath.Abs(output)
 
-	// build plugin debugtalk.bin
+	// build go plugin to debugtalk.bin
 	cmd := exec.Command("go", "build", "-o", outputPath, PluginGoSourceGenFile, filepath.Base(path))
 	if err := builtin.ExecCommandInDir(cmd, pluginDir); err != nil {
-		return err
+		return errors.Wrap(err, "go build plugin failed")
 	}
-	log.Info().Str("output", outputPath).Str("plugin", path).Msg("build plugin successfully")
+	log.Info().Str("output", outputPath).Str("plugin", path).Msg("build go plugin successfully")
 	return nil
 }
 
 // buildPy completes funppy information in debugtalk.py
 func buildPy(path string, output string) error {
-	templateContent := &TemplateContent{
-		Version: version.VERSION,
-		Fun:     funppy,
-		Regexps: &Regexps{
-			FunctionName: regexp.MustCompile(regexPythonFunctionName),
-		},
-	}
-
-	err := templateContent.parsePyContent(path)
+	// check the syntax of debugtalk.py
+	err := builtin.ExecCommand("python3", "-m", "py_compile", path)
 	if err != nil {
-		return err
+		return errors.Wrap(err, "python plugin syntax invalid")
 	}
 
-	// ensure installation of packages
-	_, err = builtin.EnsurePython3Venv(templateContent.Packages...)
+	functionNames, err := findAllFunctionNames(regexPyFunctionName, path)
 	if err != nil {
 		return err
 	}
-
-	// check the syntax of debugtalk.py
-	err = builtin.CheckPythonScriptSyntax(path)
-	if err != nil {
-		return err
+	templateContent := &pluginTemplateContent{
+		Version:       version.VERSION,
+		FunctionNames: functionNames,
 	}
 
-	// generate .debugtalk_gen.py
+	// specify output file path
 	if output == "" {
 		dir, _ := os.Getwd()
 		output = filepath.Join(dir, PluginPySourceGenFile)
 	} else if builtin.IsFolderPathExists(output) {
 		output = filepath.Join(output, PluginPySourceGenFile)
 	}
-	err = templateContent.genDebugTalk(output, pyTemplate)
-	return err
+
+	// generate .debugtalk_gen.py
+	err = generate(templateContent, pyTemplate, output)
+	if err != nil {
+		return err
+	}
+
+	log.Info().Str("output", output).Str("plugin", path).Msg("build python plugin successfully")
+	return nil
 }
 
 func BuildPlugin(path string, output string) (err error) {
@@ -305,7 +193,7 @@ func BuildPlugin(path string, output string) (err error) {
 		return errors.New("type error, expected .py or .go")
 	}
 	if err != nil {
-		log.Error().Err(err).Str("arg", path).Msg("build plugin failed")
+		log.Error().Err(err).Str("path", path).Msg("build plugin failed")
 		os.Exit(1)
 	}
 	return nil
diff --git a/hrp/cmd/boom.go b/hrp/cmd/boom.go
index 5ae038e1f..ca48d13ba 100644
--- a/hrp/cmd/boom.go
+++ b/hrp/cmd/boom.go
@@ -54,6 +54,9 @@ var boomCmd = &cobra.Command{
 		hrpBoomer.SetDisableKeepAlive(boomArgs.DisableKeepalive)
 		hrpBoomer.SetDisableCompression(boomArgs.DisableCompression)
 		hrpBoomer.SetClientTransport()
+		if venv != "" {
+			hrpBoomer.SetPython3Venv(venv)
+		}
 		hrpBoomer.EnableCPUProfile(boomArgs.CPUProfile, boomArgs.CPUProfileDuration)
 		hrpBoomer.EnableMemoryProfile(boomArgs.MemoryProfile, boomArgs.MemoryProfileDuration)
 		hrpBoomer.EnableGracefulQuit()
diff --git a/hrp/cmd/convert.go b/hrp/cmd/convert.go
index 83ba88bb7..3611274ce 100644
--- a/hrp/cmd/convert.go
+++ b/hrp/cmd/convert.go
@@ -2,10 +2,14 @@ package cmd
 
 import (
 	"errors"
+	"fmt"
 
+	"github.com/rs/zerolog/log"
 	"github.com/spf13/cobra"
 
+	"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
 	"github.com/httprunner/httprunner/v4/hrp/internal/convert"
+	"github.com/httprunner/httprunner/v4/hrp/internal/version"
 )
 
 var convertCmd = &cobra.Command{
@@ -32,6 +36,15 @@ var convertCmd = &cobra.Command{
 		if toPyTestFlag {
 			flagCount++
 			outputType = convert.OutputTypePyTest
+
+			packages := []string{
+				fmt.Sprintf("httprunner==%s", version.VERSION),
+			}
+			_, err := builtin.EnsurePython3Venv(venv, packages...)
+			if err != nil {
+				log.Error().Err(err).Msg("python3 venv is not ready")
+				return err
+			}
 		}
 		if flagCount > 1 {
 			return errors.New("please specify at most one conversion flag")
diff --git a/hrp/cmd/root.go b/hrp/cmd/root.go
index 2909ea154..698d05981 100644
--- a/hrp/cmd/root.go
+++ b/hrp/cmd/root.go
@@ -48,6 +48,7 @@ Copyright 2017 debugtalk`,
 var (
 	logLevel string
 	logJSON  bool
+	venv     string
 )
 
 // Execute adds all child commands to the root command and sets flags appropriately.
@@ -55,6 +56,7 @@ var (
 func Execute() {
 	rootCmd.PersistentFlags().StringVarP(&logLevel, "log-level", "l", "INFO", "set log level")
 	rootCmd.PersistentFlags().BoolVar(&logJSON, "log-json", false, "set log to json format")
+	rootCmd.PersistentFlags().StringVar(&venv, "venv", "", "specify python3 venv path")
 
 	if err := rootCmd.Execute(); err != nil {
 		os.Exit(1)
diff --git a/hrp/cmd/run.go b/hrp/cmd/run.go
index 500e595bd..5c7bcd90e 100644
--- a/hrp/cmd/run.go
+++ b/hrp/cmd/run.go
@@ -41,6 +41,9 @@ var runCmd = &cobra.Command{
 		if pluginLogOn {
 			runner.SetPluginLogOn()
 		}
+		if venv != "" {
+			runner.SetPython3Venv(venv)
+		}
 		if proxyUrl != "" {
 			runner.SetProxyUrl(proxyUrl)
 		}
diff --git a/hrp/cmd/scaffold.go b/hrp/cmd/scaffold.go
index c51281ed1..868307254 100644
--- a/hrp/cmd/scaffold.go
+++ b/hrp/cmd/scaffold.go
@@ -34,7 +34,7 @@ var scaffoldCmd = &cobra.Command{
 			pluginType = scaffold.Py // default
 		}
 
-		err := scaffold.CreateScaffold(args[0], pluginType, force)
+		err := scaffold.CreateScaffold(args[0], pluginType, venv, force)
 		if err != nil {
 			log.Error().Err(err).Msg("create scaffold project failed")
 			os.Exit(1)
diff --git a/hrp/internal/builtin/utils.go b/hrp/internal/builtin/utils.go
index 93a4b64b1..6fd121484 100644
--- a/hrp/internal/builtin/utils.go
+++ b/hrp/internal/builtin/utils.go
@@ -13,7 +13,6 @@ import (
 	"strconv"
 	"strings"
 
-	"github.com/httprunner/funplugin/shared"
 	"github.com/pkg/errors"
 	"github.com/rs/zerolog/log"
 	"gopkg.in/yaml.v3"
@@ -88,65 +87,111 @@ func FormatResponse(raw interface{}) interface{} {
 	return formattedResponse
 }
 
-func EnsurePython3Venv(packages ...string) (string, error) {
-	// create python venv
-	home, err := os.UserHomeDir()
-	if err != nil {
-		return "", errors.Wrap(err, "get user home dir failed")
+var python3Executable string = "python3" // system default python3
+
+// EnsurePython3Venv ensures python3 venv with specified packages
+// venv should be directory path of target venv
+func EnsurePython3Venv(venv string, packages ...string) (python3 string, err error) {
+	// priority: specified > $HOME/.hrp/venv
+	if venv == "" {
+		home, err := os.UserHomeDir()
+		if err != nil {
+			return "", errors.Wrap(err, "get user home dir failed")
+		}
+		venv = filepath.Join(home, ".hrp", "venv")
 	}
-	venvDir := filepath.Join(home, ".hrp", "venv")
-	python3, err := shared.EnsurePython3Venv(venvDir, packages...)
+	python3, err = ensurePython3Venv(venv, packages...)
 	if err != nil {
-		return "", errors.Wrap(err, "ensure python3 venv failed")
+		return "", errors.Wrap(err, "prepare python3 venv failed")
 	}
-
+	python3Executable = python3
+	log.Info().Str("Python3Executable", python3Executable).Msg("set python3 executable path")
 	return python3, nil
 }
 
-func CheckPythonScriptSyntax(path string) error {
-	err := ExecCommand("python3", "-m", "py_compile", path)
-	return err
+func ExecPython3Command(cmdName string, args ...string) error {
+	args = append([]string{"-m", cmdName}, args...)
+	return ExecCommand(python3Executable, args...)
 }
 
-func ExecCommandInDir(cmd *exec.Cmd, dir string) error {
-	log.Info().Str("cmd", cmd.String()).Str("dir", dir).Msg("exec command")
-	cmd.Dir = dir
+func AssertPythonPackage(python3 string, pkgName, pkgVersion string) error {
+	out, err := exec.Command(
+		python3, "-c", fmt.Sprintf("import %s; print(%s.__version__)", pkgName, pkgName),
+	).Output()
+	if err != nil {
+		return fmt.Errorf("python package %s not found", pkgName)
+	}
 
-	// print output with colors
-	cmd.Stdout = os.Stdout
-	cmd.Stderr = os.Stderr
+	// do not check version if pkgVersion is empty
+	if pkgVersion == "" {
+		log.Info().Str("name", pkgName).Msg("python package is ready")
+		return nil
+	}
 
-	err := cmd.Run()
-	if err != nil {
-		log.Error().Err(err).Msg("exec command failed")
-		return err
+	// check package version equality
+	version := strings.TrimSpace(string(out))
+	if strings.TrimLeft(version, "v") != strings.TrimLeft(pkgVersion, "v") {
+		return fmt.Errorf("python package %s version %s not matched, please upgrade to %s",
+			pkgName, version, pkgVersion)
 	}
 
+	log.Info().Str("name", pkgName).Str("version", pkgVersion).Msg("python package is ready")
 	return nil
 }
 
-func ExecCommand(cmdName string, args ...string) error {
-	cmd := exec.Command(cmdName, args...)
-	log.Info().Str("cmd", cmd.String()).Msg("exec command")
+func InstallPythonPackage(python3 string, pkg string) (err error) {
+	var pkgName, pkgVersion string
+	if strings.Contains(pkg, "==") {
+		// funppy==0.5.0
+		pkgInfo := strings.Split(pkg, "==")
+		pkgName = pkgInfo[0]
+		pkgVersion = pkgInfo[1]
+	} else {
+		// funppy
+		pkgName = pkg
+	}
+
+	// check if package installed and version matched
+	err = AssertPythonPackage(python3, pkgName, pkgVersion)
+	if err == nil {
+		return nil
+	}
+
+	// check if pip available
+	err = ExecCommand(python3, "-m", "pip", "--version")
+	if err != nil {
+		log.Warn().Msg("pip is not available")
+		return errors.Wrap(err, "pip is not available")
+	}
+
+	log.Info().Str("pkgName", pkgName).Str("pkgVersion", pkgVersion).Msg("installing python package")
+
+	// install package
+	err = ExecCommand(python3, "-m", "pip", "install", "--upgrade", pkg,
+		"--index-url", "https://pypi.org/simple",
+		"--quiet", "--disable-pip-version-check")
+	if err != nil {
+		return errors.Wrap(err, "pip install package failed")
+	}
+
+	return AssertPythonPackage(python3, pkgName, pkgVersion)
+}
+
+func ExecCommandInDir(cmd *exec.Cmd, dir string) error {
+	log.Info().Str("cmd", cmd.String()).Str("dir", dir).Msg("exec command")
+	cmd.Dir = dir
 
 	// print output with colors
 	cmd.Stdout = os.Stdout
 	cmd.Stderr = os.Stderr
 
-	// add cmd dir path to PATH
-	PATH := fmt.Sprintf("%s:%s", filepath.Dir(cmdName), os.Getenv("PATH"))
-	if err := os.Setenv("PATH", PATH); err != nil {
-		log.Error().Err(err).Msg("failed to add cmd dir path to $PATH")
-		return err
-	}
-
 	err := cmd.Run()
 	if err != nil {
 		log.Error().Err(err).Msg("exec command failed")
 		return err
 	}
 
-	return err
+	return nil
 }
 
 func CreateFolder(folderPath string) error {
diff --git a/hrp/internal/builtin/utils_unix.go b/hrp/internal/builtin/utils_unix.go
new file mode 100644
index 000000000..f375fc8e7
--- /dev/null
+++ b/hrp/internal/builtin/utils_unix.go
@@ -0,0 +1,85 @@
+//go:build darwin || linux
+// +build darwin linux
+
+package builtin
+
+import (
+	"fmt"
+	"os"
+	"os/exec"
+	"path/filepath"
+
+	"github.com/pkg/errors"
+	"github.com/rs/zerolog/log"
+)
+
+func getPython3Executable(venvDir string) string {
+	return filepath.Join(venvDir, "bin", "python3")
+}
+
+func ensurePython3Venv(venv string, packages ...string) (python3 string, err error) {
+	python3 = getPython3Executable(venv)
+
+	log.Info().
+		Str("python3", python3).
+		Interface("packages", packages).
+		Msg("ensure python3 venv")
+
+	// check if python3 venv is available
+	if err := exec.Command(python3, "--version").Run(); err != nil {
+		// python3 venv not available, create one
+		// check if system python3 is available
+		if err := ExecCommand("python3", "--version"); err != nil {
+			return "", errors.Wrap(err, "python3 not found")
+		}
+
+		// check if .venv exists
+		if _, err := os.Stat(venv); err == nil {
+			// .venv exists, remove first
+			if err := ExecCommand("rm", "-rf", venv); err != nil {
+				return "", errors.Wrap(err, "remove existed venv failed")
+			}
+		}
+
+		// create python3 .venv
+		if err := ExecCommand("python3", "-m", "venv", venv); err != nil {
+			return "", errors.Wrap(err, "create python3 venv failed")
+		}
+	}
+
+	// install default python packages
+	for _, pkg := range packages {
+		err := InstallPythonPackage(python3, pkg)
+		if err != nil {
+			return "", errors.Wrap(err, fmt.Sprintf("pip install %s failed", pkg))
+		}
+	}
+
+	return python3, nil
+}
+
+func ExecCommand(cmdName string, args ...string) error {
+	cmd := exec.Command(cmdName, args...)
+	log.Info().Str("cmd", cmd.String()).Msg("exec command")
+
+	// add cmd dir path to $PATH
+	if cmdDir := filepath.Dir(cmdName); cmdDir != "" {
+		PATH := fmt.Sprintf("%s:%s", cmdDir, os.Getenv("PATH"))
+		if err := os.Setenv("PATH", PATH); err != nil {
+			log.Error().Err(err).Msg("set env $PATH failed")
+			return err
+		}
+	}
+
+	// print output with colors
+	cmd.Stdout = os.Stdout
+	cmd.Stderr = os.Stderr
+
+	err := cmd.Run()
+	if err != nil {
+		log.Error().Err(err).Msg("exec command failed")
+		return err
+	}
+
+	return nil
+}
diff --git a/hrp/internal/builtin/utils_windows.go b/hrp/internal/builtin/utils_windows.go
new file mode 100644
index 000000000..1946ba0c6
--- /dev/null
+++ b/hrp/internal/builtin/utils_windows.go
@@ -0,0 +1,99 @@
+//go:build windows
+// +build windows
+
+package builtin
+
+import (
+	"fmt"
+	"os"
+	"os/exec"
+	"path/filepath"
+	"strings"
+
+	"github.com/pkg/errors"
+	"github.com/rs/zerolog/log"
+)
+
+func getPython3Executable(venvDir string) string {
+	return filepath.Join(venvDir, "Scripts", "python3.exe")
+}
+
+func ensurePython3Venv(venvDir string, packages ...string) (python3 string, err error) {
+	python3 = getPython3Executable(venvDir)
+	log.Info().
+		Str("python3", python3).
+		Interface("packages", packages).
+		Msg("ensure python3 venv")
+
+	systemPython := "python3"
+
+	// check if python3 venv is available
+	if err := exec.Command("cmd", "/c", python3, "--version").Run(); err != nil {
+		// python3 venv not available, create one
+		// check if system python3 is available
+		if err := ExecCommand(systemPython, "--version"); err != nil {
+			if err := ExecCommand("python", "--version"); err != nil {
+				return "", errors.Wrap(err, "python3 not found")
+			}
+			systemPython = "python"
+		}
+
+		// check if .venv exists
+		if _, err := os.Stat(venvDir); err == nil {
+			// .venv exists, remove first
+			if err := ExecCommand("del", "/q", venvDir); err != nil {
+				return "", errors.Wrap(err, "remove existed venv failed")
+			}
+		}
+
+		// create python3 .venv
+		// notice: --symlinks should be specified for windows
+		// https://github.com/actions/virtual-environments/issues/2690
+		if err := ExecCommand(systemPython, "-m", "venv", "--symlinks", venvDir); err != nil {
+			// fix: failed to symlink on Windows
+			log.Warn().Msg("failed to create python3 .venv by using --symlinks, try to use --copies")
+			if err := ExecCommand(systemPython, "-m", "venv", "--copies", venvDir); err != nil {
+				return "", errors.Wrap(err, "create python3 venv failed")
+			}
+		}
+
+		// fix: python3 doesn't exist in .venv on Windows
+		if _, err := os.Stat(python3); err != nil {
+			log.Warn().Msg("python3 doesn't exist, try to link python")
+			err := os.Link(filepath.Join(venvDir, "Scripts", "python.exe"), python3)
+			if err != nil {
+				return "", errors.Wrap(err, "python3 doesn't exist in .venv")
+			}
+		}
+	}
+
+	// install default python packages
+	for _, pkg := range packages {
+		err := InstallPythonPackage(python3, pkg)
+		if err != nil {
+			return "", errors.Wrap(err, fmt.Sprintf("pip install %s failed", pkg))
+		}
+	}
+
+	return python3, nil
+}
+
+func ExecCommand(cmdName string, args ...string) error {
+	// "cmd /c" carries out the command specified by string and then stops
+	// refer: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd
+	cmdStr := fmt.Sprintf("%s %s", cmdName, strings.Join(args, " "))
+	cmd := exec.Command("cmd", "/c", cmdStr)
+	log.Info().Str("cmd", cmd.String()).Msg("exec command")
+
+	// print output with colors
+	cmd.Stdout = os.Stdout
+	cmd.Stderr = os.Stderr
+
+	err := cmd.Run()
+	if err != nil {
+		log.Error().Err(err).Msg("exec command failed")
+		return err
+	}
+
+	return nil
+}
diff --git a/hrp/internal/convert/converter_json.go b/hrp/internal/convert/converter_json.go
index fc3801421..f55a7f5c9 100644
--- a/hrp/internal/convert/converter_json.go
+++ b/hrp/internal/convert/converter_json.go
@@ -1,13 +1,10 @@
 package convert
 
 import (
-	"fmt"
-
 	"github.com/pkg/errors"
 
 	"github.com/httprunner/httprunner/v4/hrp"
 	"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
-	"github.com/httprunner/httprunner/v4/hrp/internal/version"
 )
 
 func NewConverterJSON(converter *TCaseConverter) *ConverterJSON {
@@ -51,7 +48,7 @@ func (c *ConverterJSON) ToYAML() (string, error) {
 }
 
 func (c *ConverterJSON) ToGoTest() (string, error) {
-	//TODO implement me
+	// TODO implement me
 	return "", errors.New("convert from json testcase to gotest scripts is not supported yet")
 }
 
@@ -60,13 +57,8 @@ func (c *ConverterJSON) ToPyTest() (string, error) {
 }
 
 func (c *ConverterJSON) MakePyTestScript() (string, error) {
-	httprunner := fmt.Sprintf("httprunner>=%s", version.HttpRunnerMinVersion)
-	python3, err := builtin.EnsurePython3Venv(httprunner)
-	if err != nil {
-		return "", err
-	}
-	args := append([]string{"-m", "httprunner", "make"}, c.converter.InputPath)
-	err = builtin.ExecCommand(python3, args...)
+	args := append([]string{"make"}, c.converter.InputPath)
+	err := builtin.ExecPython3Command("httprunner", args...)
 	if err != nil {
 		return "", err
 	}
diff --git a/hrp/internal/scaffold/main.go b/hrp/internal/scaffold/main.go
index 04ad8ac55..f27a035a8 100644
--- a/hrp/internal/scaffold/main.go
+++ b/hrp/internal/scaffold/main.go
@@ -8,6 +8,7 @@ import (
 	"path/filepath"
 	"time"
 
+	"github.com/httprunner/funplugin/fungo"
 	"github.com/pkg/errors"
 	"github.com/rs/zerolog/log"
 
@@ -51,7 +52,7 @@ func CopyFile(templateFile, targetFile string) error {
 	return nil
 }
 
-func CreateScaffold(projectName string, pluginType PluginType, force bool) error {
+func CreateScaffold(projectName string, pluginType PluginType, venv string, force bool) error {
 	// report event
 	sdk.SendEvent(sdk.EventTracking{
 		Category: "Scaffold",
@@ -165,7 +166,7 @@ func CreateScaffold(projectName string, pluginType PluginType, force bool) error
 	// create debugtalk function plugin
 	switch pluginType {
 	case Py:
-		return createPythonPlugin(projectName)
+		return createPythonPlugin(projectName, venv)
 	case Go:
 		return createGoPlugin(projectName)
 	}
@@ -194,7 +195,7 @@ func createGoPlugin(projectName string) error {
 	return nil
 }
 
-func createPythonPlugin(projectName string) error {
+func createPythonPlugin(projectName, venv string) error {
 	log.Info().Msg("start to create hashicorp python plugin")
 
 	// create debugtalk.py
@@ -204,7 +205,11 @@ func createPythonPlugin(projectName string) error {
 		return errors.Wrap(err, "copy file failed")
 	}
 
-	_, err = builtin.EnsurePython3Venv("funppy")
+	packages := []string{
+		fmt.Sprintf("funppy==%s", fungo.Version),
+		fmt.Sprintf("httprunner==%s", version.VERSION),
+	}
+	_, err = builtin.EnsurePython3Venv(venv, packages...)
 	if err != nil {
 		return err
 	}
diff --git a/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py b/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py
index 880c145f7..7199a7575 100644
--- a/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py
+++ b/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py
@@ -1,67 +1,15 @@
-# NOTE: Generated By hrp v4.1.2, DO NOT EDIT!
+# NOTE: Generated By hrp v4.1.3, DO NOT EDIT!
 
-import logging
-import time
-import funppy
+import sys
+import os
 
-from typing import List
+sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
 
-
-def get_user_agent():
-    return "hrp/funppy"
-
-
-def sleep(n_secs):
-    time.sleep(n_secs)
-
-
-def sum(*args):
-    result = 0
-    for arg in args:
-        result += arg
-    return result
-
-
-def sum_ints(*args: List[int]) -> int:
-    result = 0
-    for arg in args:
-        result += arg
-    return result
-
-
-def sum_two_int(a: int, b: int) -> int:
-    return a + b
-
-
-def sum_two_string(a: str, b: str) -> str:
-    return a + b
-
-
-def sum_strings(*args: List[str]) -> str:
-    result = ""
-    for arg in args:
-        result += arg
-    return result
-
-
-def concatenate(*args: List[str]) -> str:
-    result = ""
-    for arg in args:
-        result += str(arg)
-    return result
-
-
-def setup_hook_example(name):
-    logging.warning("setup_hook_example")
-    return f"setup_hook_example: {name}"
-
-
-def teardown_hook_example(name):
-    logging.warning("teardown_hook_example")
-    return f"teardown_hook_example: {name}"
+from debugtalk import *
 
 
 if __name__ == "__main__":
+    import funppy
     funppy.register("get_user_agent", get_user_agent)
     funppy.register("sleep", sleep)
     funppy.register("sum", sum)
diff --git a/hrp/internal/scaffold/templates/plugin/debugtalkGoTemplate b/hrp/internal/scaffold/templates/plugin/debugtalkGoTemplate
index d5b096bc0..be50fa2cc 100644
--- a/hrp/internal/scaffold/templates/plugin/debugtalkGoTemplate
+++ b/hrp/internal/scaffold/templates/plugin/debugtalkGoTemplate
@@ -2,12 +2,12 @@
 package main
 
 import (
-    "github.com/httprunner/funplugin/fungo"
+	"github.com/httprunner/funplugin/fungo"
 )
 
 func main() {
 {{- range $functionName := .FunctionNames }}
-    fungo.Register("{{ $functionName }}", {{ $functionName }})
+	fungo.Register("{{ $functionName }}", {{ $functionName }})
 {{- end }}
 	fungo.Serve()
 }
diff --git a/hrp/internal/scaffold/templates/plugin/debugtalkPythonTemplate b/hrp/internal/scaffold/templates/plugin/debugtalkPythonTemplate
index dc16657aa..611235993 100644
--- a/hrp/internal/scaffold/templates/plugin/debugtalkPythonTemplate
+++ b/hrp/internal/scaffold/templates/plugin/debugtalkPythonTemplate
@@ -1,17 +1,15 @@
 # NOTE: Generated By hrp {{ .Version }}, DO NOT EDIT!
 
-{{ range $import := .Imports }}
-{{- $import}}
-{{ end }}
-{{ range $fromImport := .FromImports }}
-{{- $fromImport}}
-{{ end }}
+import sys
+import os
+
+sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
+
+from debugtalk import *
 
-{{ range $function := .Functions }}
-{{- $function }}
-{{ end }}
 
 if __name__ == "__main__":
+    import funppy
 {{- range $functionName := .FunctionNames }}
     funppy.register("{{ $functionName }}", {{ $functionName }})
 {{- end }}
diff --git a/hrp/internal/scaffold/templates/plugin/debugtalk_gen.go b/hrp/internal/scaffold/templates/plugin/debugtalk_gen.go
index 1e6ceac9d..df7727c3d 100644
--- a/hrp/internal/scaffold/templates/plugin/debugtalk_gen.go
+++ b/hrp/internal/scaffold/templates/plugin/debugtalk_gen.go
@@ -1,4 +1,4 @@
-// NOTE: Generated By hrp v4.1.2, DO NOT EDIT!
+// NOTE: Generated By hrp v4.1.3, DO NOT EDIT!
 package main
 
 import (
diff --git a/hrp/internal/version/VERSION b/hrp/internal/version/VERSION
index b572ab0bd..8a58a0dc0 100644
--- a/hrp/internal/version/VERSION
+++ b/hrp/internal/version/VERSION
@@ -1,1 +1,1 @@
-v4.1.2
\ No newline at end of file
+v4.1.3
\ No newline at end of file
diff --git a/hrp/internal/version/init.go b/hrp/internal/version/init.go
index 836ffca7d..4887463b9 100644
--- a/hrp/internal/version/init.go
+++ b/hrp/internal/version/init.go
@@ -6,5 +6,3 @@ import (
 
 //go:embed VERSION
 var VERSION string
-
-const HttpRunnerMinVersion = "v4.1.0"
diff --git a/hrp/parser.go b/hrp/parser.go
index 84482e3ad..99e4359b6 100644
--- a/hrp/parser.go
+++ b/hrp/parser.go
@@ -7,6 +7,7 @@ import (
 	"path"
 	"reflect"
 	"regexp"
+	"strconv"
 	"strings"
 
 	"github.com/httprunner/funplugin"
@@ -66,13 +67,15 @@ func (p *Parser) ParseHeaders(rawHeaders map[string]string, variablesMapping map
 }
 
 func convertString(raw interface{}) string {
-	if value, ok := raw.(string); ok {
-		return value
-	} else {
-		// raw is not string, e.g. int, float, etc.
-		// convert to string
-		return fmt.Sprintf("%v", raw)
+	if str, ok := raw.(string); ok {
+		return str
+	}
+	if float, ok := raw.(float64); ok {
+		// f: avoid conversion to exponential notation
+		return strconv.FormatFloat(float, 'f', -1, 64)
 	}
+	// convert to string
+	return fmt.Sprintf("%v", raw)
 }
 
 func (p *Parser) Parse(raw interface{}, variablesMapping map[string]interface{}) (interface{}, error) {
@@ -203,7 +206,7 @@ func (p *Parser) ParseString(raw string, variablesMapping map[string]interface{}
 
 			// raw_string contains one or many functions, e.g. "abc${add_one(3)}def"
 			matchStartPosition += len(funcMatched[0])
-			parsedString += fmt.Sprintf("%v", result)
+			parsedString += convertString(result)
 			remainedString = raw[matchStartPosition:]
 			log.Debug().
 				Str("parsedString", parsedString).
@@ -232,7 +235,7 @@ func (p *Parser) ParseString(raw string, variablesMapping map[string]interface{}
 			}
 
 			matchStartPosition += len(varMatched[0])
-			parsedString += fmt.Sprintf("%v", varValue)
+			parsedString += convertString(varValue)
 			remainedString = raw[matchStartPosition:]
 			log.Debug().
 				Str("parsedString", parsedString).
diff --git a/hrp/plugin.go b/hrp/plugin.go
index 5053b2e5c..a23433580 100644
--- a/hrp/plugin.go
+++ b/hrp/plugin.go
@@ -9,8 +9,10 @@ import (
 	"syscall"
 
 	"github.com/httprunner/funplugin"
+	"github.com/httprunner/funplugin/fungo"
 	"github.com/rs/zerolog/log"
 
+	"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
 	"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
 )
 
@@ -25,7 +27,7 @@ const (
 
 const projectInfoFile = "proj.json" // used for ensuring root project
 
-func initPlugin(path string, logOn bool) (plugin funplugin.IPlugin, err error) {
+func initPlugin(path, venv string, logOn bool) (plugin funplugin.IPlugin, err error) {
 	// plugin file not found
 	if path == "" {
 		return nil, nil
@@ -35,6 +37,8 @@ func initPlugin(path string, logOn bool) (plugin funplugin.IPlugin, err error) {
 		return nil, nil
 	}
 
+	pluginOptions := []funplugin.Option{funplugin.WithLogOn(logOn)}
+
 	if strings.HasSuffix(pluginPath, ".py") {
 		// register funppy plugin
 		genPyPluginPath := filepath.Join(filepath.Dir(pluginPath), PluginPySourceGenFile)
@@ -44,10 +48,22 @@ func initPlugin(path string, logOn bool) (plugin funplugin.IPlugin, err error) {
 			return nil, nil
 		}
 		pluginPath = genPyPluginPath
+
+		packages := []string{
+			fmt.Sprintf("funppy==%s", fungo.Version),
+		}
+		python3, err := builtin.EnsurePython3Venv(venv, packages...)
+		if err != nil {
+			log.Error().Err(err).
+				Interface("packages", packages).
+				Msg("python3 venv is not ready")
+			return nil, err
+		}
+		pluginOptions = append(pluginOptions, funplugin.WithPython3(python3))
 	}
 
 	// found plugin file
-	plugin, err = funplugin.Init(pluginPath, funplugin.WithLogOn(logOn))
+	plugin, err = funplugin.Init(pluginPath, pluginOptions...)
 	if err != nil {
 		log.Error().Err(err).Msgf("init plugin failed: %s", pluginPath)
 		return
diff --git a/hrp/runner.go b/hrp/runner.go
index 8290b1bf2..46eb2af8f 100644
--- a/hrp/runner.go
+++ b/hrp/runner.go
@@ -58,6 +58,7 @@ type HRPRunner struct {
 	httpStatOn    bool
 	requestsLogOn bool
 	pluginLogOn   bool
+	venv          string
 	saveTests     bool
 	genHTMLReport bool
 	httpClient    *http.Client
@@ -116,6 +117,13 @@ func (r *HRPRunner) SetPluginLogOn() *HRPRunner {
 	return r
 }
 
+// SetPython3Venv specifies python3 venv.
+func (r *HRPRunner) SetPython3Venv(venv string) *HRPRunner {
+	log.Info().Str("venv", venv).Msg("[init] SetPython3Venv")
+	r.venv = venv
+	return r
+}
+
 // SetProxyUrl configures the proxy URL, which is usually used to capture HTTP packets for debugging.
 func (r *HRPRunner) SetProxyUrl(proxyUrl string) *HRPRunner {
 	log.Info().Str("proxyUrl", proxyUrl).Msg("[init] SetProxyUrl")
@@ -235,7 +243,7 @@ func (r *HRPRunner) newCaseRunner(testcase *TestCase) (*testCaseRunner, error) {
 	}
 
 	// init parser plugin
-	plugin, err := initPlugin(testcase.Config.Path, r.pluginLogOn)
+	plugin, err := initPlugin(testcase.Config.Path, r.venv, r.pluginLogOn)
 	if err != nil {
 		return nil, errors.Wrap(err, "init plugin failed")
 	}
diff --git a/hrp/step_request.go b/hrp/step_request.go
index f890a93e5..8c4de3a4f 100644
--- a/hrp/step_request.go
+++ b/hrp/step_request.go
@@ -125,7 +125,7 @@ func (r *requestBuilder) prepareHeaders(stepVariables map[string]interface{}) er
 		}
 		r.req.AddCookie(&http.Cookie{
 			Name:  cookieName,
-			Value: fmt.Sprintf("%v", value),
+			Value: convertString(value),
 		})
 	}
 
@@ -163,7 +163,7 @@ func (r *requestBuilder) prepareUrlParams(stepVariables map[string]interface{})
 		if len(parsedParams) > 0 {
 			queryParams = make(url.Values)
 			for k, v := range parsedParams {
-				queryParams.Add(k, fmt.Sprint(v))
+				queryParams.Add(k, convertString(v))
 			}
 		}
 	}
@@ -217,7 +217,7 @@ func (r *requestBuilder) prepareBody(stepVariables map[string]interface{}) error
 			// post form data
 			formData := make(url.Values)
 			for k, v := range vv {
-				formData.Add(k, fmt.Sprint(v))
+				formData.Add(k, convertString(v))
 			}
 			dataBytes = []byte(formData.Encode())
 		} else {
diff --git a/httprunner/__init__.py b/httprunner/__init__.py
index aba582779..6d1c0ef76 100644
--- a/httprunner/__init__.py
+++ b/httprunner/__init__.py
@@ -1,4 +1,4 @@
-__version__ = "v4.1.2"
+__version__ = "v4.1.3"
 __description__ = "One-stop solution for HTTP(S) testing."
 
 
diff --git a/pyproject.toml b/pyproject.toml
index b1a8da319..2eb2a102f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "httprunner"
-version = "v4.1.2"
+version = "v4.1.3"
 description = "One-stop solution for HTTP(S) testing."
 license = "Apache-2.0"
 readme = "README.md"
diff --git a/scripts/install.sh b/scripts/install.sh
index 686feffaf..709167ff3 100644
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -135,6 +135,13 @@ function main() {
     hrp -v
     echo "$ hrp -h"
     hrp -h
+    echo
+
+    if [[ -f $HOME/.hrp/venv/bin/pip3 ]]; then
+        echoInfo "Upgrade httprunner..."
+        echo "$ $HOME/.hrp/venv/bin/pip3 install --upgrade httprunner==$version --index-url https://pypi.org/simple"
+        $HOME/.hrp/venv/bin/pip3 install --upgrade httprunner==$version --index-url https://pypi.org/simple
+    fi
 }
 
 main


Test patch:
diff --git a/docs/cmd/hrp_pytest.md b/docs/cmd/hrp_pytest.md
index 70be09895..3ceb2d62b 100644
--- a/docs/cmd/hrp_pytest.md
+++ b/docs/cmd/hrp_pytest.md
@@ -16,4 +16,4 @@ hrp pytest $path ... [flags]
 
 * [hrp](hrp.md)	 - Next-Generation API Testing Solution.
 
-###### Auto generated by spf13/cobra on 9-Jun-2022
+###### Auto generated by spf13/cobra on 14-Jun-2022
diff --git a/examples/demo-with-go-plugin/testcases/demo.json b/examples/demo-with-go-plugin/testcases/demo.json
index 1bb63ed88..8e50e2aa6 100644
--- a/examples/demo-with-go-plugin/testcases/demo.json
+++ b/examples/demo-with-go-plugin/testcases/demo.json
@@ -173,4 +173,4 @@
             ]
         }
     ]
-}
\ No newline at end of file
+}
diff --git a/examples/demo-with-go-plugin/testcases/requests.json b/examples/demo-with-go-plugin/testcases/requests.json
index 75c464f97..4c01ec74f 100644
--- a/examples/demo-with-go-plugin/testcases/requests.json
+++ b/examples/demo-with-go-plugin/testcases/requests.json
@@ -22,7 +22,7 @@
             "variables": {
                 "foo1": "${ENV(USERNAME)}",
                 "foo2": "bar21",
-                "sum_v": "${sum_two_int(1, 2)}"
+                "sum_v": "${sum_two_int(10000000, 20000000)}"
             },
             "request": {
                 "method": "GET",
@@ -52,7 +52,7 @@
                 {
                     "check": "body.args.sum_v",
                     "assert": "equal",
-                    "expect": "3",
+                    "expect": "30000000",
                     "msg": "check body.args.sum_v"
                 },
                 {
diff --git a/examples/demo-with-go-plugin/testcases/requests.yml b/examples/demo-with-go-plugin/testcases/requests.yml
index 1db4e4d1c..5922ab12f 100644
--- a/examples/demo-with-go-plugin/testcases/requests.yml
+++ b/examples/demo-with-go-plugin/testcases/requests.yml
@@ -16,7 +16,7 @@ teststeps:
     variables:
         foo1: ${ENV(USERNAME)}
         foo2: bar21
-        sum_v: "${sum_two_int(1, 2)}"
+        sum_v: "${sum_two_int(10000000, 20000000)}"
     request:
         method: GET
         url: $base_url/get
@@ -29,7 +29,7 @@ teststeps:
     validate:
         - eq: ["status_code", 200]
         - eq: ["body.args.foo1", "debugtalk"]
-        - eq: ["body.args.sum_v", "3"]
+        - eq: ["body.args.sum_v", "30000000"]
         - eq: ["body.args.foo2", "bar21"]
 -
     name: post raw text
diff --git a/examples/demo-with-py-plugin/testcases/demo.json b/examples/demo-with-py-plugin/testcases/demo.json
index 1bb63ed88..8e50e2aa6 100644
--- a/examples/demo-with-py-plugin/testcases/demo.json
+++ b/examples/demo-with-py-plugin/testcases/demo.json
@@ -173,4 +173,4 @@
             ]
         }
     ]
-}
\ No newline at end of file
+}
diff --git a/examples/demo-with-py-plugin/testcases/requests.json b/examples/demo-with-py-plugin/testcases/requests.json
index 75c464f97..4c01ec74f 100644
--- a/examples/demo-with-py-plugin/testcases/requests.json
+++ b/examples/demo-with-py-plugin/testcases/requests.json
@@ -22,7 +22,7 @@
             "variables": {
                 "foo1": "${ENV(USERNAME)}",
                 "foo2": "bar21",
-                "sum_v": "${sum_two_int(1, 2)}"
+                "sum_v": "${sum_two_int(10000000, 20000000)}"
             },
             "request": {
                 "method": "GET",
@@ -52,7 +52,7 @@
                 {
                     "check": "body.args.sum_v",
                     "assert": "equal",
-                    "expect": "3",
+                    "expect": "30000000",
                     "msg": "check body.args.sum_v"
                 },
                 {
diff --git a/examples/demo-with-py-plugin/testcases/requests.yml b/examples/demo-with-py-plugin/testcases/requests.yml
index 1db4e4d1c..5922ab12f 100644
--- a/examples/demo-with-py-plugin/testcases/requests.yml
+++ b/examples/demo-with-py-plugin/testcases/requests.yml
@@ -16,7 +16,7 @@ teststeps:
     variables:
         foo1: ${ENV(USERNAME)}
         foo2: bar21
-        sum_v: "${sum_two_int(1, 2)}"
+        sum_v: "${sum_two_int(10000000, 20000000)}"
     request:
         method: GET
         url: $base_url/get
@@ -29,7 +29,7 @@ teststeps:
     validate:
         - eq: ["status_code", 200]
         - eq: ["body.args.foo1", "debugtalk"]
-        - eq: ["body.args.sum_v", "3"]
+        - eq: ["body.args.sum_v", "30000000"]
         - eq: ["body.args.foo2", "bar21"]
 -
     name: post raw text
diff --git a/examples/postman_echo/request_methods/request_with_functions_test.py b/examples/postman_echo/request_methods/request_with_functions_test.py
index a6f8ce0bc..88be49750 100644
--- a/examples/postman_echo/request_methods/request_with_functions_test.py
+++ b/examples/postman_echo/request_methods/request_with_functions_test.py
@@ -1,4 +1,4 @@
-# NOTE: Generated By HttpRunner v4.0.0
+# NOTE: Generated By HttpRunner v4.1.3
 # FROM: request_methods/request_with_functions.yml
 
 
diff --git a/hrp/cmd/pytest.go b/hrp/cmd/pytest.go
index fd7732fbe..2e1933ad7 100644
--- a/hrp/cmd/pytest.go
+++ b/hrp/cmd/pytest.go
@@ -1,9 +1,14 @@
 package cmd
 
 import (
+	"fmt"
+
+	"github.com/rs/zerolog/log"
 	"github.com/spf13/cobra"
 
+	"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
 	"github.com/httprunner/httprunner/v4/hrp/internal/pytest"
+	"github.com/httprunner/httprunner/v4/hrp/internal/version"
 )
 
 var pytestCmd = &cobra.Command{
@@ -15,6 +20,14 @@ var pytestCmd = &cobra.Command{
 	},
 	DisableFlagParsing: true, // allow to pass any args to pytest
 	RunE: func(cmd *cobra.Command, args []string) error {
+		packages := []string{
+			fmt.Sprintf("httprunner==%s", version.VERSION),
+		}
+		_, err := builtin.EnsurePython3Venv(venv, packages...)
+		if err != nil {
+			log.Error().Err(err).Msg("python3 venv is not ready")
+			return err
+		}
 		return pytest.RunPytest(args)
 	},
 }
diff --git a/hrp/internal/convert/converter_gotest.go b/hrp/internal/convert/converter_gotest.go
index 863da231f..04897c763 100644
--- a/hrp/internal/convert/converter_gotest.go
+++ b/hrp/internal/convert/converter_gotest.go
@@ -48,12 +48,7 @@ func convert2GoTestScripts(paths ...string) error {
 	}
 
 	// format pytest scripts with black
-	python3, err := builtin.EnsurePython3Venv("black")
-	if err != nil {
-		return err
-	}
-	args := append([]string{"-m", "black"}, pytestPaths...)
-	return builtin.ExecCommand(python3, args...)
+	return builtin.ExecPython3Command("black", pytestPaths...)
 }
 
 //go:embed testcase.tmpl
diff --git a/hrp/internal/convert/converter_pytest.go b/hrp/internal/convert/converter_pytest.go
index 8c094900e..233bcdeda 100644
--- a/hrp/internal/convert/converter_pytest.go
+++ b/hrp/internal/convert/converter_pytest.go
@@ -1,19 +1,1 @@
 package convert
-
-import (
-	"fmt"
-
-	"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
-	"github.com/httprunner/httprunner/v4/hrp/internal/version"
-)
-
-func convert2PyTestScripts(paths ...string) error {
-	httprunner := fmt.Sprintf("httprunner>=%s", version.HttpRunnerMinVersion)
-	python3, err := builtin.EnsurePython3Venv(httprunner)
-	if err != nil {
-		return err
-	}
-
-	args := append([]string{"-m", "httprunner", "make"}, paths...)
-	return builtin.ExecCommand(python3, args...)
-}
diff --git a/hrp/internal/pytest/main.go b/hrp/internal/pytest/main.go
index a1c0c88c1..dde5f0ae6 100644
--- a/hrp/internal/pytest/main.go
+++ b/hrp/internal/pytest/main.go
@@ -1,11 +1,8 @@
 package pytest
 
 import (
-	"fmt"
-
 	"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
 	"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
-	"github.com/httprunner/httprunner/v4/hrp/internal/version"
 )
 
 func RunPytest(args []string) error {
@@ -14,12 +11,6 @@ func RunPytest(args []string) error {
 		Action:   "hrp pytest",
 	})
 
-	httprunner := fmt.Sprintf("httprunner>=%s", version.HttpRunnerMinVersion)
-	python3, err := builtin.EnsurePython3Venv(httprunner)
-	if err != nil {
-		return err
-	}
-
-	args = append([]string{"-m", "httprunner", "run"}, args...)
-	return builtin.ExecCommand(python3, args...)
+	args = append([]string{"run"}, args...)
+	return builtin.ExecPython3Command("httprunner", args...)
 }
diff --git a/hrp/internal/scaffold/examples_test.go b/hrp/internal/scaffold/examples_test.go
index d480ffb6c..4ed02cf1a 100644
--- a/hrp/internal/scaffold/examples_test.go
+++ b/hrp/internal/scaffold/examples_test.go
@@ -1,30 +1,32 @@
 package scaffold
 
 import (
+	"path/filepath"
 	"testing"
 )
 
 func TestGenDemoExamples(t *testing.T) {
 	dir := "../../../examples/demo-with-go-plugin"
-	err := CreateScaffold(dir, Go, true)
+	err := CreateScaffold(dir, Go, "", true)
 	if err != nil {
 		t.Fatal()
 	}
 
 	dir = "../../../examples/demo-with-py-plugin"
-	err = CreateScaffold(dir, Py, true)
+	venv := filepath.Join(dir, ".venv")
+	err = CreateScaffold(dir, Py, venv, true)
 	if err != nil {
 		t.Fatal()
 	}
 
 	dir = "../../../examples/demo-without-plugin"
-	err = CreateScaffold(dir, Ignore, true)
+	err = CreateScaffold(dir, Ignore, "", true)
 	if err != nil {
 		t.Fatal()
 	}
 
 	dir = "../../../examples/demo-empty-project"
-	err = CreateScaffold(dir, Empty, true)
+	err = CreateScaffold(dir, Empty, "", true)
 	if err != nil {
 		t.Fatal()
 	}
diff --git a/hrp/internal/scaffold/templates/testcases/demo_requests.json b/hrp/internal/scaffold/templates/testcases/demo_requests.json
index 75c464f97..4c01ec74f 100644
--- a/hrp/internal/scaffold/templates/testcases/demo_requests.json
+++ b/hrp/internal/scaffold/templates/testcases/demo_requests.json
@@ -22,7 +22,7 @@
             "variables": {
                 "foo1": "${ENV(USERNAME)}",
                 "foo2": "bar21",
-                "sum_v": "${sum_two_int(1, 2)}"
+                "sum_v": "${sum_two_int(10000000, 20000000)}"
             },
             "request": {
                 "method": "GET",
@@ -52,7 +52,7 @@
                 {
                     "check": "body.args.sum_v",
                     "assert": "equal",
-                    "expect": "3",
+                    "expect": "30000000",
                     "msg": "check body.args.sum_v"
                 },
                 {
diff --git a/hrp/internal/scaffold/templates/testcases/demo_requests.yml b/hrp/internal/scaffold/templates/testcases/demo_requests.yml
index 1db4e4d1c..5922ab12f 100644
--- a/hrp/internal/scaffold/templates/testcases/demo_requests.yml
+++ b/hrp/internal/scaffold/templates/testcases/demo_requests.yml
@@ -16,7 +16,7 @@ teststeps:
     variables:
         foo1: ${ENV(USERNAME)}
         foo2: bar21
-        sum_v: "${sum_two_int(1, 2)}"
+        sum_v: "${sum_two_int(10000000, 20000000)}"
     request:
         method: GET
         url: $base_url/get
@@ -29,7 +29,7 @@ teststeps:
     validate:
         - eq: ["status_code", 200]
         - eq: ["body.args.foo1", "debugtalk"]
-        - eq: ["body.args.sum_v", "3"]
+        - eq: ["body.args.sum_v", "30000000"]
         - eq: ["body.args.foo2", "bar21"]
 -
     name: post raw text
diff --git a/hrp/internal/scaffold/templates/testcases/demo_requests_test.py b/hrp/internal/scaffold/templates/testcases/demo_requests_test.py
index dd65d1f0d..30d7f022a 100644
--- a/hrp/internal/scaffold/templates/testcases/demo_requests_test.py
+++ b/hrp/internal/scaffold/templates/testcases/demo_requests_test.py
@@ -26,7 +26,7 @@ class TestCaseDemoRequests(HttpRunner):
         Step(
             RunRequest("get with params")
             .with_variables(
-                **{"foo1": "bar11", "foo2": "bar21", "sum_v": "${sum_two_int(1, 2)}"}
+                **{"foo1": "bar11", "foo2": "bar21", "sum_v": "${sum_two_int(10000000, 20000000)}"}
             )
             .get("/get")
             .with_params(**{"foo1": "$foo1", "foo2": "$foo2", "sum_v": "$sum_v"})
@@ -36,7 +36,7 @@ class TestCaseDemoRequests(HttpRunner):
             .validate()
             .assert_equal("status_code", 200)
             .assert_equal("body.args.foo1", "bar11")
-            .assert_equal("body.args.sum_v", "3")
+            .assert_equal("body.args.sum_v", "30000000")
             .assert_equal("body.args.foo2", "bar21")
         ),
         Step(
diff --git a/hrp/parser_test.go b/hrp/parser_test.go
index ee0b6fb35..ced53b696 100644
--- a/hrp/parser_test.go
+++ b/hrp/parser_test.go
@@ -613,6 +613,8 @@ func TestConvertString(t *testing.T) {
 		{"123", "123"},
 		{123, "123"},
 		{1.23, "1.23"},
+		{100000000000, "100000000000"}, // avoid exponential notation
+		{100000000000.23, "100000000000.23"},
 		{nil, "<nil>"},
 	}