mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
fix: call referenced api/testcase with relative path
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"name": "",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"url": "/get",
|
||||
"params": {
|
||||
"foo1": "bar1",
|
||||
"foo2": "bar2"
|
||||
},
|
||||
"headers": {
|
||||
"Postman-Token": "ea19464c-ddd4-4724-abe9-5e2b254c2723"
|
||||
}
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"check": "status_code",
|
||||
"assert": "equals",
|
||||
"expect": 200,
|
||||
"msg": "assert response status code"
|
||||
},
|
||||
{
|
||||
"check": "headers.\"Content-Type\"",
|
||||
"assert": "equals",
|
||||
"expect": "application/json; charset=utf-8",
|
||||
"msg": "assert response header Content-Type"
|
||||
},
|
||||
{
|
||||
"check": "body.url",
|
||||
"assert": "equals",
|
||||
"expect": "https://postman-echo.com/get?foo1=bar1&foo2=bar2",
|
||||
"msg": "assert response body url"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
name: ""
|
||||
request:
|
||||
method: GET
|
||||
url: /get
|
||||
params:
|
||||
foo1: bar1
|
||||
foo2: bar2
|
||||
headers:
|
||||
Postman-Token: ea19464c-ddd4-4724-abe9-5e2b254c2723
|
||||
validate:
|
||||
- check: status_code
|
||||
assert: equals
|
||||
expect: 200
|
||||
msg: assert response status code
|
||||
- check: headers."Content-Type"
|
||||
assert: equals
|
||||
expect: application/json; charset=utf-8
|
||||
msg: assert response header Content-Type
|
||||
- check: body.url
|
||||
assert: equals
|
||||
expect: https://postman-echo.com/get?foo1=bar1&foo2=bar2
|
||||
msg: assert response body url
|
||||
@@ -1,45 +0,0 @@
|
||||
{
|
||||
"name": "",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"url": "/post",
|
||||
"headers": {
|
||||
"Content-Length": "58",
|
||||
"Content-Type": "text/plain",
|
||||
"Postman-Token": "$session_token"
|
||||
},
|
||||
"body": "This is expected to be sent back as part of response body."
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"check": "status_code",
|
||||
"assert": "equals",
|
||||
"expect": 200,
|
||||
"msg": "assert response status code"
|
||||
},
|
||||
{
|
||||
"check": "headers.\"Content-Type\"",
|
||||
"assert": "equals",
|
||||
"expect": "application/json; charset=utf-8",
|
||||
"msg": "assert response header Content-Type"
|
||||
},
|
||||
{
|
||||
"check": "body.data",
|
||||
"assert": "equals",
|
||||
"expect": "This is expected to be sent back as part of response body.",
|
||||
"msg": "assert response body data"
|
||||
},
|
||||
{
|
||||
"check": "body.json",
|
||||
"assert": "equals",
|
||||
"expect": null,
|
||||
"msg": "assert response body json"
|
||||
},
|
||||
{
|
||||
"check": "body.url",
|
||||
"assert": "equals",
|
||||
"expect": "https://postman-echo.com/post",
|
||||
"msg": "assert response body url"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
name: ""
|
||||
request:
|
||||
method: POST
|
||||
url: /post
|
||||
headers:
|
||||
Content-Length: "58"
|
||||
Content-Type: text/plain
|
||||
Postman-Token: $session_token
|
||||
body: This is expected to be sent back as part of response body.
|
||||
validate:
|
||||
- check: status_code
|
||||
assert: equals
|
||||
expect: 200
|
||||
msg: assert response status code
|
||||
- check: headers."Content-Type"
|
||||
assert: equals
|
||||
expect: application/json; charset=utf-8
|
||||
msg: assert response header Content-Type
|
||||
- check: body.data
|
||||
assert: equals
|
||||
expect: This is expected to be sent back as part of response body.
|
||||
msg: assert response body data
|
||||
- check: body.json
|
||||
assert: equals
|
||||
expect: null
|
||||
msg: assert response body json
|
||||
- check: body.url
|
||||
assert: equals
|
||||
expect: https://postman-echo.com/post
|
||||
msg: assert response body url
|
||||
@@ -1,45 +0,0 @@
|
||||
{
|
||||
"name": "",
|
||||
"request": {
|
||||
"method": "PUT",
|
||||
"url": "/put",
|
||||
"headers": {
|
||||
"Content-Length": "58",
|
||||
"Content-Type": "text/plain",
|
||||
"Postman-Token": "5d357b2b-0f10-4ded-bc9a-299ebef7a2d5"
|
||||
},
|
||||
"body": "This is expected to be sent back as part of response body."
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"check": "status_code",
|
||||
"assert": "equals",
|
||||
"expect": 200,
|
||||
"msg": "assert response status code"
|
||||
},
|
||||
{
|
||||
"check": "headers.\"Content-Type\"",
|
||||
"assert": "equals",
|
||||
"expect": "application/json; charset=utf-8",
|
||||
"msg": "assert response header Content-Type"
|
||||
},
|
||||
{
|
||||
"check": "body.data",
|
||||
"assert": "equals",
|
||||
"expect": "This is expected to be sent back as part of response body.",
|
||||
"msg": "assert response body data"
|
||||
},
|
||||
{
|
||||
"check": "body.json",
|
||||
"assert": "equals",
|
||||
"expect": null,
|
||||
"msg": "assert response body json"
|
||||
},
|
||||
{
|
||||
"check": "body.url",
|
||||
"assert": "equals",
|
||||
"expect": "https://postman-echo.com/put",
|
||||
"msg": "assert response body url"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
name: ""
|
||||
request:
|
||||
method: PUT
|
||||
url: /put
|
||||
headers:
|
||||
Content-Length: "58"
|
||||
Content-Type: text/plain
|
||||
Postman-Token: 5d357b2b-0f10-4ded-bc9a-299ebef7a2d5
|
||||
body: This is expected to be sent back as part of response body.
|
||||
validate:
|
||||
- check: status_code
|
||||
assert: equals
|
||||
expect: 200
|
||||
msg: assert response status code
|
||||
- check: headers."Content-Type"
|
||||
assert: equals
|
||||
expect: application/json; charset=utf-8
|
||||
msg: assert response header Content-Type
|
||||
- check: body.data
|
||||
assert: equals
|
||||
expect: This is expected to be sent back as part of response body.
|
||||
msg: assert response body data
|
||||
- check: body.json
|
||||
assert: equals
|
||||
expect: null
|
||||
msg: assert response body json
|
||||
- check: body.url
|
||||
assert: equals
|
||||
expect: https://postman-echo.com/put
|
||||
msg: assert response body url
|
||||
@@ -1,135 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"name": "testcase description",
|
||||
"variables": {},
|
||||
"verify": false
|
||||
},
|
||||
"teststeps": [
|
||||
{
|
||||
"name": "/get",
|
||||
"request": {
|
||||
"url": "https://postman-echo.com/get",
|
||||
"params": {
|
||||
"foo1": "HDnY8",
|
||||
"foo2": "34.5"
|
||||
},
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"Host": "postman-echo.com",
|
||||
"User-Agent": "HttpRunnerPlus",
|
||||
"Accept-Encoding": "gzip"
|
||||
}
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"eq": [
|
||||
"status_code",
|
||||
200
|
||||
]
|
||||
},
|
||||
{
|
||||
"eq": [
|
||||
"headers.Content-Type",
|
||||
"application/json; charset=utf-8"
|
||||
]
|
||||
},
|
||||
{
|
||||
"eq": [
|
||||
"body.url",
|
||||
"https://postman-echo.com/get?foo1=HDnY8&foo2=34.5"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "/post",
|
||||
"request": {
|
||||
"url": "https://postman-echo.com/post",
|
||||
"method": "POST",
|
||||
"cookies": {
|
||||
"sails.sid": "s%3Az_LpglkKxTvJ_eHVUH6V67drKp0AGWW-.PidabaXOnatLRP47hVyqqepl6BdrpEQzRlJQXtbIiwk"
|
||||
},
|
||||
"headers": {
|
||||
"Host": "postman-echo.com",
|
||||
"User-Agent": "Go-http-client/1.1",
|
||||
"Content-Length": "28",
|
||||
"Content-Type": "application/json; charset=UTF-8",
|
||||
"Cookie": "sails.sid=s%3Az_LpglkKxTvJ_eHVUH6V67drKp0AGWW-.PidabaXOnatLRP47hVyqqepl6BdrpEQzRlJQXtbIiwk",
|
||||
"Accept-Encoding": "gzip"
|
||||
},
|
||||
"json": {
|
||||
"foo1": "HDnY8",
|
||||
"foo2": 12.3
|
||||
}
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"eq": [
|
||||
"status_code",
|
||||
200
|
||||
]
|
||||
},
|
||||
{
|
||||
"eq": [
|
||||
"headers.Content-Type",
|
||||
"application/json; charset=utf-8"
|
||||
]
|
||||
},
|
||||
{
|
||||
"eq": [
|
||||
"body.url",
|
||||
"https://postman-echo.com/post"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "/post",
|
||||
"request": {
|
||||
"url": "https://postman-echo.com/post",
|
||||
"method": "POST",
|
||||
"cookies": {
|
||||
"sails.sid": "s%3AS5e7w0zQ0xAsCwh9L8T6R7QLYCO7_gtD.r8%2B2w9IWqEIfuVkrZjnxzm2xADIk34zKAWXRPapr%2FAw"
|
||||
},
|
||||
"headers": {
|
||||
"Host": "postman-echo.com",
|
||||
"User-Agent": "Go-http-client/1.1",
|
||||
"Content-Length": "20",
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
"Cookie": "sails.sid=s%3AS5e7w0zQ0xAsCwh9L8T6R7QLYCO7_gtD.r8%2B2w9IWqEIfuVkrZjnxzm2xADIk34zKAWXRPapr%2FAw",
|
||||
"Accept-Encoding": "gzip"
|
||||
},
|
||||
"data": {
|
||||
"foo1": "HDnY8",
|
||||
"foo2": "12.3"
|
||||
}
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"eq": [
|
||||
"status_code",
|
||||
200
|
||||
]
|
||||
},
|
||||
{
|
||||
"eq": [
|
||||
"headers.Content-Type",
|
||||
"application/json; charset=utf-8"
|
||||
]
|
||||
},
|
||||
{
|
||||
"eq": [
|
||||
"body.data",
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
"eq": [
|
||||
"body.url",
|
||||
"https://postman-echo.com/post"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
config:
|
||||
name: testcase description
|
||||
variables: {}
|
||||
verify: false
|
||||
teststeps:
|
||||
- name: /get
|
||||
request:
|
||||
headers:
|
||||
Accept-Encoding: gzip
|
||||
Host: postman-echo.com
|
||||
User-Agent: HttpRunnerPlus
|
||||
method: GET
|
||||
params:
|
||||
foo1: HDnY8
|
||||
foo2: '34.5'
|
||||
url: https://postman-echo.com/get
|
||||
validate:
|
||||
- eq:
|
||||
- status_code
|
||||
- 200
|
||||
- eq:
|
||||
- headers.Content-Type
|
||||
- application/json; charset=utf-8
|
||||
- eq:
|
||||
- body.url
|
||||
- https://postman-echo.com/get?foo1=HDnY8&foo2=34.5
|
||||
- name: /post
|
||||
request:
|
||||
cookies:
|
||||
sails.sid: s%3Az_LpglkKxTvJ_eHVUH6V67drKp0AGWW-.PidabaXOnatLRP47hVyqqepl6BdrpEQzRlJQXtbIiwk
|
||||
headers:
|
||||
Accept-Encoding: gzip
|
||||
Content-Length: '28'
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Cookie: sails.sid=s%3Az_LpglkKxTvJ_eHVUH6V67drKp0AGWW-.PidabaXOnatLRP47hVyqqepl6BdrpEQzRlJQXtbIiwk
|
||||
Host: postman-echo.com
|
||||
User-Agent: Go-http-client/1.1
|
||||
json:
|
||||
foo1: HDnY8
|
||||
foo2: 12.3
|
||||
method: POST
|
||||
url: https://postman-echo.com/post
|
||||
validate:
|
||||
- eq:
|
||||
- status_code
|
||||
- 200
|
||||
- eq:
|
||||
- headers.Content-Type
|
||||
- application/json; charset=utf-8
|
||||
- eq:
|
||||
- body.url
|
||||
- https://postman-echo.com/post
|
||||
- name: /post
|
||||
request:
|
||||
cookies:
|
||||
sails.sid: s%3AS5e7w0zQ0xAsCwh9L8T6R7QLYCO7_gtD.r8%2B2w9IWqEIfuVkrZjnxzm2xADIk34zKAWXRPapr%2FAw
|
||||
data:
|
||||
foo1: HDnY8
|
||||
foo2: '12.3'
|
||||
headers:
|
||||
Accept-Encoding: gzip
|
||||
Content-Length: '20'
|
||||
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
|
||||
Cookie: sails.sid=s%3AS5e7w0zQ0xAsCwh9L8T6R7QLYCO7_gtD.r8%2B2w9IWqEIfuVkrZjnxzm2xADIk34zKAWXRPapr%2FAw
|
||||
Host: postman-echo.com
|
||||
User-Agent: Go-http-client/1.1
|
||||
method: POST
|
||||
url: https://postman-echo.com/post
|
||||
validate:
|
||||
- eq:
|
||||
- status_code
|
||||
- 200
|
||||
- eq:
|
||||
- headers.Content-Type
|
||||
- application/json; charset=utf-8
|
||||
- eq:
|
||||
- body.data
|
||||
- ''
|
||||
- eq:
|
||||
- body.url
|
||||
- https://postman-echo.com/post
|
||||
@@ -1,78 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"name": "api test demo",
|
||||
"variables": {
|
||||
"user_agent": "iOS/10.3",
|
||||
"device_sn": "TESTCASE_SETUP_XXX",
|
||||
"os_platform": "ios",
|
||||
"app_version": "2.8.6"
|
||||
},
|
||||
"base_url": "https://postman-echo.com",
|
||||
"herader": [
|
||||
{
|
||||
"Accept": "*/*",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Cache-Control": "no-cache",
|
||||
"Connection": "keep-alive",
|
||||
"Host": "postman-echo.com",
|
||||
"User-Agent": "PostmanRuntime/7.28.4"
|
||||
}
|
||||
],
|
||||
"verify": false,
|
||||
"export": [
|
||||
"session_token"
|
||||
]
|
||||
},
|
||||
"teststeps": [
|
||||
{
|
||||
"name": "test api /get",
|
||||
"api": "api/get.json",
|
||||
"variables": {
|
||||
"user_agent": "iOS/10.4",
|
||||
"device_sn": "$device_sn",
|
||||
"os_platform": "ios",
|
||||
"app_version": "2.8.7"
|
||||
},
|
||||
"extract": {
|
||||
"session_token": "body.headers.\"postman-token\""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "test api /post",
|
||||
"api": "api/post.json",
|
||||
"variables": {
|
||||
"user_agent": "iOS/10.5",
|
||||
"device_sn": "$device_sn",
|
||||
"os_platform": "ios",
|
||||
"app_version": "2.8.9"
|
||||
},
|
||||
"validate": [
|
||||
{
|
||||
"eq": [
|
||||
"status_code",
|
||||
200
|
||||
]
|
||||
},
|
||||
{
|
||||
"eq": [
|
||||
"body.headers.postman-token",
|
||||
"ea19464c-ddd4-4724-abe9-5e2b254c2723"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "test api /put",
|
||||
"api": "api/put.json",
|
||||
"variables": {
|
||||
"user_agent": "iOS/10.6",
|
||||
"device_sn": "$device_sn",
|
||||
"os_platform": "ios",
|
||||
"app_version": "2.8.10"
|
||||
},
|
||||
"extract": {
|
||||
"session_token": "body.headers.\"postman-token\""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
config:
|
||||
name: 'api test demo'
|
||||
variables:
|
||||
user_agent: iOS/10.3
|
||||
device_sn: TESTCASE_SETUP_XXX
|
||||
os_platform: ios
|
||||
app_version: 2.8.6
|
||||
base_url: 'https://postman-echo.com'
|
||||
herader:
|
||||
- Accept: '*/*'
|
||||
Accept-Encoding: 'gzip, deflate, br'
|
||||
Cache-Control: no-cache
|
||||
Connection: keep-alive
|
||||
Host: postman-echo.com
|
||||
User-Agent: PostmanRuntime/7.28.4
|
||||
verify: false
|
||||
export:
|
||||
- session_token
|
||||
teststeps:
|
||||
- name: 'test api /get'
|
||||
api: api/get.json
|
||||
variables:
|
||||
user_agent: iOS/10.4
|
||||
device_sn: $device_sn
|
||||
os_platform: ios
|
||||
app_version: 2.8.7
|
||||
extract:
|
||||
session_token: 'body.headers."postman-token"'
|
||||
- name: 'test api /post'
|
||||
api: api/post.json
|
||||
variables:
|
||||
user_agent: iOS/10.5
|
||||
device_sn: $device_sn
|
||||
os_platform: ios
|
||||
app_version: 2.8.9
|
||||
validate:
|
||||
- { eq: [ status_code, 200 ] }
|
||||
- { eq: [ body.headers.postman-token, ea19464c-ddd4-4724-abe9-5e2b254c2723 ] }
|
||||
- name: 'test api /put'
|
||||
api: api/put.json
|
||||
variables:
|
||||
user_agent: iOS/10.6
|
||||
device_sn: $device_sn
|
||||
os_platform: ios
|
||||
app_version: 2.8.10
|
||||
extract:
|
||||
session_token: 'body.headers."postman-token"'
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"name": "reference testcase test",
|
||||
"base_url": "https://postman-echo.com",
|
||||
"variables": {
|
||||
"os_platform": "ios"
|
||||
}
|
||||
},
|
||||
"teststeps": [
|
||||
{
|
||||
"name": "run demo_httprunner.json",
|
||||
"testcase": "demo_httprunner.json",
|
||||
"variables": {
|
||||
"os_platform": "$os_platform"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
config:
|
||||
name: "reference testcase test"
|
||||
base_url: "https://postman-echo.com"
|
||||
variables:
|
||||
os_platform: 'ios'
|
||||
|
||||
teststeps:
|
||||
- name: run demo_httprunner.yaml
|
||||
testcase: demo_httprunner.yaml
|
||||
variables:
|
||||
os_platform: $os_platform
|
||||
@@ -1,40 +0,0 @@
|
||||
config:
|
||||
name: "think time test demo"
|
||||
variables:
|
||||
app_version: v1
|
||||
user_agent: iOS/10.3
|
||||
base_url: "https://postman-echo.com"
|
||||
think_time:
|
||||
strategy: random_percentage
|
||||
setting:
|
||||
min_percentage: 1.0
|
||||
max_percentage: 1.5
|
||||
limit: 4
|
||||
verify: False
|
||||
|
||||
teststeps:
|
||||
- name: get with params
|
||||
request:
|
||||
method: GET
|
||||
url: /get
|
||||
headers:
|
||||
User-Agent: $user_agent,$app_version
|
||||
validate:
|
||||
- check: status_code
|
||||
assert: equals
|
||||
expect: 200
|
||||
msg: check status code
|
||||
- name: think time 1
|
||||
think_time:
|
||||
time: 3
|
||||
- name: post with params
|
||||
request:
|
||||
method: POST
|
||||
url: /post
|
||||
headers:
|
||||
User-Agent: $user_agent,$app_version
|
||||
validate:
|
||||
- check: status_code
|
||||
assert: equals
|
||||
expect: 200
|
||||
msg: check status code
|
||||
Reference in New Issue
Block a user