fix: unittest

This commit is contained in:
xucong053
2022-05-26 20:11:46 +08:00
parent f39a82755e
commit a1f189b3f4
13 changed files with 49 additions and 33 deletions

View File

@@ -0,0 +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-26T20:08:49.164545+08:00",
"hrp_version": "v4.1.0-beta"
}

View File

@@ -26,7 +26,7 @@ teststeps:
headers: headers:
User-Agent: funplugin/${get_version()} User-Agent: funplugin/${get_version()}
Content-Type: "application/x-www-form-urlencoded" Content-Type: "application/x-www-form-urlencoded"
data: "foo1=$foo1&foo2=$foo3" body: "foo1=$foo1&foo2=$foo3"
validate: validate:
- check: status_code - check: status_code
assert: equal assert: equal

View File

@@ -76,7 +76,7 @@
"User-Agent": "funplugin/${get_version()}", "User-Agent": "funplugin/${get_version()}",
"Content-Type": "text/plain" "Content-Type": "text/plain"
}, },
"data": "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3." "body": "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
}, },
"validate": [ "validate": [
{ {
@@ -105,7 +105,7 @@
"User-Agent": "funplugin/${get_version()}", "User-Agent": "funplugin/${get_version()}",
"Content-Type": "application/x-www-form-urlencoded" "Content-Type": "application/x-www-form-urlencoded"
}, },
"data": "foo1=$foo1&foo2=$foo2&foo3=$foo3" "body": "foo1=$foo1&foo2=$foo2&foo3=$foo3"
}, },
"validate": [ "validate": [
{ {

View File

@@ -54,7 +54,7 @@ teststeps:
headers: headers:
User-Agent: funplugin/${get_version()} User-Agent: funplugin/${get_version()}
Content-Type: "text/plain" Content-Type: "text/plain"
data: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3." body: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
validate: validate:
- check: status_code - check: status_code
assert: equal assert: equal
@@ -74,7 +74,7 @@ teststeps:
headers: headers:
User-Agent: funplugin/${get_version()} User-Agent: funplugin/${get_version()}
Content-Type: "application/x-www-form-urlencoded" Content-Type: "application/x-www-form-urlencoded"
data: "foo1=$foo1&foo2=$foo2&foo3=$foo3" body: "foo1=$foo1&foo2=$foo2&foo3=$foo3"
validate: validate:
- check: status_code - check: status_code
assert: equal assert: equal

View File

@@ -0,0 +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-26T20:08:56.909632+08:00",
"hrp_version": "v4.1.0-beta"
}

View File

@@ -26,7 +26,7 @@ teststeps:
headers: headers:
User-Agent: funplugin/${get_version()} User-Agent: funplugin/${get_version()}
Content-Type: "application/x-www-form-urlencoded" Content-Type: "application/x-www-form-urlencoded"
data: "foo1=$foo1&foo2=$foo3" body: "foo1=$foo1&foo2=$foo3"
validate: validate:
- check: status_code - check: status_code
assert: equal assert: equal

View File

@@ -76,7 +76,7 @@
"User-Agent": "funplugin/${get_version()}", "User-Agent": "funplugin/${get_version()}",
"Content-Type": "text/plain" "Content-Type": "text/plain"
}, },
"data": "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3." "body": "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
}, },
"validate": [ "validate": [
{ {
@@ -105,7 +105,7 @@
"User-Agent": "funplugin/${get_version()}", "User-Agent": "funplugin/${get_version()}",
"Content-Type": "application/x-www-form-urlencoded" "Content-Type": "application/x-www-form-urlencoded"
}, },
"data": "foo1=$foo1&foo2=$foo2&foo3=$foo3" "body": "foo1=$foo1&foo2=$foo2&foo3=$foo3"
}, },
"validate": [ "validate": [
{ {

View File

@@ -54,7 +54,7 @@ teststeps:
headers: headers:
User-Agent: funplugin/${get_version()} User-Agent: funplugin/${get_version()}
Content-Type: "text/plain" Content-Type: "text/plain"
data: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3." body: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
validate: validate:
- check: status_code - check: status_code
assert: equal assert: equal
@@ -74,7 +74,7 @@ teststeps:
headers: headers:
User-Agent: funplugin/${get_version()} User-Agent: funplugin/${get_version()}
Content-Type: "application/x-www-form-urlencoded" Content-Type: "application/x-www-form-urlencoded"
data: "foo1=$foo1&foo2=$foo2&foo3=$foo3" body: "foo1=$foo1&foo2=$foo2&foo3=$foo3"
validate: validate:
- check: status_code - check: status_code
assert: equal assert: equal

View File

@@ -0,0 +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-26T20:08:57.501166+08:00",
"hrp_version": "v4.1.0-beta"
}

View File

@@ -8,16 +8,14 @@
"app_version": "2.8.6" "app_version": "2.8.6"
}, },
"base_url": "https://postman-echo.com", "base_url": "https://postman-echo.com",
"herader": [ "headers": {
{ "Accept": "*/*",
"Accept": "*/*", "Accept-Encoding": "gzip, deflate, br",
"Accept-Encoding": "gzip, deflate, br", "Cache-Control": "no-cache",
"Cache-Control": "no-cache", "Connection": "keep-alive",
"Connection": "keep-alive", "Host": "postman-echo.com",
"Host": "postman-echo.com", "User-Agent": "PostmanRuntime/7.28.4"
"User-Agent": "PostmanRuntime/7.28.4" },
}
],
"verify": false, "verify": false,
"export": [ "export": [
"session_token" "session_token"
@@ -48,16 +46,16 @@
}, },
"validate": [ "validate": [
{ {
"eq": [ "check": "status_code",
"status_code", "assert": "equal",
200 "expect": 200,
] "msg": "check status_code"
}, },
{ {
"eq": [ "check": "body.headers.postman-token",
"body.headers.postman-token", "assert": "equal",
"ea19464c-ddd4-4724-abe9-5e2b254c2723" "expect": "ea19464c-ddd4-4724-abe9-5e2b254c2723",
] "msg": "check body.headers.postman-token"
} }
] ]
}, },

View File

@@ -26,7 +26,7 @@ teststeps:
headers: headers:
User-Agent: funplugin/${get_version()} User-Agent: funplugin/${get_version()}
Content-Type: "application/x-www-form-urlencoded" Content-Type: "application/x-www-form-urlencoded"
data: "foo1=$foo1&foo2=$foo3" body: "foo1=$foo1&foo2=$foo3"
validate: validate:
- check: status_code - check: status_code
assert: equal assert: equal

View File

@@ -76,7 +76,7 @@
"User-Agent": "funplugin/${get_version()}", "User-Agent": "funplugin/${get_version()}",
"Content-Type": "text/plain" "Content-Type": "text/plain"
}, },
"data": "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3." "body": "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
}, },
"validate": [ "validate": [
{ {
@@ -105,7 +105,7 @@
"User-Agent": "funplugin/${get_version()}", "User-Agent": "funplugin/${get_version()}",
"Content-Type": "application/x-www-form-urlencoded" "Content-Type": "application/x-www-form-urlencoded"
}, },
"data": "foo1=$foo1&foo2=$foo2&foo3=$foo3" "body": "foo1=$foo1&foo2=$foo2&foo3=$foo3"
}, },
"validate": [ "validate": [
{ {

View File

@@ -54,7 +54,7 @@ teststeps:
headers: headers:
User-Agent: funplugin/${get_version()} User-Agent: funplugin/${get_version()}
Content-Type: "text/plain" Content-Type: "text/plain"
data: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3." body: "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
validate: validate:
- check: status_code - check: status_code
assert: equal assert: equal
@@ -74,7 +74,7 @@ teststeps:
headers: headers:
User-Agent: funplugin/${get_version()} User-Agent: funplugin/${get_version()}
Content-Type: "application/x-www-form-urlencoded" Content-Type: "application/x-www-form-urlencoded"
data: "foo1=$foo1&foo2=$foo2&foo3=$foo3" body: "foo1=$foo1&foo2=$foo2&foo3=$foo3"
validate: validate:
- check: status_code - check: status_code
assert: equal assert: equal