From be523eda0c4f22290e8323f1bcee6614640cd182 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Fri, 21 Oct 2022 21:57:54 +0800 Subject: [PATCH] release v4.3.0 --- docs/CHANGELOG.md | 3 ++- docs/cmd/hrp.md | 2 +- docs/cmd/hrp_boom.md | 3 ++- docs/cmd/hrp_boom_curl.md | 2 +- docs/cmd/hrp_build.md | 2 +- docs/cmd/hrp_convert.md | 2 +- docs/cmd/hrp_convert_curl.md | 2 +- docs/cmd/hrp_curl.md | 2 +- docs/cmd/hrp_dns.md | 2 +- docs/cmd/hrp_ping.md | 2 +- docs/cmd/hrp_pytest.md | 2 +- docs/cmd/hrp_run.md | 2 +- docs/cmd/hrp_run_curl.md | 2 +- docs/cmd/hrp_startproject.md | 2 +- docs/cmd/hrp_traceroute.md | 2 +- docs/cmd/hrp_wiki.md | 2 +- examples/demo-empty-project/proj.json | 4 ++-- examples/demo-with-go-plugin/proj.json | 2 +- examples/demo-with-py-plugin/proj.json | 2 +- examples/demo-without-plugin/proj.json | 4 ++-- hrp/internal/builtin/utils.go | 12 +++++++++--- hrp/internal/code/code.go | 5 +++++ .../scaffold/templates/plugin/.debugtalk_gen.py | 3 ++- .../scaffold/templates/plugin/debugtalk_gen.go | 2 +- hrp/internal/version/VERSION | 2 +- hrp/loader.go | 3 +-- hrp/pkg/uixt/swipe.go | 2 +- hrp/step_mobile_ui.go | 9 +++++++-- httprunner/__init__.py | 2 +- pyproject.toml | 2 +- 30 files changed, 53 insertions(+), 35 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 432d07d7..f3aaf35c 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,10 +1,11 @@ # Release History -## v4.3.0 (2022-10-16) +## v4.3.0 (2022-10-21) - feat: support iOS UI automation with [WebDriverAgent] - feat support Android UI automation with [uiautomator2] - feat: integrage ios device management with [gidevice] +- feat: add specified exit code for different exceptions - refactor: make boomer/uixt/httpstat as sub package ## v4.2.1 (2022-09-01) diff --git a/docs/cmd/hrp.md b/docs/cmd/hrp.md index fae4a004..e60bfc4c 100644 --- a/docs/cmd/hrp.md +++ b/docs/cmd/hrp.md @@ -41,4 +41,4 @@ Copyright 2017 debugtalk * [hrp traceroute](hrp_traceroute.md) - run integrated traceroute command * [hrp wiki](hrp_wiki.md) - visit https://httprunner.com -###### Auto generated by spf13/cobra on 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_boom.md b/docs/cmd/hrp_boom.md index 20adfde0..c5c92782 100644 --- a/docs/cmd/hrp_boom.md +++ b/docs/cmd/hrp_boom.md @@ -44,6 +44,7 @@ hrp boom [flags] --profile string profile for load testing --prometheus-gateway string Prometheus Pushgateway url. --request-increase-rate string Request increase rate, disabled by default. (default "-1") + --run-time int Stop after the specified amount of time(s), Only used --autostart. Defaults to run forever. --spawn-count int The number of users to spawn for load testing (default 1) --spawn-rate float The rate for spawning users (default 1) --worker worker of distributed testing @@ -54,4 +55,4 @@ hrp boom [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. * [hrp boom curl](hrp_boom_curl.md) - run load test with curl command -###### Auto generated by spf13/cobra on 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_boom_curl.md b/docs/cmd/hrp_boom_curl.md index 87a0a66f..f8c7dcc5 100644 --- a/docs/cmd/hrp_boom_curl.md +++ b/docs/cmd/hrp_boom_curl.md @@ -16,4 +16,4 @@ hrp boom curl URLs [flags] * [hrp boom](hrp_boom.md) - run load test with boomer -###### Auto generated by spf13/cobra on 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_build.md b/docs/cmd/hrp_build.md index 0be74f06..69f024ff 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 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_convert.md b/docs/cmd/hrp_convert.md index 24b7ecd9..5f47069a 100644 --- a/docs/cmd/hrp_convert.md +++ b/docs/cmd/hrp_convert.md @@ -23,4 +23,4 @@ hrp convert $path... [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. * [hrp convert curl](hrp_convert_curl.md) - convert curl command to httprunner testcase -###### Auto generated by spf13/cobra on 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_convert_curl.md b/docs/cmd/hrp_convert_curl.md index 9880780a..c6c2dde3 100644 --- a/docs/cmd/hrp_convert_curl.md +++ b/docs/cmd/hrp_convert_curl.md @@ -16,4 +16,4 @@ hrp convert curl URLs [flags] * [hrp convert](hrp_convert.md) - convert to JSON/YAML/gotest/pytest testcases -###### Auto generated by spf13/cobra on 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_curl.md b/docs/cmd/hrp_curl.md index 82fe7511..5ef6e71d 100644 --- a/docs/cmd/hrp_curl.md +++ b/docs/cmd/hrp_curl.md @@ -16,4 +16,4 @@ hrp curl $url [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. -###### Auto generated by spf13/cobra on 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_dns.md b/docs/cmd/hrp_dns.md index 57f051d3..d2aaef60 100644 --- a/docs/cmd/hrp_dns.md +++ b/docs/cmd/hrp_dns.md @@ -26,4 +26,4 @@ hrp dns $url [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. -###### Auto generated by spf13/cobra on 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_ping.md b/docs/cmd/hrp_ping.md index 164652ad..0475d93b 100644 --- a/docs/cmd/hrp_ping.md +++ b/docs/cmd/hrp_ping.md @@ -20,4 +20,4 @@ hrp ping $url [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. -###### Auto generated by spf13/cobra on 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_pytest.md b/docs/cmd/hrp_pytest.md index b5eced08..3512a8ea 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 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_run.md b/docs/cmd/hrp_run.md index 7079fc39..a0f70751 100644 --- a/docs/cmd/hrp_run.md +++ b/docs/cmd/hrp_run.md @@ -36,4 +36,4 @@ hrp run $path... [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. * [hrp run curl](hrp_run_curl.md) - run API test with curl command -###### Auto generated by spf13/cobra on 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_run_curl.md b/docs/cmd/hrp_run_curl.md index cdc3f54c..672a26c2 100644 --- a/docs/cmd/hrp_run_curl.md +++ b/docs/cmd/hrp_run_curl.md @@ -16,4 +16,4 @@ hrp run curl URLs [flags] * [hrp run](hrp_run.md) - run API test with go engine -###### Auto generated by spf13/cobra on 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_startproject.md b/docs/cmd/hrp_startproject.md index d64f16dc..888c7457 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 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_traceroute.md b/docs/cmd/hrp_traceroute.md index f959d880..a31d1dd1 100644 --- a/docs/cmd/hrp_traceroute.md +++ b/docs/cmd/hrp_traceroute.md @@ -19,4 +19,4 @@ hrp traceroute $url [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. -###### Auto generated by spf13/cobra on 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/docs/cmd/hrp_wiki.md b/docs/cmd/hrp_wiki.md index 56669a98..97986ea5 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 21-Aug-2022 +###### Auto generated by spf13/cobra on 21-Oct-2022 diff --git a/examples/demo-empty-project/proj.json b/examples/demo-empty-project/proj.json index b2b376f6..edf45464 100644 --- a/examples/demo-empty-project/proj.json +++ b/examples/demo-empty-project/proj.json @@ -1,5 +1,5 @@ { "project_name": "demo-empty-project", - "create_time": "2022-07-11T11:45:29.942532+08:00", - "hrp_version": "v4.1.6" + "create_time": "2022-10-21T21:54:56.252853+08:00", + "hrp_version": "v4.3.0" } diff --git a/examples/demo-with-go-plugin/proj.json b/examples/demo-with-go-plugin/proj.json index 3225b92e..867531eb 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-09-28T16:40:14.674398+08:00", + "create_time": "2022-10-21T21:52:38.979867+08:00", "hrp_version": "v4.3.0" } diff --git a/examples/demo-with-py-plugin/proj.json b/examples/demo-with-py-plugin/proj.json index a2b30841..c0aeb776 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-09-28T16:40:15.283869+08:00", + "create_time": "2022-10-21T21:52:39.555851+08:00", "hrp_version": "v4.3.0" } diff --git a/examples/demo-without-plugin/proj.json b/examples/demo-without-plugin/proj.json index 50c06186..593129a3 100644 --- a/examples/demo-without-plugin/proj.json +++ b/examples/demo-without-plugin/proj.json @@ -1,5 +1,5 @@ { "project_name": "demo-without-plugin", - "create_time": "2022-07-11T11:45:29.800018+08:00", - "hrp_version": "v4.1.6" + "create_time": "2022-10-21T21:54:56.136458+08:00", + "hrp_version": "v4.3.0" } diff --git a/hrp/internal/builtin/utils.go b/hrp/internal/builtin/utils.go index bfa9c323..2f109a5b 100644 --- a/hrp/internal/builtin/utils.go +++ b/hrp/internal/builtin/utils.go @@ -251,13 +251,19 @@ func LoadFile(path string, structObj interface{}) (err error) { decoder := json.NewDecoder(bytes.NewReader(file)) decoder.UseNumber() err = decoder.Decode(structObj) - err = errors.Wrap(code.LoadJSONError, err.Error()) + if err != nil { + err = errors.Wrap(code.LoadJSONError, err.Error()) + } case ".yaml", ".yml": err = yaml.Unmarshal(file, structObj) - err = errors.Wrap(code.LoadYAMLError, err.Error()) + if err != nil { + err = errors.Wrap(code.LoadYAMLError, err.Error()) + } case ".env": err = parseEnvContent(file, structObj) - err = errors.Wrap(code.LoadEnvError, err.Error()) + if err != nil { + err = errors.Wrap(code.LoadEnvError, err.Error()) + } default: err = code.UnsupportedFileExtension } diff --git a/hrp/internal/code/code.go b/hrp/internal/code/code.go index 9bf517b1..48557401 100644 --- a/hrp/internal/code/code.go +++ b/hrp/internal/code/code.go @@ -134,6 +134,11 @@ var errorsMap = map[error]int{ OCRTextNotFoundError: 84, } +func IsErrorPredefined(err error) bool { + _, ok := errorsMap[err] + return ok +} + func GetErrorCode(err error) (exitCode int) { if err == nil { return Success diff --git a/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py b/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py index 708b20f9..d5c51015 100644 --- a/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py +++ b/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py @@ -1,4 +1,4 @@ -# NOTE: Generated By hrp v4.2.0, DO NOT EDIT! +# NOTE: Generated By hrp v4.3.0, DO NOT EDIT! import sys import os @@ -10,6 +10,7 @@ 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/debugtalk_gen.go b/hrp/internal/scaffold/templates/plugin/debugtalk_gen.go index db5b8409..9d08c9a0 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.3.0-beta-10172144, DO NOT EDIT! +// NOTE: Generated By hrp v4.3.0, DO NOT EDIT! package main import ( diff --git a/hrp/internal/version/VERSION b/hrp/internal/version/VERSION index 6581f6f8..1ddc0f60 100644 --- a/hrp/internal/version/VERSION +++ b/hrp/internal/version/VERSION @@ -1 +1 @@ -v4.3.0-beta-10211541 \ No newline at end of file +v4.3.0 \ No newline at end of file diff --git a/hrp/loader.go b/hrp/loader.go index 9d2ecf8c..ff737c6d 100644 --- a/hrp/loader.go +++ b/hrp/loader.go @@ -53,8 +53,7 @@ func LoadTestCases(iTestCases ...ITestCase) ([]*TestCase, error) { testCasePath := TestCasePath(path) tc, err := testCasePath.ToTestCase() if err != nil { - log.Warn().Err(err).Str("path", path).Msg("load testcase failed") - return err + return nil } testCases = append(testCases, tc) return nil diff --git a/hrp/pkg/uixt/swipe.go b/hrp/pkg/uixt/swipe.go index a7187045..9d0089ff 100644 --- a/hrp/pkg/uixt/swipe.go +++ b/hrp/pkg/uixt/swipe.go @@ -84,7 +84,7 @@ func (dExt *DriverExt) SwipeUntil(direction interface{}, findCondition Action, f } } else if d, ok := direction.([]float64); ok { if err := dExt.SwipeRelative(d[0], d[1], d[2], d[3]); err != nil { - log.Error().Err(err).Msgf("swipe %s failed", d) + log.Error().Err(err).Msgf("swipe %v failed", d) } } else if d, ok := direction.([]interface{}); ok { sx, _ := builtin.Interface2Float64(d[0]) diff --git a/hrp/step_mobile_ui.go b/hrp/step_mobile_ui.go index 90985d9e..3a0cd143 100644 --- a/hrp/step_mobile_ui.go +++ b/hrp/step_mobile_ui.go @@ -614,7 +614,10 @@ func runStepMobileUI(s *SessionRunner, step *TStep) (stepResult *StepResult, err fmt.Sprintf("parse action params failed: %v", err)) } if err := uiDriver.DoAction(action); err != nil { - return stepResult, errors.Wrap(code.MobileUIDriverError, err.Error()) + if !code.IsErrorPredefined(err) { + err = errors.Wrap(code.MobileUIDriverError, err.Error()) + } + return stepResult, err } } @@ -631,7 +634,9 @@ func runStepMobileUI(s *SessionRunner, step *TStep) (stepResult *StepResult, err // validate validateResults, err := validateUI(uiDriver, step.Validators) if err != nil { - err = errors.Wrap(code.MobileUIValidationError, err.Error()) + if !code.IsErrorPredefined(err) { + err = errors.Wrap(code.MobileUIValidationError, err.Error()) + } return } sessionData := newSessionData() diff --git a/httprunner/__init__.py b/httprunner/__init__.py index 866a4993..1f96dea8 100644 --- a/httprunner/__init__.py +++ b/httprunner/__init__.py @@ -1,4 +1,4 @@ -__version__ = "v4.3.0-beta-10211541" +__version__ = "v4.3.0" __description__ = "One-stop solution for HTTP(S) testing." diff --git a/pyproject.toml b/pyproject.toml index 61308132..33947c0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "httprunner" -version = "v4.3.0-beta-10211541" +version = "v4.3.0" description = "One-stop solution for HTTP(S) testing." license = "Apache-2.0" readme = "README.md"