mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-10 17:43:00 +08:00
fix: unittest
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Release History
|
||||
|
||||
## v4.1.0 (2022-05-24)
|
||||
## v4.1.0 (2022-05-25)
|
||||
|
||||
- feat: add `wiki` sub-command to open httprunner website
|
||||
|
||||
|
||||
@@ -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 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.
|
||||
|
||||
###### 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.
|
||||
|
||||
###### 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.
|
||||
|
||||
###### 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.
|
||||
|
||||
###### Auto generated by spf13/cobra on 24-May-2022
|
||||
###### Auto generated by spf13/cobra on 25-May-2022
|
||||
|
||||
@@ -35,4 +35,4 @@ hrp run $path... [flags]
|
||||
|
||||
* [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.
|
||||
|
||||
###### 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.
|
||||
|
||||
###### 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_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"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"project_name": "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"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"project_name": "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"
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
func NewConfig(name string) *TConfig {
|
||||
return &TConfig{
|
||||
Name: name,
|
||||
Env: make(map[string]string),
|
||||
Environs: make(map[string]string),
|
||||
Variables: make(map[string]interface{}),
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ type TConfig struct {
|
||||
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
|
||||
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
|
||||
Parameters map[string]interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"`
|
||||
ParametersSetting *TParamsConfig `json:"parameters_setting,omitempty" yaml:"parameters_setting,omitempty"`
|
||||
|
||||
@@ -289,18 +289,20 @@ func (r *testCaseRunner) parseConfig() error {
|
||||
|
||||
// merge config environment variables with base_url
|
||||
// priority: env base_url > base_url
|
||||
if cfg.Env != nil {
|
||||
r.parsedConfig.Env = cfg.Env
|
||||
if cfg.Environs != nil {
|
||||
r.parsedConfig.Environs = cfg.Environs
|
||||
} 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 == "" {
|
||||
r.parsedConfig.Env["base_url"] = r.parsedConfig.BaseURL
|
||||
if value, ok := r.parsedConfig.Environs["base_url"]; !ok || value == "" {
|
||||
if r.parsedConfig.BaseURL != "" {
|
||||
r.parsedConfig.Environs["base_url"] = r.parsedConfig.BaseURL
|
||||
}
|
||||
}
|
||||
|
||||
// merge config variables with environment variables
|
||||
// priority: env > config variables
|
||||
for k, v := range r.parsedConfig.Env {
|
||||
for k, v := range r.parsedConfig.Environs {
|
||||
r.parsedConfig.Variables[k] = v
|
||||
}
|
||||
|
||||
|
||||
@@ -91,11 +91,11 @@ func (path *TestCasePath) ToTestCase() (*TestCase, error) {
|
||||
|
||||
// override testcase config env with variables loaded from .env file
|
||||
// priority: .env file > testcase config env
|
||||
if testCase.Config.Env == nil {
|
||||
testCase.Config.Env = make(map[string]string)
|
||||
if testCase.Config.Environs == nil {
|
||||
testCase.Config.Environs = make(map[string]string)
|
||||
}
|
||||
for key, value := range envVars {
|
||||
testCase.Config.Env[key] = value
|
||||
testCase.Config.Environs[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user