Apica YAML is a scripting solution which allows users to monitor scripted web transactions without the use of a GUI-based scripting tool. The intent of the solution is to provide a platform where scripts can be created using specific YAML syntax and to reduce the need for new tool adoption. Users can create Apica YAML scripts within ASM itself:
For users who are familiar with the Apica ZebraTester product, consider Apica YAML to be a GUI-less version of ZebraTester. In fact, Apica YAML scripts are actually compiled into ZebraTester scripts:
The solution allows for a headless method of creating ZebraTester scripts which does not require software to be downloaded to the machine. It also allows for greater automation/code re-usability when creating ZebraTester scripts.
Comparing ZebraTester to ApicaYAML
Feature | ZebraTester | Apica YAML |
---|---|---|
Graphical User Interface |
| |
DevOps API Scripting |
| |
Medium Level Scripting |
| |
Advanced Scripting |
| |
Streaming Scripts |
| |
WebSocket & MQTT Scripts |
| |
Record Scripts |
| |
Add Requests Manually |
|
|
Run the Script on Your Desktop |
|
|
Script Variables, Extractors, Assigners |
|
|
Parameter File Support |
|
|
Inline Code |
|
|
Java Plugins |
|
|
Upload Scripts to Apica LoadTest |
| |
Upload Scripts for Synthetic Monitoring |
| |
Create Scripts Within ASM Portal |
| |
LoadRunner Conversion |
|
Example Syntax
The following syntax provides an example of an ApicaYAML script which will be compiled into a working ZebraTester script. Refer to the syntax guide for more information.
config: # production: target: 'http://ticketmonster.apicasystem.com/ticket-monster' inputs: - name: 'production' default: 'http://ticketmonster.apicasystem.com/ticket-monster' - name: 'integrationTest' default: 'http://ticketmonsterdev.apicasystem.com/ticket-monster' #nextproxy: # httphost: "zebracli.zebracli.zebracli" headers: accept: 'application/json' content-type: 'application/json' #externalfiles: inputfiles: - path: "users.csv" # This file must be located in the /script subdirectory fields: - "username" # 1st column will be used for the variable 'username' - "password" # 2nd column will be used for the variable 'password' order: "sequential" # The data vill be picked line for line in sequential order scope: "loop" # A new line will be read for each test iteration eof: "close" scenarios: # we can define multiple scenarios in 1 yml file if we want to - name: "TM_OrderTickets_v2" flow: - page: name: "Test" thinktime: 0 - get: # url: "{{BASE_URL}}/ticket-monster/" url: "https://www.google.com" assert: - status: codes: - 200 - text: string1: "My Test String"
Example Script:
config: target: "http://ticketmonster.apicasystem.com" scenarios: - name: "TM_OrderTickets" flow: - page: name: "Get Events" thinktime: 0 - get: url: "/ticket-monster/rest/events?_{{epoch_TS}}" assert: - status: codes: - 200 capture: - json: occurrence: 1 random: false target: "$[*].id" as: "event_id" before: - inline: code: | epoch_TS=getUnixTimestampMillis() output: - '{{epoch_TS}}' - page: name: "Get Shows" thinktime: 3 - get: url: "/ticket-monster/rest/shows?event={{event_id}}&_{{epoch_TS}}" assert: - status: codes: - 200 capture: - json: occurrence: 1 random: true target: "$[*].id" as: "show_id" before: - inline: code: | epoch_TS=getUnixTimestampMillis() output: - '{{epoch_TS}}' - get: url: "/ticket-monster/rest/shows/{{show_id}}?_{{epoch_TS}}" assert: - status: codes: - 200 capture: - json: target: "$.performances[*].id" as: "performance_id" - json: target: "$.ticketPrices[*].id " as: "ticketprice_id" before: - inline: code: | epoch_TS=getUnixTimestampMillis() output: - '{{epoch_TS}}' - page: name: "Order tickets" thinktime: 1 - post: url: "/ticket-monster/rest/bookings" json: ticketRequests: - ticketPrice: "10" quantity: "{{quantity}}" email: "{{email}}" performance: "{{performance_id}}" capture: - json: target: "$.id" as: "booking_id" assert: - status: codes: - 200 - 201 before: - inline: code: | quantity=random(1,3) email="user"+(getUserNumber() + 1) + "@acme.com" output: - '{{email}}' - '{{quantity}}' - get: url: "/ticket-monster/rest/bookings/{{booking_id}}?_{{epoch_TS}}" assert: - status: codes: - 200 before: - inline: code: | epoch_TS=getUnixTimestampMillis() output: - '{{epoch_TS}}' - page: name: "Delete tickets" thinktime: 1 - delete: url: "/ticket-monster/rest/bookings/{{booking_id}}" assert: - status: codes: - 200 - 204