From 3c160aeec661684d822de09e4b45d9e3848454ac Mon Sep 17 00:00:00 2001 From: buyuxiang <347586493@qq.com> Date: Wed, 6 Jul 2022 16:59:41 +0800 Subject: [PATCH] update subcommand curl docs --- docs/cmd/hrp.md | 2 +- docs/cmd/hrp_boom.md | 3 ++- docs/cmd/hrp_boom_curl.md | 26 +++++++++++++++++++ docs/cmd/hrp_build.md | 2 +- docs/cmd/hrp_convert.md | 3 ++- docs/cmd/hrp_convert_curl.md | 26 +++++++++++++++++++ docs/cmd/hrp_pytest.md | 2 +- docs/cmd/hrp_run.md | 3 ++- docs/cmd/hrp_run_curl.md | 26 +++++++++++++++++++ docs/cmd/hrp_startproject.md | 2 +- docs/cmd/hrp_wiki.md | 2 +- examples/demo-with-go-plugin/proj.json | 4 +-- examples/demo-with-py-plugin/proj.json | 4 +-- hrp/cmd/curl.go | 10 ++++--- hrp/internal/convert/from_curl_test.go | 4 +-- .../templates/plugin/.debugtalk_gen.py | 3 ++- .../templates/plugin/debugtalk_gen.go | 2 +- 17 files changed, 104 insertions(+), 20 deletions(-) create mode 100644 docs/cmd/hrp_boom_curl.md create mode 100644 docs/cmd/hrp_convert_curl.md create mode 100644 docs/cmd/hrp_run_curl.md diff --git a/docs/cmd/hrp.md b/docs/cmd/hrp.md index 7dc86997..83eef0fe 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 4-Jul-2022 +###### Auto generated by spf13/cobra on 6-Jul-2022 diff --git a/docs/cmd/hrp_boom.md b/docs/cmd/hrp_boom.md index 7354315a..d4bf9c1d 100644 --- a/docs/cmd/hrp_boom.md +++ b/docs/cmd/hrp_boom.md @@ -41,5 +41,6 @@ hrp boom [flags] ### SEE ALSO * [hrp](hrp.md) - Next-Generation API Testing Solution. +* [hrp boom curl](hrp_boom_curl.md) - run load test with boomer using converted curl testcase -###### Auto generated by spf13/cobra on 4-Jul-2022 +###### Auto generated by spf13/cobra on 6-Jul-2022 diff --git a/docs/cmd/hrp_boom_curl.md b/docs/cmd/hrp_boom_curl.md new file mode 100644 index 00000000..b2aaa474 --- /dev/null +++ b/docs/cmd/hrp_boom_curl.md @@ -0,0 +1,26 @@ +## hrp boom curl + +run load test with boomer using converted curl testcase + +``` +hrp boom curl URLs [flags] +``` + +### Options + +``` + -b, --cookie strings -b, --cookie in curl + -d, --data strings -d, --data in curl + -F, --form strings -F, --form in curl + -G, --get -G, --get in curl + -I, --head -I, --head in curl + -H, --header strings -H, --header in curl + -h, --help help for curl + -X, --request string -X, --request in curl +``` + +### SEE ALSO + +* [hrp boom](hrp_boom.md) - run load test with boomer + +###### Auto generated by spf13/cobra on 6-Jul-2022 diff --git a/docs/cmd/hrp_build.md b/docs/cmd/hrp_build.md index 8103dbbd..c85bded0 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 4-Jul-2022 +###### Auto generated by spf13/cobra on 6-Jul-2022 diff --git a/docs/cmd/hrp_convert.md b/docs/cmd/hrp_convert.md index d438da68..b9e55141 100644 --- a/docs/cmd/hrp_convert.md +++ b/docs/cmd/hrp_convert.md @@ -21,5 +21,6 @@ hrp convert $path... [flags] ### SEE ALSO * [hrp](hrp.md) - Next-Generation API Testing Solution. +* [hrp convert curl](hrp_convert_curl.md) - convert curl command(s) to httprunner testcase -###### Auto generated by spf13/cobra on 4-Jul-2022 +###### Auto generated by spf13/cobra on 6-Jul-2022 diff --git a/docs/cmd/hrp_convert_curl.md b/docs/cmd/hrp_convert_curl.md new file mode 100644 index 00000000..8490123c --- /dev/null +++ b/docs/cmd/hrp_convert_curl.md @@ -0,0 +1,26 @@ +## hrp convert curl + +convert curl command(s) to httprunner testcase + +``` +hrp convert curl URLs [flags] +``` + +### Options + +``` + -b, --cookie strings -b, --cookie in curl + -d, --data strings -d, --data in curl + -F, --form strings -F, --form in curl + -G, --get -G, --get in curl + -I, --head -I, --head in curl + -H, --header strings -H, --header in curl + -h, --help help for curl + -X, --request string -X, --request in curl +``` + +### SEE ALSO + +* [hrp convert](hrp_convert.md) - convert to JSON/YAML/gotest/pytest testcases + +###### Auto generated by spf13/cobra on 6-Jul-2022 diff --git a/docs/cmd/hrp_pytest.md b/docs/cmd/hrp_pytest.md index fc51e272..f50e22a7 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 4-Jul-2022 +###### Auto generated by spf13/cobra on 6-Jul-2022 diff --git a/docs/cmd/hrp_run.md b/docs/cmd/hrp_run.md index 428e6984..1eb95f2b 100644 --- a/docs/cmd/hrp_run.md +++ b/docs/cmd/hrp_run.md @@ -34,5 +34,6 @@ hrp run $path... [flags] ### SEE ALSO * [hrp](hrp.md) - Next-Generation API Testing Solution. +* [hrp run curl](hrp_run_curl.md) - run API test with go engine using converted curl testcase -###### Auto generated by spf13/cobra on 4-Jul-2022 +###### Auto generated by spf13/cobra on 6-Jul-2022 diff --git a/docs/cmd/hrp_run_curl.md b/docs/cmd/hrp_run_curl.md new file mode 100644 index 00000000..ff6906bb --- /dev/null +++ b/docs/cmd/hrp_run_curl.md @@ -0,0 +1,26 @@ +## hrp run curl + +run API test with go engine using converted curl testcase + +``` +hrp run curl URLs [flags] +``` + +### Options + +``` + -b, --cookie strings -b, --cookie in curl + -d, --data strings -d, --data in curl + -F, --form strings -F, --form in curl + -G, --get -G, --get in curl + -I, --head -I, --head in curl + -H, --header strings -H, --header in curl + -h, --help help for curl + -X, --request string -X, --request in curl +``` + +### SEE ALSO + +* [hrp run](hrp_run.md) - run API test with go engine + +###### Auto generated by spf13/cobra on 6-Jul-2022 diff --git a/docs/cmd/hrp_startproject.md b/docs/cmd/hrp_startproject.md index 49544063..ef96dd1f 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 4-Jul-2022 +###### Auto generated by spf13/cobra on 6-Jul-2022 diff --git a/docs/cmd/hrp_wiki.md b/docs/cmd/hrp_wiki.md index 219920fe..fd27525a 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 4-Jul-2022 +###### Auto generated by spf13/cobra on 6-Jul-2022 diff --git a/examples/demo-with-go-plugin/proj.json b/examples/demo-with-go-plugin/proj.json index 08ee1070..13b1eab0 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-07-04T14:53:59.755944+08:00", - "hrp_version": "v4.1.5" + "create_time": "2022-07-06T13:57:04.054424+08:00", + "hrp_version": "v4.1.6" } diff --git a/examples/demo-with-py-plugin/proj.json b/examples/demo-with-py-plugin/proj.json index 6c789922..73d9a31c 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-07-04T14:54:00.346082+08:00", - "hrp_version": "v4.1.5" + "create_time": "2022-07-06T13:57:04.482633+08:00", + "hrp_version": "v4.1.6" } diff --git a/hrp/cmd/curl.go b/hrp/cmd/curl.go index 1dafa5bb..bc67fb79 100644 --- a/hrp/cmd/curl.go +++ b/hrp/cmd/curl.go @@ -14,7 +14,7 @@ import ( var runCurlCmd = &cobra.Command{ Use: "curl URLs", - Short: "run API test with go engine using converted curl testcase", + Short: "run API test with go engine by curl command", Args: cobra.MinimumNArgs(1), PreRun: func(cmd *cobra.Command, args []string) { setLogLevel(logLevel) @@ -29,7 +29,7 @@ var runCurlCmd = &cobra.Command{ var boomCurlCmd = &cobra.Command{ Use: "curl URLs", - Short: "run load test with boomer using converted curl testcase", + Short: "run load test with boomer by curl command", Args: cobra.MinimumNArgs(1), PreRun: func(cmd *cobra.Command, args []string) { boomer.SetUlimit(10240) // ulimit -n 10240 @@ -46,7 +46,7 @@ var boomCurlCmd = &cobra.Command{ var convertCurlCmd = &cobra.Command{ Use: "curl URLs", - Short: "convert curl command(s) to httprunner testcase", + Short: "convert curl command to httprunner testcase", Args: cobra.MinimumNArgs(1), PreRun: func(cmd *cobra.Command, args []string) { setLogLevel(logLevel) @@ -97,10 +97,12 @@ func makeCurlTestCase(args []string) *hrp.TestCase { } casePath, err := os.Getwd() if err != nil { + casePath = "" + log.Error().Err(err).Msg("get working directory failed") } testCase, err := tCase.ToTestCase(casePath) if err != nil { - log.Error().Err(err).Msg("convert testcase failed") + log.Error().Err(err).Msg("convert testcase to failed") os.Exit(1) } return testCase diff --git a/hrp/internal/convert/from_curl_test.go b/hrp/internal/convert/from_curl_test.go index a9b5f4f2..dacf10c7 100644 --- a/hrp/internal/convert/from_curl_test.go +++ b/hrp/internal/convert/from_curl_test.go @@ -66,8 +66,8 @@ func TestLoadCurlCase(t *testing.T) { // curl -F "dummyName=dummyFile" -F file1=@file1.txt -F file2=@file2.txt https://httpbin.org/post if !assert.Equal(t, map[string]interface{}{ "dummyName": "dummyFile", - "file1": "@file1.txt", - "file2": "@file2.txt", + "file1": "file1.txt", + "file2": "file2.txt", }, tCase.TestSteps[3].Request.Upload) { t.Fatal() } diff --git a/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py b/hrp/internal/scaffold/templates/plugin/.debugtalk_gen.py index 70910180..a10c688d 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.1.5, DO NOT EDIT! +# NOTE: Generated By hrp v4.1.6, 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 0ee1ae22..73fe8e9d 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.5, DO NOT EDIT! +// NOTE: Generated By hrp v4.1.6, DO NOT EDIT! package main import (