From 5bce59c583573bd5af0a14ff0097e51fb9bcb531 Mon Sep 17 00:00:00 2001 From: buyuxiang <347586493@qq.com> Date: Mon, 14 Feb 2022 14:41:15 +0800 Subject: [PATCH] fix starts_with and ends_wih spelling Change-Id: I1e475e8187f6e793cd9f9029af93a7d80603b26d --- docs/BUILTIN.md | 6 +- docs/CHANGELOG.md | 2 +- docs/cmd/hrp.md | 2 +- docs/cmd/hrp_boom.md | 2 +- docs/cmd/hrp_har2case.md | 2 +- docs/cmd/hrp_run.md | 2 +- docs/cmd/hrp_startproject.md | 2 +- examples/demo.json | 2 +- examples/demo.yaml | 2 +- examples/httpbingo_test.json | 61 ++++++++++- report.html | 207 +++++++++++++++++++++++++++++++++++ response.go | 6 +- validate.go | 4 +- 13 files changed, 278 insertions(+), 22 deletions(-) create mode 100644 report.html diff --git a/docs/BUILTIN.md b/docs/BUILTIN.md index a4b9305b..064bda60 100644 --- a/docs/BUILTIN.md +++ b/docs/BUILTIN.md @@ -42,9 +42,9 @@ Currently, HttpRunner+ has the following built-in assertion functions. | `contains` | contains | [1, 2] contains 1 | 'abc' contains 'a', [1,2,3] len_lt 4 | | `contained_by` | contained by | A in B | 'a' contained_by 'abc', 1 contained_by [1,2] | | `type_match` | A and B are in the same type | type(A) == type(B) | 123 type_match 1 | -| `regex_match` | regex matches | re.match(B, A) | 'abcdef' regex 'a\w+d' | -| `starts_with` | starts with | A.startswith(B) is True | 'abc' startswith 'ab' | -| `ends_with` | ends with | A.endswith(B) is True | 'abc' endswith 'bc' | +| `regex_match` | regex matches | re.match(B, A) | 'abcdef' regex_match 'a\w+d' | +| `starts_with` | starts with | A.starts_with(B) is True | 'abc' starts_with 'ab' | +| `ends_with` | ends with | A.ends_with(B) is True | 'abc' ends_with 'bc' | ## Builtin functions diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 1cada300..4c68900e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,7 +2,7 @@ ## v0.6.1 (2022-02-11) -- fix: assertion function and json number parse rule +- fix: assertion function errors and json number parse rule ## v0.6.0 (2022-02-08) diff --git a/docs/cmd/hrp.md b/docs/cmd/hrp.md index 688e0c52..2a01d308 100644 --- a/docs/cmd/hrp.md +++ b/docs/cmd/hrp.md @@ -33,4 +33,4 @@ Copyright 2021 debugtalk * [hrp run](hrp_run.md) - run API test * [hrp startproject](hrp_startproject.md) - create a scaffold project -###### Auto generated by spf13/cobra on 8-Feb-2022 +###### Auto generated by spf13/cobra on 14-Feb-2022 diff --git a/docs/cmd/hrp_boom.md b/docs/cmd/hrp_boom.md index e867df88..914f747f 100644 --- a/docs/cmd/hrp_boom.md +++ b/docs/cmd/hrp_boom.md @@ -39,4 +39,4 @@ hrp boom [flags] * [hrp](hrp.md) - One-stop solution for HTTP(S) testing. -###### Auto generated by spf13/cobra on 8-Feb-2022 +###### Auto generated by spf13/cobra on 14-Feb-2022 diff --git a/docs/cmd/hrp_har2case.md b/docs/cmd/hrp_har2case.md index fd05af09..504d6524 100644 --- a/docs/cmd/hrp_har2case.md +++ b/docs/cmd/hrp_har2case.md @@ -23,4 +23,4 @@ hrp har2case $har_path... [flags] * [hrp](hrp.md) - One-stop solution for HTTP(S) testing. -###### Auto generated by spf13/cobra on 8-Feb-2022 \ No newline at end of file +###### Auto generated by spf13/cobra on 14-Feb-2022 diff --git a/docs/cmd/hrp_run.md b/docs/cmd/hrp_run.md index 334cd4fd..7c6ca58c 100644 --- a/docs/cmd/hrp_run.md +++ b/docs/cmd/hrp_run.md @@ -33,4 +33,4 @@ hrp run $path... [flags] * [hrp](hrp.md) - One-stop solution for HTTP(S) testing. -###### Auto generated by spf13/cobra on 8-Feb-2022 +###### Auto generated by spf13/cobra on 14-Feb-2022 diff --git a/docs/cmd/hrp_startproject.md b/docs/cmd/hrp_startproject.md index 6bfcd978..1894cd0b 100644 --- a/docs/cmd/hrp_startproject.md +++ b/docs/cmd/hrp_startproject.md @@ -16,4 +16,4 @@ hrp startproject $project_name [flags] * [hrp](hrp.md) - One-stop solution for HTTP(S) testing. -###### Auto generated by spf13/cobra on 8-Feb-2022 +###### Auto generated by spf13/cobra on 14-Feb-2022 diff --git a/examples/demo.json b/examples/demo.json index 198bcbaa..c59570f2 100644 --- a/examples/demo.json +++ b/examples/demo.json @@ -48,7 +48,7 @@ }, { "check": "headers.\"Content-Type\"", - "assert": "startswith", + "assert": "starts_with", "expect": "application/json" }, { diff --git a/examples/demo.yaml b/examples/demo.yaml index ed6131dc..b70adc53 100644 --- a/examples/demo.yaml +++ b/examples/demo.yaml @@ -33,7 +33,7 @@ teststeps: expect: 200 msg: check response status code - check: headers."Content-Type" - assert: startswith + assert: starts_with expect: application/json - check: body.args.foo1 assert: length_equals diff --git a/examples/httpbingo_test.json b/examples/httpbingo_test.json index b3461ee4..5f1704b2 100644 --- a/examples/httpbingo_test.json +++ b/examples/httpbingo_test.json @@ -10,21 +10,70 @@ "method": "GET", "url": "/get", "params": { - "a": 1 + "a": 1, + "foo": "I'm a happy guy" } }, "validate": [ + { + "check": "body.args.a", + "assert": "eq", + "expect": "1", + "msg": "check argument a" + }, { "check": "status_code", - "assert": "greater_than", + "assert": "lt", + "expect": 201, + "msg": "check status code" + }, + { + "check": "status_code", + "assert": "gt", "expect": 199, "msg": "check status code" }, { - "check": "body.args.a", - "assert": "equal", - "expect": "1", - "msg": "check argument a" + "check": "status_code", + "assert": "ge", + "expect": 200, + "msg": "check status code" + }, + { + "check": "status_code", + "assert": "le", + "expect": 200, + "msg": "check status code" + }, + { + "check": "status_code", + "assert": "ne", + "expect": 199, + "msg": "check status code" + }, + { + "check": "body.args.foo", + "assert": "contains", + "expect": "happy", + "msg": "check status code" + }, + { + "check": "body.args.foo", + "assert": "type_match", + "expect": "string", + "msg": "check status code" + }, + { + "check": "body.args.foo", + "assert": "starts_with", + "expect": "I'm", + "msg": "check status code" + }, + { + "check": "body.args.foo", + "assert": "type_match", + "expect": "string", + "msg": "check status code" } ] } diff --git a/report.html b/report.html new file mode 100644 index 00000000..35cf0a45 --- /dev/null +++ b/report.html @@ -0,0 +1,207 @@ +
+ + +| START AT | +2022-02-14 14:39:40.220096 +0800 CST m=+16.010080077 | +|||
|---|---|---|---|---|
| DURATION | +0 seconds | +|||
| PLATFORM | +HttpRunnerPlus v0.6.0 | +go1.16.8 | +darwin-amd64 | +|
| STAT | +TESTCASES (success/fail) | +TESTSTEPS (success/fail/error/skip) | +||
| total (details) => | +0 (0/0) | +0 (0/0/0/0) | +||