mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-10 23:12:41 +08:00
change: replace template with config headers
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"project_name": "demo-with-go-plugin",
|
"project_name": "demo-with-go-plugin",
|
||||||
"project_path": "/Users/xxxxx/go/src/github.com/httprunner/httprunner/examples/demo-with-go-plugin",
|
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-with-go-plugin",
|
||||||
"create_time": "2022-05-28T02:00:18.084185+08:00",
|
"create_time": "2022-05-28T09:46:47.418012+08:00",
|
||||||
"hrp_version": "v4.1.0-beta"
|
"hrp_version": "v4.1.0-beta"
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,9 @@
|
|||||||
"expect_foo1": "config_bar1",
|
"expect_foo1": "config_bar1",
|
||||||
"expect_foo2": "config_bar2"
|
"expect_foo2": "config_bar2"
|
||||||
},
|
},
|
||||||
|
"headers": {
|
||||||
|
"User-Agent": "funplugin/${get_version()}"
|
||||||
|
},
|
||||||
"base_url": "https://postman-echo.com",
|
"base_url": "https://postman-echo.com",
|
||||||
"verify": false,
|
"verify": false,
|
||||||
"export": [
|
"export": [
|
||||||
@@ -28,9 +31,6 @@
|
|||||||
"foo1": "$foo1",
|
"foo1": "$foo1",
|
||||||
"foo2": "$foo2",
|
"foo2": "$foo2",
|
||||||
"sum_v": "$sum_v"
|
"sum_v": "$sum_v"
|
||||||
},
|
|
||||||
"headers": {
|
|
||||||
"User-Agent": "funplugin/${get_version()}"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extract": {
|
"extract": {
|
||||||
@@ -73,7 +73,6 @@
|
|||||||
"method": "POST",
|
"method": "POST",
|
||||||
"url": "/post",
|
"url": "/post",
|
||||||
"headers": {
|
"headers": {
|
||||||
"User-Agent": "funplugin/${get_version()}",
|
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
},
|
},
|
||||||
"body": "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."
|
||||||
@@ -102,7 +101,6 @@
|
|||||||
"method": "POST",
|
"method": "POST",
|
||||||
"url": "/post",
|
"url": "/post",
|
||||||
"headers": {
|
"headers": {
|
||||||
"User-Agent": "funplugin/${get_version()}",
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded"
|
"Content-Type": "application/x-www-form-urlencoded"
|
||||||
},
|
},
|
||||||
"body": "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
"body": "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ config:
|
|||||||
foo2: config_bar2
|
foo2: config_bar2
|
||||||
expect_foo1: config_bar1
|
expect_foo1: config_bar1
|
||||||
expect_foo2: config_bar2
|
expect_foo2: config_bar2
|
||||||
|
headers:
|
||||||
|
User-Agent: funplugin/${get_version()}
|
||||||
verify: False
|
verify: False
|
||||||
export: ["foo3"]
|
export: ["foo3"]
|
||||||
|
|
||||||
@@ -22,8 +24,6 @@ teststeps:
|
|||||||
foo1: $foo1
|
foo1: $foo1
|
||||||
foo2: $foo2
|
foo2: $foo2
|
||||||
sum_v: $sum_v
|
sum_v: $sum_v
|
||||||
headers:
|
|
||||||
User-Agent: funplugin/${get_version()}
|
|
||||||
extract:
|
extract:
|
||||||
foo3: "body.args.foo2"
|
foo3: "body.args.foo2"
|
||||||
validate:
|
validate:
|
||||||
@@ -40,7 +40,6 @@ teststeps:
|
|||||||
method: POST
|
method: POST
|
||||||
url: $base_url/post
|
url: $base_url/post
|
||||||
headers:
|
headers:
|
||||||
User-Agent: funplugin/${get_version()}
|
|
||||||
Content-Type: "text/plain"
|
Content-Type: "text/plain"
|
||||||
body: "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:
|
||||||
@@ -54,7 +53,6 @@ teststeps:
|
|||||||
method: POST
|
method: POST
|
||||||
url: $base_url/post
|
url: $base_url/post
|
||||||
headers:
|
headers:
|
||||||
User-Agent: funplugin/${get_version()}
|
|
||||||
Content-Type: "application/x-www-form-urlencoded"
|
Content-Type: "application/x-www-form-urlencoded"
|
||||||
body: "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
body: "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
||||||
validate:
|
validate:
|
||||||
|
|||||||
75
examples/demo-with-py-plugin/debugtalk_gen.py
Normal file
75
examples/demo-with-py-plugin/debugtalk_gen.py
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
# NOTE: Generated By hrp v4.1.0-beta, DO NOT EDIT!
|
||||||
|
|
||||||
|
import logging
|
||||||
|
import time
|
||||||
|
import funppy
|
||||||
|
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
return funppy.__version__
|
||||||
|
|
||||||
|
|
||||||
|
def sleep(n_secs):
|
||||||
|
time.sleep(n_secs)
|
||||||
|
|
||||||
|
|
||||||
|
def sum(*args):
|
||||||
|
result = 0
|
||||||
|
for arg in args:
|
||||||
|
result += arg
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def sum_ints(*args: List[int]) -> int:
|
||||||
|
result = 0
|
||||||
|
for arg in args:
|
||||||
|
result += arg
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def sum_two_int(a: int, b: int) -> int:
|
||||||
|
return a + b
|
||||||
|
|
||||||
|
|
||||||
|
def sum_two_string(a: str, b: str) -> str:
|
||||||
|
return a + b
|
||||||
|
|
||||||
|
|
||||||
|
def sum_strings(*args: List[str]) -> str:
|
||||||
|
result = ""
|
||||||
|
for arg in args:
|
||||||
|
result += arg
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def concatenate(*args: List[str]) -> str:
|
||||||
|
result = ""
|
||||||
|
for arg in args:
|
||||||
|
result += str(arg)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def setup_hook_example(name):
|
||||||
|
logging.warning("setup_hook_example")
|
||||||
|
return f"setup_hook_example: {name}"
|
||||||
|
|
||||||
|
|
||||||
|
def teardown_hook_example(name):
|
||||||
|
logging.warning("teardown_hook_example")
|
||||||
|
return f"teardown_hook_example: {name}"
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
funppy.register("get_version", get_version)
|
||||||
|
funppy.register("sleep", sleep)
|
||||||
|
funppy.register("sum", sum)
|
||||||
|
funppy.register("sum_ints", sum_ints)
|
||||||
|
funppy.register("sum_two_int", sum_two_int)
|
||||||
|
funppy.register("sum_two_string", sum_two_string)
|
||||||
|
funppy.register("sum_strings", sum_strings)
|
||||||
|
funppy.register("concatenate", concatenate)
|
||||||
|
funppy.register("setup_hook_example", setup_hook_example)
|
||||||
|
funppy.register("teardown_hook_example", teardown_hook_example)
|
||||||
|
funppy.serve()
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"project_name": "demo-with-py-plugin",
|
"project_name": "demo-with-py-plugin",
|
||||||
"project_path": "/Users/xxxxx/go/src/github.com/httprunner/httprunner/examples/demo-with-py-plugin",
|
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-with-py-plugin",
|
||||||
"create_time": "2022-05-28T02:00:28.517914+08:00",
|
"create_time": "2022-05-28T09:46:52.419292+08:00",
|
||||||
"hrp_version": "v4.1.0-beta"
|
"hrp_version": "v4.1.0-beta"
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,9 @@
|
|||||||
"expect_foo1": "config_bar1",
|
"expect_foo1": "config_bar1",
|
||||||
"expect_foo2": "config_bar2"
|
"expect_foo2": "config_bar2"
|
||||||
},
|
},
|
||||||
|
"headers": {
|
||||||
|
"User-Agent": "funplugin/${get_version()}"
|
||||||
|
},
|
||||||
"base_url": "https://postman-echo.com",
|
"base_url": "https://postman-echo.com",
|
||||||
"verify": false,
|
"verify": false,
|
||||||
"export": [
|
"export": [
|
||||||
@@ -28,9 +31,6 @@
|
|||||||
"foo1": "$foo1",
|
"foo1": "$foo1",
|
||||||
"foo2": "$foo2",
|
"foo2": "$foo2",
|
||||||
"sum_v": "$sum_v"
|
"sum_v": "$sum_v"
|
||||||
},
|
|
||||||
"headers": {
|
|
||||||
"User-Agent": "funplugin/${get_version()}"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extract": {
|
"extract": {
|
||||||
@@ -73,7 +73,6 @@
|
|||||||
"method": "POST",
|
"method": "POST",
|
||||||
"url": "/post",
|
"url": "/post",
|
||||||
"headers": {
|
"headers": {
|
||||||
"User-Agent": "funplugin/${get_version()}",
|
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
},
|
},
|
||||||
"body": "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."
|
||||||
@@ -102,7 +101,6 @@
|
|||||||
"method": "POST",
|
"method": "POST",
|
||||||
"url": "/post",
|
"url": "/post",
|
||||||
"headers": {
|
"headers": {
|
||||||
"User-Agent": "funplugin/${get_version()}",
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded"
|
"Content-Type": "application/x-www-form-urlencoded"
|
||||||
},
|
},
|
||||||
"body": "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
"body": "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ config:
|
|||||||
foo2: config_bar2
|
foo2: config_bar2
|
||||||
expect_foo1: config_bar1
|
expect_foo1: config_bar1
|
||||||
expect_foo2: config_bar2
|
expect_foo2: config_bar2
|
||||||
|
headers:
|
||||||
|
User-Agent: funplugin/${get_version()}
|
||||||
verify: False
|
verify: False
|
||||||
export: ["foo3"]
|
export: ["foo3"]
|
||||||
|
|
||||||
@@ -22,8 +24,6 @@ teststeps:
|
|||||||
foo1: $foo1
|
foo1: $foo1
|
||||||
foo2: $foo2
|
foo2: $foo2
|
||||||
sum_v: $sum_v
|
sum_v: $sum_v
|
||||||
headers:
|
|
||||||
User-Agent: funplugin/${get_version()}
|
|
||||||
extract:
|
extract:
|
||||||
foo3: "body.args.foo2"
|
foo3: "body.args.foo2"
|
||||||
validate:
|
validate:
|
||||||
@@ -40,7 +40,6 @@ teststeps:
|
|||||||
method: POST
|
method: POST
|
||||||
url: $base_url/post
|
url: $base_url/post
|
||||||
headers:
|
headers:
|
||||||
User-Agent: funplugin/${get_version()}
|
|
||||||
Content-Type: "text/plain"
|
Content-Type: "text/plain"
|
||||||
body: "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:
|
||||||
@@ -54,7 +53,6 @@ teststeps:
|
|||||||
method: POST
|
method: POST
|
||||||
url: $base_url/post
|
url: $base_url/post
|
||||||
headers:
|
headers:
|
||||||
User-Agent: funplugin/${get_version()}
|
|
||||||
Content-Type: "application/x-www-form-urlencoded"
|
Content-Type: "application/x-www-form-urlencoded"
|
||||||
body: "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
body: "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
||||||
validate:
|
validate:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"project_name": "demo-without-plugin",
|
"project_name": "demo-without-plugin",
|
||||||
"project_path": "/Users/xxxxx/go/src/github.com/httprunner/httprunner/examples/demo-without-plugin",
|
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/demo-without-plugin",
|
||||||
"create_time": "2022-05-28T02:00:29.191678+08:00",
|
"create_time": "2022-05-28T09:46:53.671932+08:00",
|
||||||
"hrp_version": "v4.1.0-beta"
|
"hrp_version": "v4.1.0-beta"
|
||||||
}
|
}
|
||||||
3
examples/empty-demo-without-plugin/.env
Normal file
3
examples/empty-demo-without-plugin/.env
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
base_url=https://postman-echo.com
|
||||||
|
USERNAME=debugtalk
|
||||||
|
PASSWORD=123456
|
||||||
14
examples/empty-demo-without-plugin/.gitignore
vendored
Normal file
14
examples/empty-demo-without-plugin/.gitignore
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
reports/
|
||||||
|
*.so
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
.DS_Store
|
||||||
|
output/
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
.python-version
|
||||||
|
logs/
|
||||||
|
|
||||||
|
# plugin
|
||||||
|
debugtalk.bin
|
||||||
|
debugtalk.so
|
||||||
0
examples/empty-demo-without-plugin/har/.keep
Normal file
0
examples/empty-demo-without-plugin/har/.keep
Normal file
6
examples/empty-demo-without-plugin/proj.json
Normal file
6
examples/empty-demo-without-plugin/proj.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"project_name": "empty-demo-without-plugin",
|
||||||
|
"project_path": "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/examples/empty-demo-without-plugin",
|
||||||
|
"create_time": "2022-05-28T09:46:53.794409+08:00",
|
||||||
|
"hrp_version": "v4.1.0-beta"
|
||||||
|
}
|
||||||
25
examples/empty-demo-without-plugin/testcases/requests.json
Normal file
25
examples/empty-demo-without-plugin/testcases/requests.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"name": "request methods testcase: empty testcase",
|
||||||
|
"variables": null,
|
||||||
|
"verify": false
|
||||||
|
},
|
||||||
|
"teststeps": [
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"variables": null,
|
||||||
|
"request": {
|
||||||
|
"method": "GET",
|
||||||
|
"url": "https://"
|
||||||
|
},
|
||||||
|
"validate": [
|
||||||
|
{
|
||||||
|
"check": "status_code",
|
||||||
|
"assert": "equal",
|
||||||
|
"expect": 200,
|
||||||
|
"msg": "check status_code"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -7,6 +7,9 @@
|
|||||||
"expect_foo1": "config_bar1",
|
"expect_foo1": "config_bar1",
|
||||||
"expect_foo2": "config_bar2"
|
"expect_foo2": "config_bar2"
|
||||||
},
|
},
|
||||||
|
"headers": {
|
||||||
|
"User-Agent": "funplugin/${get_version()}"
|
||||||
|
},
|
||||||
"base_url": "https://postman-echo.com",
|
"base_url": "https://postman-echo.com",
|
||||||
"verify": false,
|
"verify": false,
|
||||||
"export": [
|
"export": [
|
||||||
@@ -28,9 +31,6 @@
|
|||||||
"foo1": "$foo1",
|
"foo1": "$foo1",
|
||||||
"foo2": "$foo2",
|
"foo2": "$foo2",
|
||||||
"sum_v": "$sum_v"
|
"sum_v": "$sum_v"
|
||||||
},
|
|
||||||
"headers": {
|
|
||||||
"User-Agent": "funplugin/${get_version()}"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extract": {
|
"extract": {
|
||||||
@@ -73,7 +73,6 @@
|
|||||||
"method": "POST",
|
"method": "POST",
|
||||||
"url": "/post",
|
"url": "/post",
|
||||||
"headers": {
|
"headers": {
|
||||||
"User-Agent": "funplugin/${get_version()}",
|
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
},
|
},
|
||||||
"body": "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."
|
||||||
@@ -102,7 +101,6 @@
|
|||||||
"method": "POST",
|
"method": "POST",
|
||||||
"url": "/post",
|
"url": "/post",
|
||||||
"headers": {
|
"headers": {
|
||||||
"User-Agent": "funplugin/${get_version()}",
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded"
|
"Content-Type": "application/x-www-form-urlencoded"
|
||||||
},
|
},
|
||||||
"body": "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
"body": "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ config:
|
|||||||
foo2: config_bar2
|
foo2: config_bar2
|
||||||
expect_foo1: config_bar1
|
expect_foo1: config_bar1
|
||||||
expect_foo2: config_bar2
|
expect_foo2: config_bar2
|
||||||
|
headers:
|
||||||
|
User-Agent: funplugin/${get_version()}
|
||||||
verify: False
|
verify: False
|
||||||
export: ["foo3"]
|
export: ["foo3"]
|
||||||
|
|
||||||
@@ -22,8 +24,6 @@ teststeps:
|
|||||||
foo1: $foo1
|
foo1: $foo1
|
||||||
foo2: $foo2
|
foo2: $foo2
|
||||||
sum_v: $sum_v
|
sum_v: $sum_v
|
||||||
headers:
|
|
||||||
User-Agent: funplugin/${get_version()}
|
|
||||||
extract:
|
extract:
|
||||||
foo3: "body.args.foo2"
|
foo3: "body.args.foo2"
|
||||||
validate:
|
validate:
|
||||||
@@ -40,7 +40,6 @@ teststeps:
|
|||||||
method: POST
|
method: POST
|
||||||
url: $base_url/post
|
url: $base_url/post
|
||||||
headers:
|
headers:
|
||||||
User-Agent: funplugin/${get_version()}
|
|
||||||
Content-Type: "text/plain"
|
Content-Type: "text/plain"
|
||||||
body: "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:
|
||||||
@@ -54,7 +53,6 @@ teststeps:
|
|||||||
method: POST
|
method: POST
|
||||||
url: $base_url/post
|
url: $base_url/post
|
||||||
headers:
|
headers:
|
||||||
User-Agent: funplugin/${get_version()}
|
|
||||||
Content-Type: "application/x-www-form-urlencoded"
|
Content-Type: "application/x-www-form-urlencoded"
|
||||||
body: "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
body: "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
||||||
validate:
|
validate:
|
||||||
|
|||||||
Reference in New Issue
Block a user