Files
httprunner/tests/httpbin/upload.yml
debugtalk 2ec2d3c2d8 make variables in testcase template compatible with mapping style:
new mapping style:
"variables": {
    "a": 1,
    "b": 2
}

Also, the former list style is still valid:
"variables": [
    {"a": 1},
    {"b": 2}
]
2018-11-28 12:14:06 +08:00

22 lines
593 B
YAML

- config:
name: test upload file with httpbin
base_url: ${get_httpbin_server()}
- test:
name: upload file
variables:
field_name: "file"
file_path: "LICENSE"
file_type: "text/html"
multipart_encoder: ${multipart_encoder($field_name, $file_path, $file_type)}
request:
url: /post
method: POST
headers:
Content-Type: ${multipart_content_type($multipart_encoder)}
data: $multipart_encoder
validators:
- eq: ["status_code", 200]
- startswith: ["content.files.file", "MIT License"]