mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 11:36:56 +08:00
fix: unittest
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# Release History
|
# Release History
|
||||||
|
|
||||||
## v4.1.0 (2022-05-24)
|
## v4.1.0 (2022-05-25)
|
||||||
|
|
||||||
- feat: add `wiki` sub-command to open httprunner website
|
- feat: add `wiki` sub-command to open httprunner website
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -37,4 +37,4 @@ Copyright 2017 debugtalk
|
|||||||
* [hrp startproject](hrp_startproject.md) - create a scaffold project
|
* [hrp startproject](hrp_startproject.md) - create a scaffold project
|
||||||
* [hrp wiki](hrp_wiki.md) - visit https://httprunner.com
|
* [hrp wiki](hrp_wiki.md) - visit https://httprunner.com
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 24-May-2022
|
###### Auto generated by spf13/cobra on 25-May-2022
|
||||||
|
|||||||
@@ -42,4 +42,4 @@ hrp boom [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 24-May-2022
|
###### Auto generated by spf13/cobra on 25-May-2022
|
||||||
|
|||||||
@@ -18,4 +18,4 @@ hrp convert $path... [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 24-May-2022
|
###### Auto generated by spf13/cobra on 25-May-2022
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ hrp har2case $har_path... [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 24-May-2022
|
###### Auto generated by spf13/cobra on 25-May-2022
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ hrp pytest $path ... [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 24-May-2022
|
###### Auto generated by spf13/cobra on 25-May-2022
|
||||||
|
|||||||
+1
-1
@@ -35,4 +35,4 @@ hrp run $path... [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 24-May-2022
|
###### Auto generated by spf13/cobra on 25-May-2022
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ hrp startproject $project_name [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 24-May-2022
|
###### Auto generated by spf13/cobra on 25-May-2022
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ hrp wiki [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
* [hrp](hrp.md) - Next-Generation API Testing Solution.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 24-May-2022
|
###### Auto generated by spf13/cobra on 25-May-2022
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"project_name": "demo-with-go-plugin",
|
"project_name": "demo-with-go-plugin",
|
||||||
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-with-go-plugin",
|
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-with-go-plugin",
|
||||||
"create_time": "2022-05-24T22:23:19.739989+08:00",
|
"create_time": "2022-05-25T11:14:42.750876+08:00",
|
||||||
"hrp_version": "v4.1.0-beta"
|
"hrp_version": "v4.1.0-beta"
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"project_name": "demo-with-py-plugin",
|
"project_name": "demo-with-py-plugin",
|
||||||
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-with-py-plugin",
|
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-with-py-plugin",
|
||||||
"create_time": "2022-05-24T22:23:27.199105+08:00",
|
"create_time": "2022-05-25T11:14:52.333942+08:00",
|
||||||
"hrp_version": "v4.1.0-beta"
|
"hrp_version": "v4.1.0-beta"
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"project_name": "demo-without-plugin",
|
"project_name": "demo-without-plugin",
|
||||||
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-without-plugin",
|
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-without-plugin",
|
||||||
"create_time": "2022-05-24T22:23:27.955511+08:00",
|
"create_time": "2022-05-25T11:14:53.862348+08:00",
|
||||||
"hrp_version": "v4.1.0-beta"
|
"hrp_version": "v4.1.0-beta"
|
||||||
}
|
}
|
||||||
+2
-2
@@ -10,7 +10,7 @@ import (
|
|||||||
func NewConfig(name string) *TConfig {
|
func NewConfig(name string) *TConfig {
|
||||||
return &TConfig{
|
return &TConfig{
|
||||||
Name: name,
|
Name: name,
|
||||||
Env: make(map[string]string),
|
Environs: make(map[string]string),
|
||||||
Variables: make(map[string]interface{}),
|
Variables: make(map[string]interface{}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@ type TConfig struct {
|
|||||||
Verify bool `json:"verify,omitempty" yaml:"verify,omitempty"`
|
Verify bool `json:"verify,omitempty" yaml:"verify,omitempty"`
|
||||||
BaseURL string `json:"base_url,omitempty" yaml:"base_url,omitempty"` // deprecated in v4.1, moved to env
|
BaseURL string `json:"base_url,omitempty" yaml:"base_url,omitempty"` // deprecated in v4.1, moved to env
|
||||||
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"` // public request headers
|
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"` // public request headers
|
||||||
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"` // environment variables
|
Environs map[string]string `json:"environs,omitempty" yaml:"environs,omitempty"` // environment variables
|
||||||
Variables map[string]interface{} `json:"variables,omitempty" yaml:"variables,omitempty"` // global variables
|
Variables map[string]interface{} `json:"variables,omitempty" yaml:"variables,omitempty"` // global variables
|
||||||
Parameters map[string]interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"`
|
Parameters map[string]interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"`
|
||||||
ParametersSetting *TParamsConfig `json:"parameters_setting,omitempty" yaml:"parameters_setting,omitempty"`
|
ParametersSetting *TParamsConfig `json:"parameters_setting,omitempty" yaml:"parameters_setting,omitempty"`
|
||||||
|
|||||||
+8
-6
@@ -289,18 +289,20 @@ func (r *testCaseRunner) parseConfig() error {
|
|||||||
|
|
||||||
// merge config environment variables with base_url
|
// merge config environment variables with base_url
|
||||||
// priority: env base_url > base_url
|
// priority: env base_url > base_url
|
||||||
if cfg.Env != nil {
|
if cfg.Environs != nil {
|
||||||
r.parsedConfig.Env = cfg.Env
|
r.parsedConfig.Environs = cfg.Environs
|
||||||
} else {
|
} else {
|
||||||
r.parsedConfig.Env = make(map[string]string)
|
r.parsedConfig.Environs = make(map[string]string)
|
||||||
}
|
}
|
||||||
if value, ok := r.parsedConfig.Env["base_url"]; !ok || value == "" {
|
if value, ok := r.parsedConfig.Environs["base_url"]; !ok || value == "" {
|
||||||
r.parsedConfig.Env["base_url"] = r.parsedConfig.BaseURL
|
if r.parsedConfig.BaseURL != "" {
|
||||||
|
r.parsedConfig.Environs["base_url"] = r.parsedConfig.BaseURL
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge config variables with environment variables
|
// merge config variables with environment variables
|
||||||
// priority: env > config variables
|
// priority: env > config variables
|
||||||
for k, v := range r.parsedConfig.Env {
|
for k, v := range r.parsedConfig.Environs {
|
||||||
r.parsedConfig.Variables[k] = v
|
r.parsedConfig.Variables[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -91,11 +91,11 @@ func (path *TestCasePath) ToTestCase() (*TestCase, error) {
|
|||||||
|
|
||||||
// override testcase config env with variables loaded from .env file
|
// override testcase config env with variables loaded from .env file
|
||||||
// priority: .env file > testcase config env
|
// priority: .env file > testcase config env
|
||||||
if testCase.Config.Env == nil {
|
if testCase.Config.Environs == nil {
|
||||||
testCase.Config.Env = make(map[string]string)
|
testCase.Config.Environs = make(map[string]string)
|
||||||
}
|
}
|
||||||
for key, value := range envVars {
|
for key, value := range envVars {
|
||||||
testCase.Config.Env[key] = value
|
testCase.Config.Environs[key] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user