From 83c554decb62af30b29e956f2167feb596cdfb32 Mon Sep 17 00:00:00 2001 From: xucong053 Date: Fri, 27 May 2022 11:29:41 +0800 Subject: [PATCH] update templates/testcases --- docs/cmd/hrp.md | 2 +- docs/cmd/hrp_boom.md | 2 +- docs/cmd/hrp_convert.md | 2 +- docs/cmd/hrp_har2case.md | 2 +- docs/cmd/hrp_pytest.md | 2 +- docs/cmd/hrp_run.md | 2 +- docs/cmd/hrp_startproject.md | 2 +- docs/cmd/hrp_wiki.md | 2 +- examples/demo-with-go-plugin/proj.json | 2 +- .../testcases/ref_testcase.yml | 15 ++---- .../testcases/requests.yml | 50 ++++--------------- examples/demo-with-py-plugin/proj.json | 2 +- .../testcases/ref_testcase.yml | 15 ++---- .../testcases/requests.yml | 50 ++++--------------- examples/demo-without-plugin/proj.json | 2 +- .../testcases/demo_empty_request.yml | 5 +- .../templates/testcases/demo_ref_testcase.yml | 15 ++---- .../templates/testcases/demo_requests.yml | 50 ++++--------------- 18 files changed, 51 insertions(+), 171 deletions(-) diff --git a/docs/cmd/hrp.md b/docs/cmd/hrp.md index a1b46ac0..c9499319 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 26-May-2022 +###### Auto generated by spf13/cobra on 27-May-2022 diff --git a/docs/cmd/hrp_boom.md b/docs/cmd/hrp_boom.md index 78dc8845..429a0ed3 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 26-May-2022 +###### Auto generated by spf13/cobra on 27-May-2022 diff --git a/docs/cmd/hrp_convert.md b/docs/cmd/hrp_convert.md index 9d0bf745..3083456c 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 26-May-2022 +###### Auto generated by spf13/cobra on 27-May-2022 diff --git a/docs/cmd/hrp_har2case.md b/docs/cmd/hrp_har2case.md index 8ca7631e..592c5281 100644 --- a/docs/cmd/hrp_har2case.md +++ b/docs/cmd/hrp_har2case.md @@ -24,4 +24,4 @@ hrp har2case $har_path... [flags] * [hrp](hrp.md) - Next-Generation API Testing Solution. -###### Auto generated by spf13/cobra on 26-May-2022 +###### Auto generated by spf13/cobra on 27-May-2022 diff --git a/docs/cmd/hrp_pytest.md b/docs/cmd/hrp_pytest.md index ebc5a25d..711c8bac 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 26-May-2022 +###### Auto generated by spf13/cobra on 27-May-2022 diff --git a/docs/cmd/hrp_run.md b/docs/cmd/hrp_run.md index 2dd34349..63da347e 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 26-May-2022 +###### Auto generated by spf13/cobra on 27-May-2022 diff --git a/docs/cmd/hrp_startproject.md b/docs/cmd/hrp_startproject.md index 00ab67ab..e55c5429 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 26-May-2022 +###### Auto generated by spf13/cobra on 27-May-2022 diff --git a/docs/cmd/hrp_wiki.md b/docs/cmd/hrp_wiki.md index 932f1133..2eecbdd0 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 26-May-2022 +###### Auto generated by spf13/cobra on 27-May-2022 diff --git a/examples/demo-with-go-plugin/proj.json b/examples/demo-with-go-plugin/proj.json index 1c051514..2b2fcb6b 100644 --- a/examples/demo-with-go-plugin/proj.json +++ b/examples/demo-with-go-plugin/proj.json @@ -1,6 +1,6 @@ { "project_name": "demo-with-go-plugin", "project_path": "/Users/xxxxx/go/src/github.com/httprunner/httprunner/examples/demo-with-go-plugin", - "create_time": "2022-05-26T22:08:10.455301+08:00", + "create_time": "2022-05-27T11:34:23.903959+08:00", "hrp_version": "v4.1.0-beta" } \ No newline at end of file diff --git a/examples/demo-with-go-plugin/testcases/ref_testcase.yml b/examples/demo-with-go-plugin/testcases/ref_testcase.yml index e102b9ec..0816481c 100644 --- a/examples/demo-with-go-plugin/testcases/ref_testcase.yml +++ b/examples/demo-with-go-plugin/testcases/ref_testcase.yml @@ -28,15 +28,6 @@ teststeps: Content-Type: "application/x-www-form-urlencoded" body: "foo1=$foo1&foo2=$foo3" validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code - - check: body.form.foo1 - assert: equal - expect: bar1 - msg: check body.form.foo1 - - check: body.form.foo2 - assert: equal - expect: bar21 - msg: check body.form.foo2 \ No newline at end of file + - eq: ["status_code", 200] + - eq: ["body.form.foo1", "bar1"] + - eq: ["body.form.foo2", "bar21"] \ No newline at end of file diff --git a/examples/demo-with-go-plugin/testcases/requests.yml b/examples/demo-with-go-plugin/testcases/requests.yml index 988c970f..034dbefb 100644 --- a/examples/demo-with-go-plugin/testcases/requests.yml +++ b/examples/demo-with-go-plugin/testcases/requests.yml @@ -27,22 +27,10 @@ teststeps: extract: foo3: "body.args.foo2" validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code - - check: body.args.foo1 - assert: equal - expect: debugtalk - msg: check body.args.foo1 - - check: body.args.sum_v - assert: equal - expect: "3" - msg: check body.args.sum_v - - check: body.args.foo2 - assert: equal - expect: bar21 - msg: check body.args.foo2 + - eq: ["status_code", 200] + - eq: ["body.args.foo1", "debugtalk"] + - eq: ["body.args.sum_v", "3"] + - eq: ["body.args.foo2", "bar21"] - name: post raw text variables: @@ -56,14 +44,8 @@ teststeps: Content-Type: "text/plain" body: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3." validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code - - check: body.data - assert: equal - expect: "This is expected to be sent back as part of response body: bar12-$expect_foo2-bar32." - msg: check body.data + - eq: ["status_code", 200] + - eq: ["body.data", "This is expected to be sent back as part of response body: bar12-$expect_foo2-bar32."] - name: post form data variables: @@ -76,19 +58,7 @@ teststeps: Content-Type: "application/x-www-form-urlencoded" body: "foo1=$foo1&foo2=$foo2&foo3=$foo3" validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code - - check: body.form.foo1 - assert: equal - expect: $expect_foo1 - msg: check body.form.foo1 - - check: body.form.foo2 - assert: equal - expect: bar23 - msg: check body.form.foo2 - - check: body.form.foo3 - assert: equal - expect: bar21 - msg: check body.form.foo3 + - eq: ["status_code", 200] + - eq: ["body.form.foo1", "$expect_foo1"] + - eq: ["body.form.foo2", "bar23"] + - eq: ["body.form.foo3", "bar21"] diff --git a/examples/demo-with-py-plugin/proj.json b/examples/demo-with-py-plugin/proj.json index a1f7d451..555bccd7 100644 --- a/examples/demo-with-py-plugin/proj.json +++ b/examples/demo-with-py-plugin/proj.json @@ -1,6 +1,6 @@ { "project_name": "demo-with-py-plugin", "project_path": "/Users/xxxxx/go/src/github.com/httprunner/httprunner/examples/demo-with-py-plugin", - "create_time": "2022-05-26T22:08:18.580462+08:00", + "create_time": "2022-05-27T11:34:31.852589+08:00", "hrp_version": "v4.1.0-beta" } \ No newline at end of file diff --git a/examples/demo-with-py-plugin/testcases/ref_testcase.yml b/examples/demo-with-py-plugin/testcases/ref_testcase.yml index e102b9ec..0816481c 100644 --- a/examples/demo-with-py-plugin/testcases/ref_testcase.yml +++ b/examples/demo-with-py-plugin/testcases/ref_testcase.yml @@ -28,15 +28,6 @@ teststeps: Content-Type: "application/x-www-form-urlencoded" body: "foo1=$foo1&foo2=$foo3" validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code - - check: body.form.foo1 - assert: equal - expect: bar1 - msg: check body.form.foo1 - - check: body.form.foo2 - assert: equal - expect: bar21 - msg: check body.form.foo2 \ No newline at end of file + - eq: ["status_code", 200] + - eq: ["body.form.foo1", "bar1"] + - eq: ["body.form.foo2", "bar21"] \ No newline at end of file diff --git a/examples/demo-with-py-plugin/testcases/requests.yml b/examples/demo-with-py-plugin/testcases/requests.yml index 988c970f..034dbefb 100644 --- a/examples/demo-with-py-plugin/testcases/requests.yml +++ b/examples/demo-with-py-plugin/testcases/requests.yml @@ -27,22 +27,10 @@ teststeps: extract: foo3: "body.args.foo2" validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code - - check: body.args.foo1 - assert: equal - expect: debugtalk - msg: check body.args.foo1 - - check: body.args.sum_v - assert: equal - expect: "3" - msg: check body.args.sum_v - - check: body.args.foo2 - assert: equal - expect: bar21 - msg: check body.args.foo2 + - eq: ["status_code", 200] + - eq: ["body.args.foo1", "debugtalk"] + - eq: ["body.args.sum_v", "3"] + - eq: ["body.args.foo2", "bar21"] - name: post raw text variables: @@ -56,14 +44,8 @@ teststeps: Content-Type: "text/plain" body: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3." validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code - - check: body.data - assert: equal - expect: "This is expected to be sent back as part of response body: bar12-$expect_foo2-bar32." - msg: check body.data + - eq: ["status_code", 200] + - eq: ["body.data", "This is expected to be sent back as part of response body: bar12-$expect_foo2-bar32."] - name: post form data variables: @@ -76,19 +58,7 @@ teststeps: Content-Type: "application/x-www-form-urlencoded" body: "foo1=$foo1&foo2=$foo2&foo3=$foo3" validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code - - check: body.form.foo1 - assert: equal - expect: $expect_foo1 - msg: check body.form.foo1 - - check: body.form.foo2 - assert: equal - expect: bar23 - msg: check body.form.foo2 - - check: body.form.foo3 - assert: equal - expect: bar21 - msg: check body.form.foo3 + - eq: ["status_code", 200] + - eq: ["body.form.foo1", "$expect_foo1"] + - eq: ["body.form.foo2", "bar23"] + - eq: ["body.form.foo3", "bar21"] diff --git a/examples/demo-without-plugin/proj.json b/examples/demo-without-plugin/proj.json index 92230cbb..72c78cbf 100644 --- a/examples/demo-without-plugin/proj.json +++ b/examples/demo-without-plugin/proj.json @@ -1,6 +1,6 @@ { "project_name": "demo-without-plugin", "project_path": "/Users/xxxxx/go/src/github.com/httprunner/httprunner/examples/demo-without-plugin", - "create_time": "2022-05-26T22:08:19.331271+08:00", + "create_time": "2022-05-27T11:34:32.548637+08:00", "hrp_version": "v4.1.0-beta" } \ No newline at end of file diff --git a/hrp/internal/scaffold/templates/testcases/demo_empty_request.yml b/hrp/internal/scaffold/templates/testcases/demo_empty_request.yml index 21586762..38e7c4a8 100644 --- a/hrp/internal/scaffold/templates/testcases/demo_empty_request.yml +++ b/hrp/internal/scaffold/templates/testcases/demo_empty_request.yml @@ -10,7 +10,4 @@ teststeps: method: GET url: "https://" validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code + - eq: ["status_code", 200] diff --git a/hrp/internal/scaffold/templates/testcases/demo_ref_testcase.yml b/hrp/internal/scaffold/templates/testcases/demo_ref_testcase.yml index e102b9ec..0816481c 100644 --- a/hrp/internal/scaffold/templates/testcases/demo_ref_testcase.yml +++ b/hrp/internal/scaffold/templates/testcases/demo_ref_testcase.yml @@ -28,15 +28,6 @@ teststeps: Content-Type: "application/x-www-form-urlencoded" body: "foo1=$foo1&foo2=$foo3" validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code - - check: body.form.foo1 - assert: equal - expect: bar1 - msg: check body.form.foo1 - - check: body.form.foo2 - assert: equal - expect: bar21 - msg: check body.form.foo2 \ No newline at end of file + - eq: ["status_code", 200] + - eq: ["body.form.foo1", "bar1"] + - eq: ["body.form.foo2", "bar21"] \ No newline at end of file diff --git a/hrp/internal/scaffold/templates/testcases/demo_requests.yml b/hrp/internal/scaffold/templates/testcases/demo_requests.yml index 988c970f..034dbefb 100644 --- a/hrp/internal/scaffold/templates/testcases/demo_requests.yml +++ b/hrp/internal/scaffold/templates/testcases/demo_requests.yml @@ -27,22 +27,10 @@ teststeps: extract: foo3: "body.args.foo2" validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code - - check: body.args.foo1 - assert: equal - expect: debugtalk - msg: check body.args.foo1 - - check: body.args.sum_v - assert: equal - expect: "3" - msg: check body.args.sum_v - - check: body.args.foo2 - assert: equal - expect: bar21 - msg: check body.args.foo2 + - eq: ["status_code", 200] + - eq: ["body.args.foo1", "debugtalk"] + - eq: ["body.args.sum_v", "3"] + - eq: ["body.args.foo2", "bar21"] - name: post raw text variables: @@ -56,14 +44,8 @@ teststeps: Content-Type: "text/plain" body: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3." validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code - - check: body.data - assert: equal - expect: "This is expected to be sent back as part of response body: bar12-$expect_foo2-bar32." - msg: check body.data + - eq: ["status_code", 200] + - eq: ["body.data", "This is expected to be sent back as part of response body: bar12-$expect_foo2-bar32."] - name: post form data variables: @@ -76,19 +58,7 @@ teststeps: Content-Type: "application/x-www-form-urlencoded" body: "foo1=$foo1&foo2=$foo2&foo3=$foo3" validate: - - check: status_code - assert: equal - expect: 200 - msg: check status_code - - check: body.form.foo1 - assert: equal - expect: $expect_foo1 - msg: check body.form.foo1 - - check: body.form.foo2 - assert: equal - expect: bar23 - msg: check body.form.foo2 - - check: body.form.foo3 - assert: equal - expect: bar21 - msg: check body.form.foo3 + - eq: ["status_code", 200] + - eq: ["body.form.foo1", "$expect_foo1"] + - eq: ["body.form.foo2", "bar23"] + - eq: ["body.form.foo3", "bar21"]