change: startproject demo

This commit is contained in:
debugtalk
2022-05-19 20:55:51 +08:00
parent 8712419a64
commit 05e2bed02f
18 changed files with 441 additions and 22 deletions

View File

@@ -2,4 +2,4 @@ module plugin
go 1.16
require github.com/httprunner/funplugin v0.4.5 // indirect
require github.com/httprunner/funplugin v0.4.6 // indirect

View File

@@ -58,8 +58,8 @@ github.com/hashicorp/go-plugin v1.4.3 h1:DXmvivbWD5qdiBts9TpBC7BYL1Aia5sxbRgQB+v
github.com/hashicorp/go-plugin v1.4.3/go.mod h1:5fGEH17QVwTTcR0zV7yhDPLLmFX9YSZ38b18Udy6vYQ=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/httprunner/funplugin v0.4.5 h1:2KCj5AZZA22OER6TN5P/PSBYFMiKpgTmCRbDmHB1tos=
github.com/httprunner/funplugin v0.4.5/go.mod h1:vPyeJIfbpGe0epZZtAV0wCn16gLY9+imSw/zfxq0Lcc=
github.com/httprunner/funplugin v0.4.6 h1:wwpjzo3G9a5BCXBkHs845w4ifKaCtVa/yQjREQjQOgo=
github.com/httprunner/funplugin v0.4.6/go.mod h1:vPyeJIfbpGe0epZZtAV0wCn16gLY9+imSw/zfxq0Lcc=
github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=

View File

@@ -13,7 +13,7 @@ teststeps:
variables:
foo1: testcase_ref_bar1
expect_foo1: testcase_ref_bar1
testcase: testcases/demo_requests.yml
testcase: testcases/requests.yml
export:
- foo3
-

View File

@@ -0,0 +1,138 @@
{
"config": {
"name": "request methods testcase with functions",
"variables": {
"foo1": "config_bar1",
"foo2": "config_bar2",
"expect_foo1": "config_bar1",
"expect_foo2": "config_bar2"
},
"base_url": "https://postman-echo.com",
"verify": false,
"export": [
"foo3"
]
},
"teststeps": [
{
"name": "get with params",
"variables": {
"foo1": "bar11",
"foo2": "bar21",
"sum_v": "${sum_two_int(1, 2)}"
},
"request": {
"method": "GET",
"url": "/get",
"params": {
"foo1": "$foo1",
"foo2": "$foo2",
"sum_v": "$sum_v"
},
"headers": {
"User-Agent": "funplugin/${get_version()}"
}
},
"extract": {
"foo3": "body.args.foo2"
},
"validate": [
{
"eq": [
"status_code",
200
]
},
{
"eq": [
"body.args.foo1",
"bar11"
]
},
{
"eq": [
"body.args.sum_v",
"3"
]
},
{
"eq": [
"body.args.foo2",
"bar21"
]
}
]
},
{
"name": "post raw text",
"variables": {
"foo1": "bar12",
"foo3": "bar32"
},
"request": {
"method": "POST",
"url": "/post",
"headers": {
"User-Agent": "funplugin/${get_version()}",
"Content-Type": "text/plain"
},
"data": "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
},
"validate": [
{
"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": {
"foo2": "bar23"
},
"request": {
"method": "POST",
"url": "/post",
"headers": {
"User-Agent": "funplugin/${get_version()}",
"Content-Type": "application/x-www-form-urlencoded"
},
"data": "foo1=$foo1&foo2=$foo2&foo3=$foo3"
},
"validate": [
{
"eq": [
"status_code",
200
]
},
{
"eq": [
"body.form.foo1",
"$expect_foo1"
]
},
{
"eq": [
"body.form.foo2",
"bar23"
]
},
{
"eq": [
"body.form.foo3",
"bar21"
]
}
]
}
]
}

View File

@@ -13,7 +13,7 @@ teststeps:
variables:
foo1: testcase_ref_bar1
expect_foo1: testcase_ref_bar1
testcase: testcases/demo_requests.yml
testcase: testcases/requests.yml
export:
- foo3
-

View File

@@ -0,0 +1,138 @@
{
"config": {
"name": "request methods testcase with functions",
"variables": {
"foo1": "config_bar1",
"foo2": "config_bar2",
"expect_foo1": "config_bar1",
"expect_foo2": "config_bar2"
},
"base_url": "https://postman-echo.com",
"verify": false,
"export": [
"foo3"
]
},
"teststeps": [
{
"name": "get with params",
"variables": {
"foo1": "bar11",
"foo2": "bar21",
"sum_v": "${sum_two_int(1, 2)}"
},
"request": {
"method": "GET",
"url": "/get",
"params": {
"foo1": "$foo1",
"foo2": "$foo2",
"sum_v": "$sum_v"
},
"headers": {
"User-Agent": "funplugin/${get_version()}"
}
},
"extract": {
"foo3": "body.args.foo2"
},
"validate": [
{
"eq": [
"status_code",
200
]
},
{
"eq": [
"body.args.foo1",
"bar11"
]
},
{
"eq": [
"body.args.sum_v",
"3"
]
},
{
"eq": [
"body.args.foo2",
"bar21"
]
}
]
},
{
"name": "post raw text",
"variables": {
"foo1": "bar12",
"foo3": "bar32"
},
"request": {
"method": "POST",
"url": "/post",
"headers": {
"User-Agent": "funplugin/${get_version()}",
"Content-Type": "text/plain"
},
"data": "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
},
"validate": [
{
"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": {
"foo2": "bar23"
},
"request": {
"method": "POST",
"url": "/post",
"headers": {
"User-Agent": "funplugin/${get_version()}",
"Content-Type": "application/x-www-form-urlencoded"
},
"data": "foo1=$foo1&foo2=$foo2&foo3=$foo3"
},
"validate": [
{
"eq": [
"status_code",
200
]
},
{
"eq": [
"body.form.foo1",
"$expect_foo1"
]
},
{
"eq": [
"body.form.foo2",
"bar23"
]
},
{
"eq": [
"body.form.foo3",
"bar21"
]
}
]
}
]
}