mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 23:51:25 +08:00
fix starts_with and ends_wih spelling
Change-Id: I1e475e8187f6e793cd9f9029af93a7d80603b26d
This commit is contained in:
+3
-3
@@ -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 |
|
| `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] |
|
| `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 |
|
| `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' |
|
| `regex_match` | regex matches | re.match(B, A) | 'abcdef' regex_match 'a\w+d' |
|
||||||
| `starts_with` | starts with | A.startswith(B) is True | 'abc' startswith 'ab' |
|
| `starts_with` | starts with | A.starts_with(B) is True | 'abc' starts_with 'ab' |
|
||||||
| `ends_with` | ends with | A.endswith(B) is True | 'abc' endswith 'bc' |
|
| `ends_with` | ends with | A.ends_with(B) is True | 'abc' ends_with 'bc' |
|
||||||
|
|
||||||
## Builtin functions
|
## Builtin functions
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## v0.6.1 (2022-02-11)
|
## 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)
|
## v0.6.0 (2022-02-08)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -33,4 +33,4 @@ Copyright 2021 debugtalk
|
|||||||
* [hrp run](hrp_run.md) - run API test
|
* [hrp run](hrp_run.md) - run API test
|
||||||
* [hrp startproject](hrp_startproject.md) - create a scaffold project
|
* [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
|
||||||
|
|||||||
@@ -39,4 +39,4 @@ hrp boom [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - One-stop solution for HTTP(S) testing.
|
* [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
|
||||||
|
|||||||
@@ -23,4 +23,4 @@ hrp har2case $har_path... [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - One-stop solution for HTTP(S) testing.
|
* [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
|
||||||
|
|||||||
+1
-1
@@ -33,4 +33,4 @@ hrp run $path... [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - One-stop solution for HTTP(S) testing.
|
* [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
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ hrp startproject $project_name [flags]
|
|||||||
|
|
||||||
* [hrp](hrp.md) - One-stop solution for HTTP(S) testing.
|
* [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
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"check": "headers.\"Content-Type\"",
|
"check": "headers.\"Content-Type\"",
|
||||||
"assert": "startswith",
|
"assert": "starts_with",
|
||||||
"expect": "application/json"
|
"expect": "application/json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ teststeps:
|
|||||||
expect: 200
|
expect: 200
|
||||||
msg: check response status code
|
msg: check response status code
|
||||||
- check: headers."Content-Type"
|
- check: headers."Content-Type"
|
||||||
assert: startswith
|
assert: starts_with
|
||||||
expect: application/json
|
expect: application/json
|
||||||
- check: body.args.foo1
|
- check: body.args.foo1
|
||||||
assert: length_equals
|
assert: length_equals
|
||||||
|
|||||||
@@ -10,21 +10,70 @@
|
|||||||
"method": "GET",
|
"method": "GET",
|
||||||
"url": "/get",
|
"url": "/get",
|
||||||
"params": {
|
"params": {
|
||||||
"a": 1
|
"a": 1,
|
||||||
|
"foo": "I'm a happy guy"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validate": [
|
"validate": [
|
||||||
|
{
|
||||||
|
"check": "body.args.a",
|
||||||
|
"assert": "eq",
|
||||||
|
"expect": "1",
|
||||||
|
"msg": "check argument a"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"check": "status_code",
|
"check": "status_code",
|
||||||
"assert": "greater_than",
|
"assert": "lt",
|
||||||
|
"expect": 201,
|
||||||
|
"msg": "check status code"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"check": "status_code",
|
||||||
|
"assert": "gt",
|
||||||
"expect": 199,
|
"expect": 199,
|
||||||
"msg": "check status code"
|
"msg": "check status code"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"check": "body.args.a",
|
"check": "status_code",
|
||||||
"assert": "equal",
|
"assert": "ge",
|
||||||
"expect": "1",
|
"expect": 200,
|
||||||
"msg": "check argument a"
|
"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"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+207
@@ -0,0 +1,207 @@
|
|||||||
|
<head>
|
||||||
|
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>TestReport</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
color: #333;
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 960px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#summary {
|
||||||
|
width: 960px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#summary th {
|
||||||
|
background-color: skyblue;
|
||||||
|
padding: 5px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#summary td {
|
||||||
|
background-color: lightblue;
|
||||||
|
text-align: center;
|
||||||
|
padding: 4px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details {
|
||||||
|
width: 960px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details th {
|
||||||
|
background-color: skyblue;
|
||||||
|
padding: 5px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details tr .passed {
|
||||||
|
background-color: lightgreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details tr .failed {
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details tr .unchecked {
|
||||||
|
background-color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details td {
|
||||||
|
background-color: lightblue;
|
||||||
|
padding: 5px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details .detail {
|
||||||
|
background-color: lightgrey;
|
||||||
|
font-size: smaller;
|
||||||
|
padding: 5px 10px;
|
||||||
|
line-height: 20px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details .success {
|
||||||
|
background-color: greenyellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details .error {
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details .failure {
|
||||||
|
background-color: salmon;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details .skipped {
|
||||||
|
background-color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
font-size: 1em;
|
||||||
|
padding: 6px;
|
||||||
|
width: 4em;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #06d85f;
|
||||||
|
border-radius: 20px/50px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.button {
|
||||||
|
color: gray;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover {
|
||||||
|
background: #2cffbd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.7);
|
||||||
|
transition: opacity 500ms;
|
||||||
|
visibility: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
line-height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay:target {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup {
|
||||||
|
margin: 70px auto;
|
||||||
|
padding: 20px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 10px;
|
||||||
|
width: 50%;
|
||||||
|
position: relative;
|
||||||
|
transition: all 3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup h2 {
|
||||||
|
margin-top: 0;
|
||||||
|
color: #333;
|
||||||
|
font-family: Tahoma, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup .close {
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
right: 30px;
|
||||||
|
transition: all 200ms;
|
||||||
|
font-size: 30px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup .close:hover {
|
||||||
|
color: #06d85f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup .content {
|
||||||
|
max-height: 80%;
|
||||||
|
overflow: auto;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup .separator {
|
||||||
|
color: royalblue
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 700px) {
|
||||||
|
.box {
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup {
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>API Test Report</h1>
|
||||||
|
|
||||||
|
<h2>Summary</h2>
|
||||||
|
<table id="summary">
|
||||||
|
<tr>
|
||||||
|
<th>START AT</th>
|
||||||
|
<td colspan="4">2022-02-14 14:39:40.220096 +0800 CST m=+16.010080077</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>DURATION</th>
|
||||||
|
<td colspan="4">0 seconds</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>PLATFORM</th>
|
||||||
|
<td>HttpRunnerPlus v0.6.0</td>
|
||||||
|
<td>go1.16.8</td>
|
||||||
|
<td colspan="2">darwin-amd64</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>STAT</th>
|
||||||
|
<th colspan="2">TESTCASES (success/fail)</th>
|
||||||
|
<th colspan="2">TESTSTEPS (success/fail/error/skip)</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>total (details) =></td>
|
||||||
|
<td colspan="2">0 (0/0)</td>
|
||||||
|
<td colspan="2">0 (0/0/0/0)</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h2>Details</h2>
|
||||||
|
|
||||||
|
</body>
|
||||||
+3
-3
@@ -117,7 +117,7 @@ func (v *responseObject) Validate(validators []Validator, variablesMapping map[s
|
|||||||
assertMethod := validator.Assert
|
assertMethod := validator.Assert
|
||||||
assertFunc, ok := builtin.Assertions[assertMethod]
|
assertFunc, ok := builtin.Assertions[assertMethod]
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New(fmt.Sprintf("unexpected assertion method: %v", assertMethod))
|
return errors.New(fmt.Sprintf("unexpected assertMethod: %v", assertMethod))
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse expected value
|
// parse expected value
|
||||||
@@ -151,10 +151,10 @@ func (v *responseObject) Validate(validators []Validator, variablesMapping map[s
|
|||||||
if !result {
|
if !result {
|
||||||
v.t.Fail()
|
v.t.Fail()
|
||||||
return errors.New(fmt.Sprintf(
|
return errors.New(fmt.Sprintf(
|
||||||
"do assertion failed, assertMethod: %v, expectValue: %v, checkValue: %v",
|
"do assertion failed, assertMethod: %v, checkValue: %v, expectValue: %v",
|
||||||
assertMethod,
|
assertMethod,
|
||||||
expectValue,
|
|
||||||
checkValue,
|
checkValue,
|
||||||
|
expectValue,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -126,7 +126,7 @@ func (s *StepRequestValidation) AssertRegexp(jmesPath string, expected interface
|
|||||||
func (s *StepRequestValidation) AssertStartsWith(jmesPath string, expected interface{}, msg string) *StepRequestValidation {
|
func (s *StepRequestValidation) AssertStartsWith(jmesPath string, expected interface{}, msg string) *StepRequestValidation {
|
||||||
v := Validator{
|
v := Validator{
|
||||||
Check: jmesPath,
|
Check: jmesPath,
|
||||||
Assert: "startswith",
|
Assert: "starts_with",
|
||||||
Expect: expected,
|
Expect: expected,
|
||||||
Message: msg,
|
Message: msg,
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ func (s *StepRequestValidation) AssertStartsWith(jmesPath string, expected inter
|
|||||||
func (s *StepRequestValidation) AssertEndsWith(jmesPath string, expected interface{}, msg string) *StepRequestValidation {
|
func (s *StepRequestValidation) AssertEndsWith(jmesPath string, expected interface{}, msg string) *StepRequestValidation {
|
||||||
v := Validator{
|
v := Validator{
|
||||||
Check: jmesPath,
|
Check: jmesPath,
|
||||||
Assert: "endswith",
|
Assert: "ends_with",
|
||||||
Expect: expected,
|
Expect: expected,
|
||||||
Message: msg,
|
Message: msg,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user