@apistudio/apim-cli
Version:
CLI for API Management Products
81 lines • 2.06 kB
YAML
info:
testName: 'ATM Tests'
version: 1
configs:
base_url: url.com
api_key: "abcd"
value: 2
map1:
path1: branches1
path: branches2
boolean: true
array:
- array1
- array4
- array3
X-IBM-Client-Id: X-IBM-Client-Id
orderNumber: "3"
steps:
- type: request
method: get
url: "{{ base_url }}/bank/{{map1.path}}"
headers:
Authorization: "Bearer {{ api_key }}"
var: branches
mode: json
- type: assert-is
expression: branches
value: array
- type: assert-exists
expression: branches.[1]
stoponfail: "{{ boolean }}"
- type: assert-is
expression: branches.[0].type
value: string
stoponfail: true
- type: assert-is
expression: branches.[0].address.city
value: string
stoponfail: true
- type: request
method: post
url: https://sample-api.us-east-a.apiconnect.automation.ibm.com/orders/order/AB1234
var: "payload"
body: <User><ID>1</ID><Name>Alice</Name><Email>alice@example.com</Email></User>
mode: xml
- type: assert-equals
expression: payload_response_statusCode
value: "{{ value }}"
ifexists: false
stoponfail: false
- type: assert-equals
expression: payload_response_header_Content-Type
value: application/json
- type: assert-in
expression: payload_response_header_Content-Type
values:
- application/json
- "{{ array.[2] }}"
- type: assert-contains
expression: payload_response_header_Content-Type
value: app
- type: assert-matches
expression: payload_response_header_Content-Type
value: ^[a-z]+/json
- type: assert-exists
expression: "payload"
stoponfail: false
- type: assert-is
expression: "payload.tracking_reference"
value: "string"
ifexists: "false"
stoponfail: false
- type: assert-exists
expression: payload.shipped_at
stoponfail: false
- type: assert-exists
expression: payload.status
stoponfail: false
- type: assert-exists
expression: payload.created_at
stoponfail: false