Apica Scripting IDE

Introduction

Apica Scripting IDE is a script development environment that you install on your local computer, and use through your browser.

Setup

Apica Scripting Tool can be installed from the installer package.

Sign up here to download:

Apica Scripting Tools

Getting Started Tutorial

This is a short getting started guide where you will learn the basic steps of creating a simple API test using Apica Scripting IDE ASI.

Solution

The Solution collects all scripts, settings and related files that are associated with the test script project.

Scripts

In the Scripts view, you can manage the scripts in the solution.

Help

In the Help section you can find documentation and other support resources.

Test Runs

The Test Runs view lists all currently running and completed test runs.

Console

The Console shows a text log for actions performed, test runs and other events.

Introduction

Apica Scripting IDE is a script development environment that you install on your local computer, and use through your browser.

Using Apica Scripting IDE you can record web sessions from a browser or client and use that as the base for a testing script, and/or manually add requests, configurations, variables and loops.

Scripts can be run and tested from your local computer with multiple virtual users for extended tests.

Apica Scripting IDE also lets you extend the scripts with custom Java plugins for maximum flexibility.

The finished script can be uploaded to Apica Synthetic Monitoring for monitoring or to Apica Load Test for performance testing as needed.

main

Setup

Apica Scripting Tool can be installed from the installer package.

Sign up here to download:

Apica Scripting Tools

The installation consists of these main steps:

  • Run the installer
  • Start ASI

Note: You need to run ASI at least once to create the application data directory.

Note: ASI uses many of the same ports as ZebraTester for job control and local execution.

  • If ZebraTester is running, shut it down

Start ASI

ASIcan be started either from the command line or by using the provided startup script file.

Command Line Start

  • Open a command prompt
  • Open the ASI installation directory:
Platform Location
Windows  C:\apica\ApicaScriptingTools\ApicaScriptingIDE\bin
Mac /Users/$USER/Applications/ApicaScriptingTools/ApicaScriptingIDE/bin
Ubuntu /opt/apicascriptingtools/ApicaScriptingIDE/bin
  • Execute the run command:
Windows Mac Ubuntu
 .\jre\bin\java -jar ast.api.jar -webadmin -jobcontroller -execagent -plancontroller ./jre/bin/java -jar ast.api.jar -webadmin -jobcontroller -execagent -plancontroller ./jre/bin/java -jar ast.api.jar -webadmin -jobcontroller -execagent -plancontroller

Script File Start

  • Open the bin directory in ASI installation directory
  • Use the start file:
Windows Mac Ubuntu
 asi-run.bat asi-run.sh asi-run.sh

Access ASI

Solution

The Solution collects all scripts, settings and related files that are associated with the test script project.

Main

Current Solutions

The Current Solutions view shows all previously created solutions available in the solution storage directory.

New Solution

You can create a new solution with the New Solution button.

Variables

With Variables you can add view you can manage dynamic variables and user input fields for use with the test scripts.

Input Files

In the Input Files section you can add files containing lists of data to use for dynamic values during tests.

Solution Settings

The Solution Settings apply to all scripts in the solution.

Close

Closing the solution will take you to the Current Solutions view.

New Solution

You can create a new solution with the New Solution button.

To create a new solution:

Menu

  • Click the New Solution

The New Solution dialog is shown:

Main

  • Enter a solution Name
  • Click Create

A new, empty solution is created:

Blank

You can now create or upload scripts.

Current Solutions

The Current Solutions view shows all previously created solutions available in the solution storage directory.

No available solutions:

Main

You can create new solutions with the new solution button.

At least one solution available:

Main

The solution list shows the solutions.

New Solution

You can create a new solution with the New Solution button.

Open

Solutions can be opened by clicking on them in the list.

Add File

With the Add File button, you can add input files for use by your scripts.

New Script

You can create a new script with the New Script button.

Upload Script

You can upload an existing new script with the Upload Script button in an empty solution.

Open

Solutions can be opened by clicking on them in the list.

Menu

Opened Solution

Opened

Context Menu

Each solution has a context menu that is shown when you point at it:

Main

Clicking the *menu button opens the menu:

Main

Edit Solution

The Solution Settings apply to all scripts in the solution.

You can access the solution settings from the context menu:

Menu

  • Choose Change Settings in the menu

The rename dialog is shown:

Dialog

  • Enter a new Name for the solution

Dialog

  • Click Rename

The solution is renamed.

Solution Settings

The Solution Settings apply to all scripts in the solution.

You can access the solution settings from the Solution menu:

Menu

  • Choose Change Settings in the menu

The Solution Settings can be overriden in individal scripts for individual urls.

Auth

In Basic Authentication the section you can provide a global login for basic authentication.

Proxy

In the Proxy section, you can configure a next proxy server to use when recording.

NTLM

The NTLM section covers the configuration of NTLM authentication.

Auth

In Basic Authentication the section you can provide a global login for basic authentication.

Main

Item Description
Username User login username.
Password User login password.

Proxy

In the Proxy section, you can configure a next proxy server to use when recording.

Main

Item Description Commment
HTTP
Proxy Server Hostname DNS hostname or IP address of the proxy server.
Proxy Server Port HTTPS TCP/IP port number for the proxy server.
HTTPS
Proxy Server Hostname DNS hostname or IP address of the proxy server.
Proxy Server Port HTTPS TCP/IP port number for the proxy server.
Disable HTTP Cache on next proxy Send request to proxy to disable its internal cache.
Proxy Auth Username Basic authentication username. Used for authentication to the proxy server.
Proxy Auth Password Basic authentication password. Used for authentication to the proxy server.
Disable next proxy for hosts/domains List of hosts where next proxy should not be used. Separate entries with comma or semicolon.
Enable Proxy Settings Send request to proxy to disable its internal cache.

NTLM

The NTLM section covers the configuration of NTLM authentication.

Main

Option Description Comment
Protocol Protocol version. 1 / 2.
Domain The Windows (AD) domain for the user.
Username User name for login.
Password Password for login.

Delete Solution

The Solution Settings apply to all scripts in the solution.

You can access the solution settings from the context menu:

Menu

  • Choose Delete in the menu

Solution Menu

The Solution Menu shows

You can create a new solution with the New Solution button.

You can access the menu from the menu button:

Menu

Main

The dialog shows a list of opened scripts for the solution.

Close

Closing the solution will take you to the Current Solutions view.

To close the solution:

Menu

  • Click Close in the top bar

The solution is closed and the Current Solutions view is shown.

Variables

With Variables you can add view you can manage dynamic variables and user input fields for use with the test scripts.

Menu

Main

Variables

Variables can be used to provide dynamic data for various parts of a script.

They can be used to store values extracted from responses, and to assign values to headers in requests.

User Input

User Input fields are variables that whose values are requested each time a load test is started, such as when doing a Test Run of the solution.

Variables In Use

For variables that are in use, the instances are shown below the variable in the list.

Variables

Variables can be used to provide dynamic data for various parts of a script.

They can be used to store values extracted from responses, and to assign values to headers in requests.

Main

Item Description Comment
 Scope  Variable scope.  [G]lobal/[U]ser/[L]oop
 Name  Variable name.  
 Edit  Change variable properties.
 Delete Remove variable.

Name

The variable Name can be used to provide dynamic data for various parts of a script.

Variable Scope

Every variable has a scope, defining where the variable is visible and can be referenced.

Type

Variables can be of many different types. Each type has different restrictions on possible values it can store.

Add Variable

Variables are usually created from the variable dialog.

Name

The variable Name can be used to provide dynamic data for various parts of a script.

Variable Scope

Every variable has a scope, defining where the variable is visible and can be referenced.

Main

Scope Description
Global The variable has the same value for all users.
User Each virtual user has a separate instance of the variable.
Loop There is one instance of the variable for each loop.

Type

Variables can be of many different types. Each type has different restrictions on possible values it can store.

Main

Scope Description
Null Null Value / Not valid / undefined`.
Constant String Fixed value.
User Counter Sequence number for the virtual user
Loop Counter Loop counter for the current virtual user.
Inner Loop Counter Inner loop counter for the current virtual user.
Current Time The time at which the variable is accessed.
Hostname A hostname.
IP An IP address.
Date A date in standard format and in the specified time zone.
Random Number A random number
System Property A Java system property and value.
URL Loop Counter for URL Loops.

Add Variable

Variables are usually created from the variable dialog.

To add a variable:

Main

  • Click the Variable button

The Add Variable dialog is shown:

Dialog

Other Creation Options

Variables can also be created when creating extractors, or when extracting from a file.

If there are no existing variables, you can also create them from the assign dialog.

User Input

User Input fields are variables that whose values are requested each time a load test is started, such as when doing a Test Run of the solution.

User Input Fields are global, and so have the same value for all users.

Main

Item Description Comment
 Variable Name  Identifier to use for the value.  
 Default Value  Standard value to use if nothing is enetered by user.  
 Label  Description to use in field form.  
 Enable Real-Time Change Allow the value to be modified during the test.

Test Run

During a Test Run, the configured are shown at the top of the test run configuration.

Add Input Field

User Input Fields are created from the variable dialog.

Add Input Field

User Input Fields are created from the variable dialog.

To add a user Input Field:

Main

  • Click the Add button

The Add User Input Field dialog is shown:

Dialog

  • Add values as desired
  • Click Add

Variables In Use

For variables that are in use, the instances are shown below the variable in the list.

Main

The list shows if the variable is used in an assigner or extractor, and allows you to modify those configurations, or delete the usage.

Error Handling

When values are extracted to variables, errors may occur, for example if the extracted value is of the wrong type.

The Error Handling dialog allows you to configure how errors should be handled.

You can also define values to use instead of the extracted value is empty.

Main

Item Description
 Name  Variable name  
Abort Stop executing the loop and continue with the load test.
Replace With Value
Constant String Fixed value to use instead of the extracted value.
Variable Use another variable as fallback.
Blank Value
Constant String Replace blank value with specified value.
Variable Use another variable as fallback.

Configure

Error handling can be configured from the variable dialog.

To configure error handling for a variable:

Main

  • Find the variable you want to configure
  • Click the Error Handling button

The Error Handling dialog is shown:

Main

  • Set values as desired
  • Click Edit

Input Files

In the Input Files section you can add files containing lists of data to use for dynamic values during tests.

Menu

Main

Input files are used by scenarios to provide dynamic test data to be used in load tests.

Examples

Some examples of data to include in input files are:

  • Login credentials
  • URLs
  • Form data, such as names and addresses
  • Query string parameters
  • Site categories
  • Search strings
  • ID numbers for site/application content

    … and so on.

File Format

Input Files are existing text files containing formatted date to be used for value extraction into scripts.

Attach

Attaching the file to the solution will make it available for use in scripts.

Assign

Available files can be assigned to individual scripts. This will set the basic properties for the file in ASI .

When assigned, file a scope is selected. Variables with the same scope can then access the file.

Extract

When a file has been assigned to a script, values can be extracted to a variable for use in assigners in scripts.

Introduction

Input Files provide a method for dynamically using values in your script from a list of data.

Input Files can be used to extract variables from a text file, such as a username and a password per simulated user - which can be assigned to a login form.

However the functionality of input files is generic which means that variables for any purposes can be extracted.

Usage

In order to use Input Files in your script, they need to have the correct format, be attached to the solution, and assigned to the script where you want to use it.

You can then extract data from the files at various points in the script.

File Format

Input Files are existing text files containing formatted date to be used for value extraction into scripts.

Attach

Attaching the file to the solution will make it available for use in scripts.

Assign

Available files can be assigned to individual scripts. This will set the basic properties for the file in ASI .

When assigned, file a scope is selected. Variables with the same scope can then access the file.

Extract

When a file has been assigned to a script, values can be extracted to a variable for use in assigners in scripts.

File Format

Input Files are existing text files containing formatted date to be used for value extraction into scripts.

Input files are text files. You can use any encoding that matches the service you are testing.

Posts are arranged with one data post per line/row.

Columns/values on a row can be separated with either any white space character, tab, comma or semicolon.

If the file contains comments, they can be escaped with any character, # hash being the default.

Attach

Attaching the file to the solution will make it available for use in scripts.

Main

Attach

Local files that match the file format can be attached to the solution.

To attach a file to the solution:

Start

  • If needed, expand the Input files box with the Expand button

The dialog shows the currentlly attached files, if any:

Dialog

  • Click the Add File button

Dialog

  • Click Choose File

Browse

  • Browse to the file you want
  • Select the file
  • Click Open

The file is added to the dialog:

Dialog

  • Click Upload

The file is now available in the solution:

Available

You can now assign it to scripts in the solution.

Assign

Available files can be assigned to individual scripts. This will set the basic properties for the file in ASI .

When assigned, file a scope is selected. Variables with the same scope can then access the file.

Main

Item Description Comment
Input File Name of the input file.
Scope Variable scope to use the file in.  Global/User/Loop
 Line Order  Order of access for the text file lines. Sequential / Random 
 Comment Tag  Character used to indicate comments in the input file. Lines starting with comment characters will be ignored.
 Delimiter  Character separating values on a line from each other. Multiple values can be extracted from one line.
Trim Remove whitespace characters from start and end of the extracted value.
EOF Action Behavior when all lines have been read, or end of file is encountered. Reopen / Abort

Buttons

Button Description
Cancel Stop creating extractor.
Test Preview the values.
Assign Add the file to the current script.

Scope

Some particular effects apply for the various scopes:

EOF Action

The End Of File action behavior comes into play when the end of the file is reached / all lines have been read.

Test

The Test Response section at the bottom of the dialog shows a JSON preview of the values in the file.

Assign

Assigning a file to a script prepares the file for use in the script.

Scope

Some particular effects apply for the various scopes:

Scope

Scope Description Comment
 Global  One line is read at the start of the script.
 User  Each virtual user uses the same line for all loops Useful for login/password generation.
 Loop  One line is read for each loop started by each virtual user. The new lines are distributed over all users and loops.

EOF Action

The End Of File action behavior comes into play when the end of the file is reached / all lines have been read.

View

EOF

Note: With random Line Order the lines in the file are first randomized, and then read in that order. Therefore end of file means all lines have been read.

Option Decription Comment
 Reopen  Open the file again and start over.  The Line Order is still followed.
 Abort  The test is the load test will be immediately aborted.  Useful when the number of users are greater than the number of lines and you want to avoid duplicates.

Test

The Test Response section at the bottom of the dialog shows a JSON preview of the values in the file.

View

  • Click Test to verify the file

Test

A JSON preview is shown in the Test Response section

Test

Assign

Assigning a file to a script prepares the file for use in the script.

Main

  • Select a script
  • Find the file you want in the list
  • Click Assign

The dialog is shown

Scope

  • Choose a scope

Order

  • Pick a Line Order

Comment

  • If in use, edit the Comment Tag

delimiter

  • Select the Variable Delimiter used in the file

trim

  • Select if Trim values should apply

EOF

  • Choose the End of File Action

Test

  • Click Test to verify the file
  • Click Assign

The file is assigned to the script:

Main

The file can now be used to extract values to variables.

Extract

When a file has been assigned to a script, values can be extracted to a variable for use in assigners in scripts.

Main

Item Description Comment
Variable Variable to store the value. Choose existing variable from dropdown, or create a new variable. Must be a new variable, or a variable not already in use.
Column Number Select a particular value column in the file.

Buttons

Button Description
Cancel Stop creating extractor.
Test Preview the values.
Add Add the extractor to the script.

Preview

The Extracted section at the bottom of the dialog shows information about the extracted values.

New Variable

You can create a new variable to use for the assigned file.

To create a new variable:

Start

  • Click Add

The dialog is shown:

Start

  • Enter a name for the variable

Initial

  • Select the initial value type

Value

  • Enter the initial value default value
  • Click Add Variable

You can now use the variable in the Select Variable dropdown menu.

Extract

Assigned files are shown in the list, and can be used to extract values.

To extract values from the file:

Start

  • Find the file you want in the list
  • Click Extract

The dialog is shown:

Dialog

  • Choose an existing variable (or create a new variable
  • Select the column number containing the value you want
  • Click Test

A preview is shown in the Extracted field:

Test

  • Click Add

The file is connected to the variable.

Extracted

The variable can now be used in an assigners.

Plugins

In the Java Plugins view, you can manage the custom Java plugins .

Menu

Main

Column Description Comment
Plugin Name The Name of the plugin.
Last Modified The Date/Time when the plugin was last modified/imported.
Last Compiled The Date/Time when the plugin was last compiled.

Buttons

Column Description
Import Plugin Open the plugin import dialog.
Go Back Return to the main view.

Introduction

Java Plugins provide additional capabilities to scripts, and functionality to ASI.

Import

You can Import Java files to ASI in order to make additional functionality available to ASI and scripts.

Compile

Imported plugins must be compiled to become available to all solutions.

Introduction

Java Plugins provide additional capabilities to scripts, and functionality to ASI.

A Java Plugin, as the name implies, consist of Java code code that provides ASI features and script capabilities.

Plugins consist of a .java source file and a runnable compiled .class file.

When ASI is installed, a number of plugins created by Apica are automatically installed. These provide the basic ASI functionality.

The Apica plugins are installed in the ApicaPlugins directory inside the ASI install directory.

Plugins stored in this directory are available to all solutions.

Additional Custom plugins can be [imported]() into ASI to provide extended functionality for ASI or specific capabilites in scripts.

Custom plugins are installed in the CustomPlugins directory inside the ASI install directory.

Plugins stored in this directory are available to all solutions.

Usage

In order to use a Java Plugin in your script, you need to make sure that it is imported, compiled, and assigned to the script where you want to use it.

Import

You can Import Java files to ASI in order to make additional functionality available to ASI and scripts.

Import

You can Import Java files to ASI in order to make additional functionality available to ASI and scripts.

Import

You can Import Java files to ASI in order to make additional functionality available to ASI and scripts.

Main

Imported plugins are available to all solutions.

To import a plugin:

Start

  • Click Import Plugin

Start

  • Click Choose File

Start

  • Browse to the .java file you want to import
  • Click Open

The imported plugin is displayed in the list:

Start

The imported file is stored as a .java file in the CustomPlugins directory inside the ASI install directory:

Start

You can now compile the file to get access to the functionality in ASI.

Existing Plugins

Note: If there already exists an Apica plugin with the same name as the Custom plugin, you will be asked to rename the Custom plugin.

Note: If a Custom plugin with the same name already exists, you will be asked for confirmation before it is overwritten.

Compile

Imported plugins must be compiled to become available to all solutions.

Main

To compile a plugin:

Start

  • Find the plugin you want to compile.
  • Click Compile

The comilation process is displayed in the console.

console

  • Close the console

After the compilation process, the plugin is displayed as compiled in the list:

Start

The imported file is stored as a .class file in the CustomPlugins directory inside the ASI install directory:

Start

The functionality provided by the plugin is now availabe for use in scripts. If the plugin provides functionality for ASI itself, you need to restart the application.

Scripts

In the Scripts view, you can manage the scripts in the solution.

A solution without scripts:

Main

Buttons to create or upload scripts are available in the main view.

A solution with scripts:

Main

The scripts are listed in the top bar.

New Script

You can create a new script with the New Script button.

Upload Script

You can upload an existing new script with the Upload Script button in an empty solution.

Action Buttons

At the top right of the Scripts view, you can find a number of buttons to perform various actions.

When a script is loaded, you can access the dropdown menu in the top bar to perform basic tasks for the script.

Page Break

A page break is a separator in a script that discerns different pages (which typically consist of multiple URL calls) from each other.

Page Breaks divide the script into logical sections.

URL

URL requests are the main part of scripts.

Loops

Loops allow you to group a number of page breaks, and perform them repeatedly until one of a set of conditions is met.

New Script

You can create a new script with the New Script button.

Top bar:

Button

  • Click the New Script button

The side dialog is shown:

Named

  • Enter a script Name
  • Click Add

A blank script is created

Blank

You can now add one or more page breaks.

Upload Script

You can upload an existing new script with the Upload Script button in an empty solution.

A solution withpout scripts:

Main

Buttons to create or upload scripts are available in the main view.

  • Click the Upload Script button

The side dialog is shown:

Choose

  • Click Choose File

The file browser opens

Browse

  • Find the script you want to upload
  • Click Open

Chosen

  • Click Upload

The script is added to the solution.

Uploaded

Action Buttons

At the top right of the Scripts view, you can find a number of buttons to perform various actions.

Menu

Menu

Icon Name Description
  Save Save the script.
  Test Run Do a test run of the solution with virtual users.
  Run All Run the entire script.
  Script Tasks Revert, rename, copy or delete the script.
  Add New… Add pages, urls or loops.

Save

Save is used to store any script changes made to file.

Test Run

The Test Run button lets you do a trial run of the complete solution with a defined number of virtual users.

Run All

The Run All button lets you run all pages of the currently selected script in sequence as a single virtual user.

Tasks

Revert

The Revert option undos all changes made since the script was last saved.

Rename

With Rename, you can store the script under a different name.

Delete

Delete removes the script and all its settings.

Add New

Page Break

A page break is a separator in a script that discerns different pages (which typically consist of multiple URL calls) from each other.

Page Breaks divide the script into logical sections.

URL

URL requests are the main part of scripts.

Loops

Loops allow you to group a number of page breaks, and perform them repeatedly until one of a set of conditions is met.

Revert

The Revert option undos all changes made since the script was last saved.

Menu

Rename

With Rename, you can store the script under a different name.

Menu

Save

Save is used to store any script changes made to file.

Menu

Change Indicator

if the script has changed since you last saved it, an indicator is shown:

Changed

Hovering over the button will display the tooltip:

Tooltip

Delete

Delete removes the script and all its settings.

Menu

Dropdown Menu

When a script is loaded, you can access the dropdown menu in the top bar to perform basic tasks for the script.

Button

Menu

Revert

The Revert option undoes all changes made since the script was last saved.

Rename

With Rename, you can store the script under a different name.

Create Copy

With Create Copy, you can store a copy of the script under a different name.

Save

Save is used to store any script changes made to file.

Save As

With Save As, you can store the script under a different name.

Close

Using Close, you can remove the script from the solution.

Delete

Delete removes the script and all its settings.

Revert

The Revert option undoes all changes made since the script was last saved.

Menu

Rename

With Rename, you can store the script under a different name.

Menu

Dialog

Create Copy

With Create Copy, you can store a copy of the script under a different name.

Menu

Dialog

Close

Using Close, you can remove the script from the solution.

Menu

Delete

Delete removes the script and all its settings.

Menu

Dialog

Page Break

A page break is a separator in a script that discerns different pages (which typically consist of multiple URL calls) from each other.

Page Breaks divide the script into logical sections.

Main

Main

Icon Action Description
Expand Show requests in the page.
Edit Change page break properties.
Delete Remove page break and all contents.
Extractor Number of variable extractors.
Assigner Number of variable assigners.

Add Page

Page breaks can be added with the Add New menu button.

Details

The contents of the page break can be viewed with the Expand button.

Edit Page Break

The page break properties can be changed with the edit button available for each page break

Delete Page Break

Removing a page break also removes all associated URL requests.

Run Page

If the page contains requests, you test it with Run Page button.

Action Buttons

Action buttons allow you to perform a number of tasks for a page.

Main

Icon Action Description
Expand Show details about the requests in the page.
Edit Change page break properties.
Clone Create a copy of the request.
Delete Remove page break and all contents.
Run Run the page.

Add Page

Page breaks can be added with the Add New menu button.

Main

Main

Item Description
Name Identifier for the page break.
User Think Time Think Time.
Randomization Percentage to apply for of the think time.

Menu

  • Click the Add Page Break button

Menu

  • Select Page Break

    The side dialog is shown:

Named

  • Enter a Page Break Name
  • Set the User Think Time
  • Enter a Randomization value
  • Click Add

A blank Page is created

Added

You can now add urls and other configuration.

Details

The contents of the page break can be viewed with the Expand button.

Button

Start

The detailed view shows the information about the URL requests in execution order.

Main

Icon Item Description
# Execution order index.  
Method HTTP access method for the url.
Status Last returned response code for the reqest.
URL URL to access.
Validate  Open the URL validation editor.
Run  Test run the URL.

Edit Page Break

The page break properties can be changed with the edit button available for each page break

Button

Main

Copy Page

Page breaks can be copied with the Copy Page Break button.

Button

Main

Item Description
Select Location Where to insert the page break.
Insert Before Place the copy before the selected location.
Insert After Place the copy after the selected location.

Start

  • Click the Copy Page Break button

The side dialog is shown:

Blank

  • Select a location (Page Break)

Selected

  • Click the appropriate insert button

An exact copy of the Page and all URls is created in the designated location.

You can now work with urls and other configuration.

Delete Page Break

Removing a page break also removes all associated URL requests.

Button

  • Click Delete

A dialog is shown:

Start

  • Click Delete

Run Page

If the page contains requests, you test it with Run Page button.

Button

Start

  • Click Run Page

The results of the run is shown in the console.

Start

URL

URL requests are the main part of scripts.

Main

Icon Item Description
# Execution order index.  
Method HTTP access method for the url.
Status Last returned response code for the reqest.
URL URL to access.

Action Buttons

Action buttons allow you to perform a number of actions.

Action Buttons

Action buttons allow you to perform a number of actions.

When you point at the Request, additional action buttons are displayed.

Main

Icon Action Description
Expand Show requests in the page.
Edit Change page break properties.
Clone Create a copy of the request.
Delete Remove page break and all contents.
Validate Modify the URL validation.
Run Run request.

Details

Detailed information about the URL request can be viewed with the Expand button.

Start

The detailed view shows the information about the URL requests in execution order, and additional action buttons.

Main

Request

The request column shows information collected about the URL request.

Response

In the response column you will find information about the latest response.

Assigners

With Assigners you can use variables to put values into request parameters.

Extractors

Extractors are used to collect values from responses and store them in variables for reuse in subsequent script steps.

Request

The request column shows information collected about the URL request.

Main

The Request section shows basic details about the URL request, and the Headers section shows the headers sent.

Response

In the response column you will find information about the latest response.

Main

The Response section shows basic details about the received response.

The Headers section displays a table with all received respose headers.

Content

The response content can be viewed in detail and extracted to variables as needed.

Content

The response content can be viewed in detail and extracted to variables as needed.

Main

To view the response content:

Main

  • Click Inspect content

The content is displayed at the bottom of the window in a clickable structure:

Main

Extractors

Extractors are used to collect values from responses and store them in variables for reuse in subsequent script steps.

Content

Using a Content Extractor, parts of the response content can be extracted and stored in a variable.

Headers

A Request header extractor lets you extract values from the response headers and store them in a variable.

Content

Using a Content Extractor, parts of the response content can be extracted and stored in a variable.

Values are selected by providing a left and right boundary to indicate points of extraction. The boundaries is not included in the extracted value.

For multiple matches, you can specify a specific occurrence, use a random one, or use another variable to pick the occurrence.

The variable to use for storage can either be an existing variable, or be created in the dialog.

Main

Item Description Comment
Variable Variable to store the value. Choose Existing or Create New.
Left Boundary Start of string to extract.
Right Boundary End of string to extract.
View All Show all matching occurrences in the preview section.
Extract
Random Occurrence Pick an occurence at random.
Occurrence Select a specific occurrence.
Number Specifies a specific occurrence.
Variable Use the occurrence number from a variable.

Buttons

Button Description
Cancel Stop creating extractor.
Test Preview the extracted value.
Add Create the extractor.

Preview

The Extracted section at the bottom of the dialog shows a preview of the value that will be extracted.

View All

The View All button can be used to display a numbered list of all matching occurrences, to help you pick the number to use in the occurrence Number field.

Add Extractor

Content extractors can be added from the details view.

To create an extractor:

Start

  • Click Extract To Variable

The Content Extractor dialog is shown.

Main

  • Enter values as desired
  • Click Add

Headers

A Request header extractor lets you extract values from the response headers and store them in a variable.

Values can either be extracted form the whole header field, or only part of it, based on text tokens.

The variable to use for storage can either be an existing variable, or be created in the dialog.

Main

Item Description Comment
Variable Variable to store the value. Choose Existing or Create New.
Field Header field to extract value from. (Preselected).
Extract
Whole Value Extract the complete contents of the field.
Token Extract parts of the field, by token.
Delimiters Characters to separates tokens from each other.
Number Used to select a particular token.
Trim Whitespace Remove blank characters from start and end of the extracted value.

Buttons

Button Description
Cancel Stop creating extractor.
Test Preview the extracted value.
Add Create the extractor.

Preview

The Extracted section at the bottom of the dialog shows a preview of contents that will be extracted.

Add Extractor

Header extractors can be added from the details view.

To create an extractor:

  • Hover the mouse cursor over the field

If an extractor can be created, the field will be displayed in green with (extract value) next to it.

Start

  • Click the header field

The Header Extractor dialog is shown.

Main

  • Enter values as desired
  • Click Add

Assigners

With Assigners you can use variables to put values into request parameters.

Main

A Request header assigner allows you to insert the variable value into the headers.

Header

A Request header assigner allows you to insert the variable value into the headers.

You can choose to either replace the whole header field, or only part of it, based on a search pattern and occurrence.

Note: You can add custom headers before creating the assigner.

Main

Item Description
Variable Variable containing the value.
Field Header field to insert value in.
Replace
Whole Value Replace everything in the Field.
Pattern Replace part of the string with the value.
Replace Text String to replace.
Occurrence Used for patterns that repeat to pick a particular instance.

Buttons

Button Description
Cancel Stop creating assigner.
Test Preview the value to be replaced.
Add Create the assigner.

Preview

At the bottom of the dialog is a field showing a preview of field contents that will be replaced.

Add Assigner

Header assigners can be added from the details view.

To create an assigner:

  • Hover the mouse cursor over the field

If an extractor can be created, the field will be displayed in green with (assign value) next to it.

Start

  • Click Assign Value

The Header Assigner dialog is shown.

Main

  • Enter values as desired
  • Click Add

Edit

Basic properties of the URL can be edited by clicking the Edit action button.

  • Hover the mouse over the URL to show the actions

Menu

  • Click Edit

The Edit URL dialog is shown:

Main

Item Description
 URL Information
 Method Http Method to use.
 URL URL to access.
 Page Break Name of Page Break to add the URL in.
 Options Show additional options.
 Test Send a test request with the selected method and URL.
  Edit Save the settings.

Options

In the Additional Options you can configure advanced URL aspects, such as authentication and request headers.

Test

Individual requests can be tested with the Test button.

Options

In the Additional Options you can configure advanced URL aspects, such as authentication and request headers.

You can show the options by clicking the link button.

Start

The options are shown below the basic settings:

Main

Overview

Redirect

The Follow Redirect count setting limits the total number of HTTP redirects to follow when the URL is added.

Auth

The Basic Authentication setting lets you add basic authentication login parameters to the request.

Headers

In the Custom Headers options you can remove or add headers to the URL request.

Redirect

The Follow Redirect count setting limits the total number of HTTP redirects to follow when the URL is added.

Note: This option can only be changed when the URL is first added.

Main

The value 0 means no limit.

Auth

The Basic Authentication setting lets you add basic authentication login parameters to the request.

Main

Item Description
Username Basic authentication username.
Password Basic authentication password.

Headers

In the Custom Headers options you can remove or add headers to the URL request.

Main

The contents of the section is automatically populated with default headers generated by the original request.

Headers

Item Description
Header table
Name Identifier for the header.
Value Header value.
Remove Delete header.
Add section
Header Name Custom header name.
Header Value Custom header value.
Add Add the custom header.

Test

Individual requests can be tested with the Test button.

Start

  • Click Run

The results of the run is shown at the bottom of the dialog.

Start

Delete URL

Removing a URL also removes all associated assigners and extractors.

  • Hover the mouse over the URL to show the actions

Start

  • Click Delete

A dialog is shown:

Start

  • Click Delete

Validation

In the URL Validation options, you can define parameters to compare the returned responses against expected values.

Main

There are a number of different options for validating responses, and in most of them you can use variables as values to compare against.

If the response matches the expected value, the URL validation passes. If not, the request is considered to have failed.

Overview

Constants/Variables

All validation options can either be configured with a constant string, or with a value from variable.

Status

Status Code validation uses http response codes as expected values.

Type

With the Content Type validation, you can make sure that the response is of the apropriate MIME type.

Text

In the Header Text validation, you can provide a text that must be included in the response headers.

Content

The Content validation allows you to verify that the response content either is of a particular size, or contains a particular combination of text strings.

Error

The Error Handling settings define how to handle failed requests.

Constants/Variables

All validation options can either be configured with a constant string, or with a value from variable.

You can switch between constant and variable mode with the corner button.

Main

Overview

Constant

Constant strings are a fixed value that does not change over time.

Variable

With variables, you can use a pre-defined value, or extract the value from a previous response.

Constant

Constant strings are a fixed value that does not change over time.

Constant

Variable

With variables, you can use a pre-defined value, or extract the value from a previous response.

Variable

Note: The variables need to be created or extracted before you can use them in validation.

Status

Status Code validation uses http response codes as expected values.

Main

The expected value is comma separated list of http status codes.

If the response does not contain one of the codes in the list, the validation fails.

Note: Status Code validation is enabled by default with the expected value 200.

Type

With the Content Type validation, you can make sure that the response is of the apropriate MIME type.

Main

If the Content-Type` header indicating the media type of the response, does not match the field, the validation fails.

Text

In the Header Text validation, you can provide a text that must be included in the response headers.

Main

If the response headers do not contain the provided text, the validation fails.

Content

The Content validation allows you to verify that the response content either is of a particular size, or contains a particular combination of text strings.

Size

Using the Size option, you can validate the response by size.

Content String

The Content option, you can provide combinations of text strings that need to exist in the response content.

Size

Using the Size option, you can validate the response by size.

Main

Item Description
Size In Bytes Total size of response.
Deviation Percentage Allowed size variation (percentage).

If the size of the response does not match the defined size (plus or minus the deviation percentage), the validation fails.

Content String

The Content option, you can provide combinations of text strings that need to exist in the response content.

Main

The strings are combined according to the Operation setting.

Operation Description
AND All strings must be present in the response.
OR At least one string needs to present in the response.

The validation fails if the strings are not present in the response content.

Error

The Error Handling settings define how to handle failed requests.

Main

Item Description Comment
Abort Stop executing the loop when an error occurs.
Continue Keep executing the loop when an error occurs.

NOTE: When using continue a failed response may not return correct values, which may be affect variable extraction.

Run Request

Individual requests can be tested with the Run button.

Start

  • Click Run

The results of the run is shown in the console.

Start

Loops

Loops allow you to group a number of page breaks, and perform them repeatedly until one of a set of conditions is met.

Menu

Main

Introduction

With Loops you can have a set of pages repeat either a number of times, and/or add conditions for when to exit the loop.

Add Loop

Loops can be added with the Add Loop button.

Edit Loop

The Loop properties can be changed with the edit button available for each Loop

Conditions

Conditions

Delete Loop

A Loop can be removed with the delete button.

Removing a Loop does not remove the associated page breaks.

Introduction

With Loops you can have a set of pages repeat either a number of times, and/or add conditions for when to exit the loop.

A loop aims to simulate a web surfing session corresponding to some defined user behavior in an application.

It consists of a user accessing a number of pages, calling multiple URLs in a single session.

Add Loop

Loops can be added with the Add Loop button.

Edit Loop

The Loop properties can be changed with the edit button available for each Loop

Conditions

Conditions

Delete Loop

A Loop can be removed with the delete button.

Removing a Loop does not remove the associated page breaks.

Add Loop

Loops can be added with the Add Loop button.

Button

Overview

Options

The Loop options govern the loop behavior and error handling.

Name

The Loop Name is used in displays and scripts to identify the loop.

Scope

The Loop Scope defines where the loop starts and ends.

Time Per VU

The Time Per VU setting, you can define how many times to repeat the loop.

Error Handling

In the Error Handling section, you can decide how errors occuring during the loop should be handled.

Done

When you are happy with the settings, you can create the loop.

Name

The Loop Name is used in displays and scripts to identify the loop.

Main

  • Click in the Loop Name box

Named

  • Enter a descriptive Name for display purposes

You can now define the scope for the loop.

Scope

The Loop Scope defines where the loop starts and ends.

The available pages can be selected from dropdown lists in the boxes:

End

  • Select a start page

Start

End

  • Select an end page

End

The loop will now begin from the start page and stop after the end page.

Options

The Loop options govern the loop behavior and error handling.

Dialog

Item Description
Name Identifier for the Loop.
Start First page in the loop.
End Last page in the loop.
Iterations Number of times to repeat the loop.
Time per VU For each Virtual User.
Error Handling Behavior for the loop when an error occurs.

Iterations

In the Iterations setting, you can define how many times to repeat the loop.

The iteration count can either be a fixed value, or be dynamically assigned from a previously defined variable.

Value

To set a fixed value:

Value

  • Enter a number in the text box.

Variable

  • Click Use Variable

The available variables can be selected from a dropdown list in the boxes:

Variable

  • Select a variable from the list

Variable

Time Per VU

The Time Per VU setting, you can define how many times to repeat the loop.

The time setting can either be a fixed value, or be dynamically assigned from a previously defined variable.

Value

To set a fixed value:

Value

  • Enter a number in the text box.

Variable

  • Click Use Variable

The available variables can be selected from a dropdown list in the boxes:

Variable

  • Select a variable from the list

Variable

Error Handling

In the Error Handling section, you can decide how errors occuring during the loop should be handled.

Error handling

Option Description Comment
Abort Loop Consider it a fatal error, stop the current iteration, and fail the test.
Continue Loop Consider it a non-fatal error and continue execution of the loop. Avoid if other parts or variables in the test depend on values from the loop.

Done

When you are happy with the settings, you can create the loop.

Done

  • Click Add

The loop is shown in the script view:

Done

Conditions

Conditions

Menu

Dialog

The Loop Conditions dialog lets you configure conditions for the loop.

Condition Types

In the Add Condition section you can choose between several different types of conditions; Response Code, Response Content, Variable Value, and Completed Execution.

Done

When you are happy with the settings, you can add the condition to the loop.

Dialog

The Loop Conditions dialog lets you configure conditions for the loop.

The Conditions dialog consists of a list of created conditions, and the Add Condition section where you can create conditions.

List

The list contains the currently configured conditions for the loop.

List

Clicking the Expand icon will show details about the condition:

List

Add Condition

In the Add Condition section you can choose the condition type to add, and configure it.

Add

Actions

The Actions section defines what behavior should be performed when the condition gets a match.

Actions

Which actions are displayed depends on they type of condition.

Condition Types

In the Add Condition section you can choose between several different types of conditions; Response Code, Response Content, Variable Value, and Completed Execution.

Code

The Response Code condition matches the received repsonse with a defined HTTP Status Code.

Content

With the Response Content condition type, you can define one or more content items to match the wthin the response content.

Variable

The Variable Value condition type uses the value of a variable to find a condition match.

Completed

The Completed Execution you can configure a specific error message to send if all iterations are completed.

Match Variables

For certain types of conditions, you can use a variable (or user input) to provide the match for the condition.

Code

The Response Code condition matches the received repsonse with a defined HTTP Status Code.

Main

Option Description
IF
Type Condition selector.
URL URL to extract the response code from.
EQUALS
Code HTTP Status Code to match.

Actions

With Response Content conditions you have the option of selecting how to handle execution and whether you want to wait for variable extraction.

Actions

Option Description
Execution
Abort Stop executing the loop when an error occurs.
Continue Keep executing the loop when an error occurs.
Variables
Wait for variables Make sure that variables have been extracted before stopping.

NOTE: When using continue a failed response may not return correct values, which may be affect variable extraction.

Content

With the Response Content condition type, you can define one or more content items to match the wthin the response content.

Done

Option Description
IF
Type Condition selector.
URL URL to match the response content with.
Contains
Text box Value or variable to use for matching.

Additional Values

You can add several items to match against.

Multiple

Option Description
OR Condition selector.
AND URL to match the response content with.
Text box Value or variable to use for matching.

Actions

With Response Content conditions you have the option of selecting how to handle execution and whether you want to wait for variable extraction.

Actions

Option Description
Execution
Abort Stop executing the loop when an error occurs.
Continue Keep executing the loop when an error occurs.
Variables
Wait for variables Make sure that variables have been extracted before stopping.

NOTE: When using continue a failed response may not return correct values, which may be affect variable extraction.

Variable

The Variable Value condition type uses the value of a variable to find a condition match.

Done

Actions

For the Variable condition, you can configure how and when to stop the execution.

Actions

Option Description
Execution
Abort Stop executing the loop when an error occurs.
Continue Keep executing the loop when an error occurs.
Location
Before Stop execution before this URL.
After Ececute this URL and then stop.
Variables
Wait for variables Make sure that variables have been extracted before stopping.

NOTE: When using continue a failed response may not return correct values, which may be affect variable extraction.

Completed

The Completed Execution you can configure a specific error message to send if all iterations are completed.

Done

  • Enter the text in the Error Message box

Actions

The Completed Execution condition only has one possible action, which is automatically performed and will result in an error message.

Action

When the condition matches, the Break Outer Loop of Simulated User and report the defined error message.

Match Variables

For certain types of conditions, you can use a variable (or user input) to provide the match for the condition.

Done

If there is no suitable variable to select in the dropdown, you can create variables on the fly.

To create variables:

Done

  • Click the Add button

The variable editor is shown:

Done

  • Add Name
  • Select the variable type from the initial value menu
  • Pick a Scope
  • Click Add Variable

Variables

Variables can be used to provide dynamic data for various parts of a script.

They can be used to store values extracted from responses, and to assign values to headers in requests.

User Input

User Input fields are variables that whose values are requested each time a load test is started, such as when doing a Test Run of the solution.

Done

When you are happy with the settings, you can add the condition to the loop.

Done

  • Click Add Condition

The condition is shown in the list:

Done

You can now create more conditions.

Edit Loop

The Loop properties can be changed with the edit button available for each Loop

Start

  • Click Edit

A dialog is shown:

Start

The changes are saved.

Delete Loop

A Loop can be removed with the delete button.

Removing a Loop does not remove the associated page breaks.

Start

  • Click Delete

A dialog is shown:

Start

  • Click Delete

The loop is removed. The contained pages are not affected.

Test Run

The Test Run button lets you do a trial run of the complete solution with a defined number of virtual users.

Menu

Main

Any configured User Input fields are available at the top of the dialog.

Item Description Comment
User Count Number of concurrent virtual users.
Duration Test duration in seconds. 0 = unlimited
Request Timeout Request timeout per URL call in seconds
Maximum Loops Max. number of loops (repetitions of web surfing session) per user. 0 = unlimited
Startup Delay Startup delay between creating concurrent virtual users (ms).
SSL Version Use fixed SSL protocol version. all, v3, TLS, TLS11 or TLS12
Additional Options Command-line options to add to the exectution command.

Console

The result of the runs is displayed in the Console:

Run

Test Runs

Finished test runs are accessible from the Test Runs menu:

Run

Run All

The Run All button lets you run all pages of the currently selected script in sequence as a single virtual user.

Menu

View

The result of the run is displayed in the Console:

Run

Settings

In the Settings section you can view and change configure ASI properties and behavior.

Menu

Main

NTLM

The NTLM section covers NTLM settings for the proxy recorder.

Global

The Global section governs general settings for the ASI application, interface and project management.

Main

Item Description
ASI Installation Folder Install location for ASI
ASI License Key File Location of ASI license file.
ASI API Server Port Access port for the API.
ASI User Timezone Time Zone Short Code
ASI UI Server Port Access port for the UI.
Exec Agent Data File Location of the agent data file.
Path to Java Compiler Location of Java compiler.
Path to Java Executable Location of Java executable.
Solutions storage Location of files for saved solutions.

Proxy

In the Proxy section you can configure the HTTPS settings for the proxy recorder.

Main

Item Description
Enable ECC Allow encryption with ECC.
SSL Session Cache enabled  Enable the SSL session cache.
 Allow Legacy Renegotiation  Allow renegotiation without Renegotiation Indication Extension.
 Enhanced Compatibility Mode  Enable workarounds for less strict SSL libraries.
SNI critical Abort SSL connection when the server doesn't support SNI.
 SSL Version  Version of SSL protocol used by the proxy recorder.
HTTPS Response Timeout Time to wait for a HTTPS URL call before aborting the request.
SSL Session Cache Timeout Duration of the SSL session cache.

NTLM

The NTLM section covers NTLM settings for the proxy recorder.

Main

Option Description Comment
Protocol Protocol version. 1 / 2.
Domain The Windows domain for the user.
Username User name for login.
Password Password for login.

ASM

The ASM section covers settings related to Synthetic Monitoring.

Main

Option Description Comment
ASM Auth Token Access token for the Synthetic Monitoring API.
ASM API Base URL Endpoint to access the Synthetic Monitoring API.

Help

In the Help section you can find documentation and other support resources.

Menu

Main

Test Runs

The Test Runs view lists all currently running and completed test runs.

Menu

Main

Details

Test Run details provide information about the run, and allows you to download a complete log of the test run in text format.

Details

Agents

In the Agents view you can see a list of execution agents for the solution.

Menu

Main

Overview

{{indexmenu_n>120}| }|

Details

The agent details contains detailed information about the execution agent.

{{indexmenu_n>120}| }|

Details

The agent details contains detailed information about the execution agent.

Main

 networkProperties  { "agentHost": "127.0.0.1", "agentPort": 7993, "connectedThroughProxyServer": false }
 currentStatistics  { "cumulatedTraffic": -1, "totalUsedTrafficPercent": 0, "runningVirtualUsers": 0 }
 agentLevelLimits  { "maxConcurrentVirtualUsers": 50, "isUnlimitedNumberOfUsers": false }
 proxySnifferVersions  { "controllerVersion": "V5.5-F", "agentVersion": "V5.5-F", "controllerAndAgentCompatible": true }
 executingAgentInfrastructure  { "os": "Mac OS X 10.13.3 / Java 1.7.0_76 / ZebraTester V5.5-F", "loadFactor": 19.23077, "timeSettings": { "execAgentCurrentTime": 1521392754044, "execAgentTimeZone": "ECT", "remoteTimeOffset": 1 } }| | javaProperties | { "javaMemoryProperties": { "freeJavaMemory": 158, "totalJavaMemory": 246, "maxJavaMemory": 911 }| , "configuredXmx": 1024, "allowLoadtestJobsToOverrideJavaMamorySize": "disabled" }
 ipSettings  { "ipListSuccess": true, "ipV4List": [ "en0" ], "ipV6List": [ "awdl0", "en0", "lo0", "utun0", "utun1" ] }
 encryptionProperties  { "isEncryptJobsOrigin": false, "isAgentRunningInEncryptedMode": false }

Recording

Introduction

In order to quickly create scripts, you can use Apica Scripting IDE as a recorder for your web sessions.

Setup

The recommended setup for recording is to run Apica Scripting IDE in one browser (Chrome) and perform tasks to be recorded in a second browser (Firefox). The second browser needs to have a CA root certificate installed and be set to use ASI as a proxy.

Process

The recording process is rather straightforward; you manage the recording in one browser, and perform actions in the other.

Introduction

In order to quickly create scripts, you can use Apica Scripting IDE as a recorder for your web sessions.

You can use Apica Scripting IDE to record web surfing sessions. The recorded requests can then be further modified and used to create a script.

Setup

The recommended setup for recording is to run Apica Scripting IDE in one browser (Chrome) and perform tasks to be recorded in a second browser (Firefox). The second browser needs to have a CA root certificate installed and be set to use ASI as a proxy.

Process

The recording process is rather straightforward; you manage the recording in one browser, and perform actions in the other.

Setup

The recommended setup for recording is to run Apica Scripting IDE in one browser (Chrome) and perform tasks to be recorded in a second browser (Firefox). The second browser needs to have a CA root certificate installed and be set to use ASI as a proxy.

Proxy

In order for recording to work, Apica Scripting IDE must be set as proxy on the port 7990 on the browser you will use to perform tasks to record.

CA Root Certificate

In order for recording to work, you need to generate your own CA root certificate, and import it into the browser you will use to perform tasks to record.

MacOS X

  • Open a Finder window
  • Navigate to the Users directory
  • Open the directory for your username
  • Press Command+Shift+Period to view hidden folders
  • Find the directory .apica/Applications/ApicaScriptingTool

mac

  • Run the CreateOwnCARootCertificate.command file

A terminal window is opened.

  • Press Enter to start the generation
  • Answer the questions for the certificate

After you have answered the questions, the root.cer certificate is created in the directory.

ssl

  • Import the root.cer into MacOS X
  • Import your root.cer into Firefox
  • Enable the checkbox Trust this CA to identify websites

Windows

Install OpenSSL:

NOTE: Download the 64-bit version "Win64 OpenSSL v1.0.2o" (or newer).

  • Run the installer (we recommend you use the default installation)
  • Navigate to the Users directory
  • Open the directory for your username
  • Find the directory AppData/Roaming/ApicaScriptingTool

win

  • Run the CreateOwnCARootCertificate.bat as Administrator

A terminal window is opened.

  • Press Enter to start the generation
  • Answer the questions for the certificate

After you have answered the questions, the root.cer certificate is created:

ssl

  • Import the root.cer into Windows
  • Choose as certificate store Trusted Root Certificate Authorities
  • Import your root.cer into Firefox
  • Enable the checkbox Trust this CA to identify websites

Non-Default Install

NOTE: By default, OpenSSL is installed to C:\OpenSSL-Win64. If you installed it to a different place, you need to modify the CreateOwnCARootCertificate.bat file so that the OPENSSL_INSTALL_DIR value points to where you installed OpenSSL.

Proxy

In order for recording to work, Apica Scripting IDE must be set as proxy on the port 7990 on the browser you will use to perform tasks to record.

To enable the proxy in firefox, open the Connection Settings.

Set the browser to use localhost on port 7997.

Main

Process

The recording process is rather straightforward; you manage the recording in one browser, and perform actions in the other.

NOTE: You need to have created and installed the Root Certificate before recording.

Start a recording:

  • Start Apica Scripting IDE
  • Open the interface in Chrome
  • Open Firefox and go to the service you want to record
  • Start recording

Record tasks in the application:

  • Add a Page Break to separate the events into logical chunks
  • Perform the actions you want to record
  • Repeat adding pages and performing tasks as needed
  • Stop the recording

Clean up recording:

  • Filter out Data
  • Filter out Hosts

Store the recording:

  • Save the recorded data as a new script to an existing or new solution

The recorded events are now available for modification and you can work with the script further.

Delete Requests

Recorded requests can be removed from the recording.

The requests are listed in the order they were recorded:

Main

To delete requests:

Selected

  • Select the requests you want to delete by checking the corresponding box

buttoin

  • Click the Delete button

Delete All

You can select all requests by checking the main toggle checkbox at the top of the list:

all

Filter

Requests can be removed from the recording by using filters.

The filtering dialogs are available in the recording view:

Main

Data

Filtering by data will remove requests based on their traffic type.

Hosts

Filtering by hosts will remove requests based on their traffic type.

Data

Filtering by data will remove requests based on their traffic type.

Main

Filtered

Hosts

Filtering by hosts will remove requests based on their traffic type.

Main

Filtered

Console

The Console shows a text log for actions performed, test runs and other events.

Menu

Main

Close

To close the console frame, click the close button at the top of the console log:

Close

Apica Scripting YAML

Introduction

Apica Scripting YAML (ASY) is a command-line tool and YAML-based, Domain-Specific, language for the Apica Scripting Tool (AST) and ZebraTester.

Installation

How to install Scripting YAML.

Run

Running ./stampede.sh will package the script into a .zip file.

Syntax

Script elements for use in Scripting YAML files.

Sample Code

Examples of Scripting YAML files.

Introduction

Apica Scripting YAML (ASY) is a command-line tool and YAML-based, Domain-Specific, language for the Apica Scripting Tool (AST) and ZebraTester.

Use

With ASY, users who don’t need/want a graphical user interface can instead use definition files to define the test scripts.

These scripts can also be extended with custom Java plugins and inline scripting. Test packages are then generated with the command line interface.

Generated scripts can then be used both for monitoring in Apica Synthetic Monitoring (ASM and performance testing in Apica Load Test without modification.

Process

  • Create scripts using a YAML definition file where the definition file consists of a number of scripts that perform various actions.
  • As needed, include data from data files to use in the scripts.
  • Java plugins can provide additional functionality.
  • A command line utility will interpret the YAML definition file to create and package script(s) for use in either Synthetic Monitoring or Load Test.

## Process

Process

Scope

Various items in a script apply to different scopes in the test.

The scope defines the context for the item, and where a variable or value applies:

Scope Context Variable/Value
Global Whole test  Same value is used for everywhere in the flow.
User One user  One value is used for each Virtual User.
Loop One iteration A new value is selected for each iteration.

Setup

Setup of ASY is generally very straightforward.

In Windows and MacOs X, Apica Scripting YAML can be installed from the installer package.

For Linux, there is a gzipped .tar file, that can be extracted with the tar -xzf command, for example:

tar -xzf ast-0.x.x-x-x64.tar.gz

Prerequisites

Apica Scripting YAML has a few prerequsites.

Configuration

The configuration file should be correct on installation, but you can verify the contents to make sure that everything is set up as needed.

Prerequisites

Apica Scripting YAML has a few prerequsites.

  • Apica Scripting Tools -or-
  • ZebraTester 5.4-F or later
  • Windows, Mac or Linux
    • Linux: Java installed on the system. This is used to compile the script. Therefore, it must be the same version as the one used where you intend to use the script. (For now, this is 1.7).
  • The necessary key needed to run ZT for a debug-run is included in the install package.

Note: Scripting YAML does not support all functionality of ZebraTester.

Configuration

The configuration file should be correct on installation, but you can verify the contents to make sure that everything is set up as needed.

The ASY root directory is located at

Windows: C:\apica\ApicaScriptingTools\ApicaScriptingYAML

MacOS X: /Users/$USER/Applications/ApicaScriptingTools/ApicaScriptingYAML.

ASY requires a few directories to run. These should be correctly configured in the configuration file:

Directory Definitions
Lib

lib - files needed for ASY

Conf

conf - configuration.cfg configuration file

Yaml

yaml - definition files

Scripts

scripts - created scripts

Note: The scripts directory is created when you first run the ASY command line tool.

Configurations

Directory Description
zebrarootdir Location of "embedded" or ZebraTester installation directory
defdir Location of the YAML definition files
scriptdir Location of created scripts
execoptions ZebraTester Exec options in debug mode.
javacpath ASI Location of Javac for compilation of scripts.

Exec Options

The following switches/parameters can be added in the execoptions setting:

Option Description Default
 u Number of concurrent virtual users.  1
 d Test duration in seconds. 0 = unlimited. 600
 t Request timeout per URL call in seconds.  60
 sdelay Startup delay between creating concurrent users in milliseconds.  200
 maxloops Maximum number of loops per user. 0 = unlimited.  1
 sampling Interval-based response sampling interval in seconds.  1
 percurl Additional event based sampling of response times of URL calls. Percentage.  100
 percpage Additional event based sampling of response times for web pages. Percentage. 100
 maxerrmem Maximum memory in megabytes which can be used to store error snapshots. -1 = unlimited.  20
 ecc Enable legacy encryption algorithms such as ECC.  
 dc Debug content and loops.
 nores No result/Dry run: Don't create a compiled script file.

Debug Content And Loops

Writes the log data of all executed loops, including information about dynamically-extracted session parameters and input files, transmitted and received HTTP content data.

Note: Only writes out data which has been transmitted or received in ASCII format, such as HTML form parameters and HTML, XML, SOAP, or CSS style sheet data - but no binary data, such as images.

Run

Running ./stampede.sh will package the script into a .zip file.

Run Scripting YAML

Scripting YAML is run from the terminal using standard CLI commands.

Run Scripting YAML

Scripting YAML is run from the terminal using standard CLI commands.

  1. Open the terminal
  2. Navigate to the Scripting YAML root directory
  3. Run the command ./stampede<version>.sh
  4. Follow the instructions in the console

Run

The output is a .zip file, including the created .prxdat file, the Java file, the class file and the depending files.

Note: The generated .zip file will be named after the scenario name in the file, NOT the name of the .yml file.

Options

Besides simply running ./stampede.sh to translate and package the script, you can provide further parameters to the tool (e.g. ./stampede.sh [options...]

  • --file (or -f) <filename.yml> - In case you want to manually specify which YAML defintion you want to run you can append this option to the script.
  • --debug (or –d) - In case you want to initiate a test run of the scenarios in the YAML file. The test will run with one VU and one iteration. The ZebraTester Debug loops option will be enabled. The output will also be saved in a <scriptname>.log file.
  • --charset (or –c) <charset> - To choose which character encoding to use in the request body. Supported: Any set supported by Java, e.g. ISO 8859-1 or windows-1252. If omitted, UTF-8 will be used. * –environment (or –e`) <environment variable> - To choose which environment to test (see below). If omitted, the default target will be used.

Syntax

Script elements for use in Scripting YAML files.

Introduction

Scripting YAML scripts are divided into two sections: config and scenarios.

Editing

Scripting YAML files can be edited by any text editor, or in any YAML aware IDE.

Config

The Config section in the Scripting YAML file contains global parameters that are applied to all scripts in the Scenarios section.

Scenarios

The Scenarios section in the Scripting YAML file contains all the actual scripts to run during the test.

Introduction

Scripting YAML scripts are divided into two sections: config and scenarios.

Config

The Config section in the Scripting YAML file contains global parameters that are applied to all scripts in the Scenarios section.

Scenarios

The Scenarios section in the Scripting YAML file contains all the actual scripts to run during the test.

Editing

Scripting YAML files can be edited by any text editor, or in any YAML aware IDE.

Special Characters

A number of rules apply to the formatting in the Scripting YAML file.

Indentation

It is important to get the indentations correct in the Scripting YAML file. Incorrect indentation will break the script.

Note: Do not edit Scripting YAML files in a office writer such as MS word or LibreOffice. The file needs to in be clean YAML format with correct indendations.

Indentation

It is important to get the indentations correct in the Scripting YAML file. Incorrect indentation will break the script.

Sample

Each indentations level must be made with two space characters.

Config

Each Config block should follow this indentation schema.

Scenario

Each Scenario block must follow this indentation schema.

Sample

Each indentations level must be made with two space characters.

snippet.yaml
config:
  target:

  defaults:
    headers:
      name: value

  environments:
    name:
      target:

  inputs:
    - name:
      default:

  files:
    - path:
      fields:
      - 'name'
    order:
    scope:

  variables:

    - date:
      format:
      offset:
        hour:
        second:
        day:
        year:

    - timestamp:

    - random:
      scope:
      from:
      to:
      leadingzeros:

    - java_property:
      key:
      value:

Scenario:
- name: script1
  flow:
    - get
      url1
      attribute2
        arg1
        arg2
      attribute3

Config

Each Config block should follow this indentation schema.

config:

Start of Configuration. No indent.

  target:

Mandatory base URL for the script. 1 indent (2 spaces).

Defaults

  defaults:

Start of Default settings for requests. 1 indent (2 spaces).

    headers:

Start of specific default setting. 2 indents (4 spaces).

      name: value

Default setting parameters. 3 indents (6 spaces).

Environments

  environments:

Start of Environment settings. 1 indent (2 spaces).

    name:

Environment identifier. 2 indents (4 spaces).

      target:

Environment address. 3 indents (6 spaces).

Inputs

  inputs:

Start of Inputs settings. 1 indent (2 spaces).

    - name:

Mandatory input identifier. 2 indents (4 spaces) and dash.

      default:

Optional default value. 2 indents (4 spaces).

Files

  files:

Start of Files settings. 1 indent (2 spaces).

    - path:

Mandatory path to the file. 2 indents (4 spaces) and dash followed by quoted path.

      fields:

Start of list of variables to map to. 3 indents (6 spaces) and dash.

      - 'name'

Start of list of variables to map to. 4 indents (8 spaces) and dash, followed by quoted name.

    order:

Read Order (sequential / random). 3 indents (6 spaces) followed by quoted order.

    scope:

File Scope (global / user / loop). 3 indents (6 spaces) followed by quoted scope.

Variables

  variables:

Start of Variables section. 1 indent (2 spaces).

    - date:

Start of Date variable. 2 indent (4 spaces) dash and quoted name.

      format:
      offset:
        hour:
        second:
        day:
        year:
    - timestamp:

Start of Timestamp variable. 2 indent (4 spaces) dash and quoted name.

    - random:

Start of Random variable. 2 indent (4 spaces) dash and quoted name.

      scope:

Variable Scope (global / user / loop). 3 indents (6 spaces) followed by quoted scope.

      from:

Start value. 3 indents (6 spaces) followed by quoted scope.

      to:

End value. 3 indents (6 spaces) followed by quoted scope.

      leadingzeros:

Optional number of zeros to prefix the value. 3 indents (6 spaces) followed by quoted scope.

    - java_property:

Start of Java Property variable. 2 indent (4 spaces) dash and quoted name.

      key:

Java property key. 3 indent (6 spaces) and quoted name.

      value:

Java property value. 3 indent (6 spaces) and quoted value.

Scenario Indentation

Each scenario block should follow this indentation schema:

Scenario:

Start of Scenario : No indentation.

- name:

Name of Script: Dash and no indentation followed by script name .

    flow:

Start of flow section: 1 indent (2 spaces).

    - get

Start of Step: 2 indents (4 spaces) and dash followed by the command.

      url1

Accessed URL: 3 indents (6 spaces). The URL counts as the first first attribute.

      attribute2

Step attribute: Same indentation as URL, 3 indents (6 spaces).

        arg1

Argument: 4 indents (8 spaces).

        arg2

Argument: 4 indents (8 spaces).

      attribute3

Step attribute: Same indentation as URL, 3 indents (6 spaces).

Scenario

Each Scenario block must follow this indentation schema.

Scenario Indentation

Scenario:

Start of Scenario : No indentation.

- name:

Name of Script: Dash and no indentation followed by script name .

    flow:

Start of flow section: 1 indent (2 spaces).

    - get

Start of Step: 2 indents (4 spaces) and dash followed by the command.

      url1

Accessed URL: 3 indents (6 spaces). The URL counts as the first first attribute.

      attribute2

Step attribute: Same indentation as URL, 3 indents (6 spaces).

        arg1

Argument: 4 indents (8 spaces).

        arg2

Argument: 4 indents (8 spaces).

      attribute3

Step attribute: Same indentation as URL, 3 indents (6 spaces).

Special Characters

A number of rules apply to the formatting in the Scripting YAML file.

Dash (-) or other special characters cannot be used in the Name of the scenario, since this will be used for the Java class name, where they are not allowed.

These characters have special meaning.

Character Name Description Comment
Single quotes. Used as escape character before and after text. Only single quotes are supported.
\n New line.
# Comment.
- Dash. denotes this is an object in an array, i.e. a list of items of the same type. The array ends when the indentation block ends.

Config

The Config section in the Scripting YAML file contains global parameters that are applied to all scripts in the Scenarios section.

Target

Target is a mandatory setting providinng the main URL of the service.

Defaults

The Defaults settings contain that will be applied to all requests in the definition file.

Files

In the Files section you can provide data files.

Inputs

With inputs you can define variables that are set manually when the test is run.

Authentication

The authentication settings provides a specific authentication method for all requests.

Target

Target is a mandatory setting providinng the main URL of the service.

The Target will become the base URL for all requests in the scenario section unless you provide a full url for the request.

If the protocol (HTTP or HTTPS) is omitted, the request will default to HTTP. Target may also include part of the URI path following the hostname.

snippet.yaml
...
  target: 'http://ticketmonsterdev.apicasystem.com/tickets'
...

Environments & Proxies

The Environments setting allows the script to support multiple target environments.

You can provide the multiple environments, that you want to test against, in this section.

Scripting YAML will create a user input field called environments where you can set these environments.

You can provide as many environments as you want.

Load Test

In Apica Load Test, user Input Fields are treated as static variables.

Environments provided by Scripting YAML will be available in Scenario Options

Single environment:

snippet.yaml
...
  environments:
    production:
      target: 'http://ticketmonster.apicasystem.com/ticket-monster'
...

Multiple environments:

snippet.yaml
...
  environments:
    production:
      target: 'http://ticketmonster.apicasystem.com/ticket-monster'
    integration-test:
      target: 'http://ticketmonster-dev.apicasystem.com/ticket-monster'
...

The nextproxy setting allows the script to support outbound proxy architectures.

Where a proxy is part of the network against which you will be load testing, provide the proxy settings in this section.

snippet.yaml
...
  nextproxy:
    isactive: "true"
    httphost: "127.0.0.1"
    httpport: "7997"
    httpcachedisabled: "false"
    httpshost: ""
    httpsport: ""
    authusername: ""
    authpassword: ""
    nonextproxy: ""
...

Notes: All fields are required.

All fields except ‘isactive’ and ‘httpcachedisabled’ can be left empty.

  • Next Proxy Is active: if true, apply next proxy configuration when running load test
  • Next Proxy HTTP Host: (DNS) host name or TCP/IP address of the next proxy server (for unencrypted connections).
  • Next Proxy HTTP Port: HTTP TCP/IP port-number of the next proxy server (for unencrypted connections).
  • Next Proxy HTTP Cache disabled: if true, advise the next proxy server to disable its internal cache.
  • Next Proxy HTTPS Host: (DNS) host name or TCP/IP address of the next proxy server (for encrypted connections).
  • Next Proxy HTTPS Port: HTTPS (secure) TCP/IP port-number of the next proxy server (for encrypted connections).
  • Next Proxy Auth Username: username, used for proxy authorization on the next proxy server (Basic Authorization).
  • Next Proxy Auth Password: password, used for proxy authorization on the next proxy server (Basic Authorization).
  • No Next Proxy for Host/Domain: allows to set a list of hosts and/or domain names for which the proxy settings must not be applied. The entries in the list must be separated by commas or semicolons.

Defaults

The Defaults settings contain that will be applied to all requests in the definition file.

Currently, only headers are supported.

snippet.yaml
...
  defaults:
    headers:
      accept: 'application/json'
      content-type: 'application/json'
...

Files

In the Files section you can provide data files.

You can either provide one file or an array of files to use.

Parameters

For each file, the following parameters are available:

Parameter Mandatory? Description Comment
path Mandatory Path to the data file. Relative to the Scripting YAML file.
fields Mandatory List of variables to map the values in the file to. The variables will be mapped according the order in the list.
order Optional How the rows in the test file will be picked during the test. Can be sequential or random (default).
scope Optional The scope for the variables. Can be global, user or loop (default).

Source Files

The source files must

  • be either .txt or .csv
  • be in the same directory as the Scripting YAML file.
  • have values separated by , comma.

Load Test

In Apica Load Test, variables created by Scripting YAML will be available in Scenario Options

snippet.yaml
...
 files:
  - path: 'users.csv' # This file must be located in the same directory
   fields:
    - 'username'  # 1st column will be used for the variable 'username'
    - 'password'  # 2nd column will be used for the variable 'password'
   order: 'sequence' # The data vill be picked line for line in sequential order
   scope: 'loop' # A new line will be read for each test iteration
...

Variables

Variables are variables used at runtime during the test.

Whose values are initialized when starting the test. You can either provide one field or an array of fields to use.

By default, the value of a variable will be reinitialized with every iteration of the test.

Form

The basic format for a variable is - key: value, where:

  • key is the variable type
  • value is the variable name

Variable Types

The following variable types are available:

Timestamp

The timestamp is a a basic timestamp based on when the test is started.

Date

The date is a string based on when the test is started, optionally modified by an offset.

Random

A random variable is a random number within a specified range.

Java Property

The java_property variable created a java system property.

Additional parameters define the Java Property key and value.

snippet.yaml
  variables:
    - timestamp: 'myTimestamp'

    - date: 'myDate'
      format: 'yyyy-MM-dd'    # Date format
      offset: 		# Offset from the current date and time
        hour: 3        # 3 hours into the future
        second: -3000  # 3000 seconds  in the past
        day: -10       # Ten days  in the past
        year: 3        # Three years into the futurein the future

    - random: 'myRandomNumber'
      scope: 'loop' # The variable will be reinitialized every time a new loop starts.
      from: 1       # This is the lowest possible value.
      to: 1337      # This is the highest value.
      leadingzeros: true    # All random numbers will be of equal length.

    - java_property: 'myJavaProperty'
      key: 'myCustomKey'    # Name of the java system property
      value: 'value'        # Initial value of the system property

Timestamp

The timestamp is a a basic timestamp based on when the test is started.

snippet.yaml
...
  variables:
    - timestamp: 'myTimestamp'
...

Date

The date is a string based on when the test is started, optionally modified by an offset.

The offset value is added to the start time for the test.

Past dates can be created by adding a negative offset value.

The offset key can be one, any or all of the following:

  • second  hour  dayyear

The offsets can be combined in any way, and there is no sanity check.

The format can be of any SimpleDateFormat Java Documentation.

snippet.yaml
...
  variables:
    - date: 'myDate'
      format: 'yyyy-MM-dd'    # Date format
      offset: 		# (Optional) Offset from the current date and time
        hour: 3        # 3 hours into the future
        second: -3000  # 3000 seconds in the past
        day: -10       # Ten days in the past
        year: 3        # Three years into the future
...

Random

A random variable is a random number within a specified range.

  • from: The lowest possible value.
  • to : The highes possible value.

Random variables can have a specified scope as needed. The value will be reinitialized for each iteration of that scope.

The value can be formatted by parameters:

  • leadingzeros: If set to true, any number shorter than the longest number will be padded with lesding zeros to provide values of uniform length.
snippet.yaml
...
  variables:
    - random: 'myRandomNumber'
      scope: 'loop'
      from: 1
      to: 1337
      leadingzeros: true
...

Java Property

The java_property variable created a java system property.

Additional parameters define the Java Property key and value.

snippet.yaml
...
  variables:
    - java_property: 'myJavaProperty'
      key: 'myCustomKey'
      value: 'value'
...

Example

A code example using all variables.

snippet.yaml
...
  variables:
    - timestamp: 'myTimestamp' # Time and date at start of test

    - date: 'myDate'
      format: 'yyyy-MM-dd'    # Date format
      offset: 		# Offset from the current date and time
        hour: 3        # 3 hours into the future
        second: -3000  # 3000 seconds  in the past
        day: -10       # Ten days  in the past
        year: 3        # Three years inthe future

    - random: 'myRandomNumber'
      scope: 'loop' # The variable will be reinitialized every time a new loop starts
      from: 1       # This is the lowest possible value
      to: 1337      # This is the highest value
      leadingzeros: true    # All random numbers will be of equal length

    - java_property: 'myJavaProperty'
      key: 'myCustomKey'    # Name of the java system property
      value: 'value'        # Initial value of the system property
...

Inputs

With inputs you can define variables that are set manually when the test is run.

The inputs setting can be a single field or an array of fields.

Parameters

For each input, the following parameters are available:

Parameter Mandatory? Description Comment
name Mandatory The name of the input field.
default Optional The default value of the input field. (If omitted, an empty string is used). Required for the -debug run option.

Load Test

In Apica Load Test, user Input Fields are treated as static variables.

Inputs provided by Scripting YAML will be available in Scenario Options

snippet.yaml
...
  inputs:
    - name: 'thinktime'
      default: '3'
    - name: 'myBoolean'
...

Authentication

The authentication settings provides a specific authentication method for all requests.

Currently the only supported authentication method is via PKCS12 certificate.

Parameters

To use the certificate you need to provide the following:

Parameter Mandatory? Description Comment
file Mandatory The name of the certificate file. Must be in the same directory as the Scripting YAML file.
password Mandatory The password needed to use the certificate.

Note: The password will be encrypted when the package is built, and will be removed from the Scripting YAML file included in .zip file.

snippet.yaml
...
  authentication:
    pkcs12:
      name: 'mycertificate.pfx'
      password: '12345_SameAsMyLuggage'
...

Scenarios

The Scenarios section in the Scripting YAML file contains all the actual scripts to run during the test.

Introduction

All scripts follow the same basic structure, but the available parameters, attributes and options vary with the type of steps used and other factors.

Name

The script Name is a required node.

Steps

Each action in a script requires a Step node, and you can have as steps many as you want.

Introduction

All scripts follow the same basic structure, but the available parameters, attributes and options vary with the type of steps used and other factors.

The basic structure of a script is as follows:

  • name - The name of the script. Must follow the naming rules for special characters.
    • flow - The flow node indicates the start of a list of steps
      • step - A step to perform (get, post, put, delete, page, loop)
      • Parameter - Setting parameter for the step (url, absolute_url, headers, json, form, body, data, capture, assert)
        • Attribute - Setting attributes for the parameter
          • Options - Setting options for the attribute

If you define multiple scripts, this will result in one .zip file per script.

During a –debug run scripts will be executed sequentially.

Name

The script Name is a required node.

The script name node consists of the name: key followed by a quoted name string.

Note: The name of the script must follow the naming rules for special characters, since it is used to generate the Java class name.

snippet.yaml
...
  name: 'TicketMonster Order Flow'
...

Flow

The Flow node is required and is the starting point for a sequence of steps.

The script name node consists only of the key flow:. Steps in the flow are indented below it.

snippet.yaml
...
    flow:
...

Steps

Each action in a script requires a Step node, and you can have as steps many as you want.

A step node consists of a - dash and the step type followed by a : colon.

The step parameters are indented below it.

Requests

Request steps make up the majority of any scripts. They perform various HTTP Method actions on the target url according to the defined parameters and attributes.

Page

With the Page step you can insert pages into the script.

Requests

Request steps make up the majority of any scripts. They perform various HTTP Method actions on the target url according to the defined parameters and attributes.

GET

The GET HTTP Method request retrieves the provided URL from the service.

POST

The POST HTTP Method request sends data to the provided URL.

PUT

The PUT HTTP Method request replaces the URL content with the provided data.

DELETE

The DELETE HTTP Method request removes content from the service according to the provided URL.

GET

The GET HTTP Method request retrieves the provided URL from the service.

snippet.yaml
...
    - get:
...

DELETE

The DELETE HTTP Method request removes content from the service according to the provided URL.

snippet.yaml
...
    - delete:
...

POST

The POST HTTP Method request sends data to the provided URL.

snippet.yaml
...
    - post:
...

PUT

The PUT HTTP Method request replaces the URL content with the provided data.

snippet.yaml
...
    - put:
...

Request Parameters

All request steps must have at least one parameter to work.

Each action in a script requires a Step node, and you can have as steps many as you want.

The step parameters are indented below the request they belong to.

url

The request url is the resource to access with the request.

headers

The headers parameter adds headers to the request.

json

The json parameter contains the request body in the form of a JSON object.

form

The form parameter provides a request body in the form of application/x-www-form-urlencodedform data.

body

The body request provides the HTTP body for the request.

data

The data parameter is used to provide HTTP body data for the request that is not supported by other parameter formats.

capture

The capture parameter grabs data from the URL parameter and stores it in a variable for later use.

assert

With the assert parameter, you can verify the response contents, and choose whether or not to abort the flow/loop.

url

The request url is the resource to access with the request.

The url is a quoted string with that can either contain the path to append to the target in the config or a fully qualified URL.

snippet.yaml
...
       - get:
            url: '/rest/events'
...
...
       - get:
            url: 'http://example.com'
...

absolute_url

(Experimental)

The absolute_url is a fully qualified URL used instead of the target in the config.

The absolute_url is a quoted string that must contain a fully qualified URL.

It can be created by using variables.

Note: the absolute_url will replace the target in the config.

snippet.yaml
...
        - get:
            absolute_url: 'http://example.com/resource'
...
...
        - get:
            absolute_url: '{{part1}}{{part2}}{{part3}}'
...

file

The file parameter indicates is the location of a file with request content.

The file is a relative (to the script file) path to a file containing the request content.

Note: The content must match the expected type for the request destination.

snippet.yaml
...
    -
        post:
          url: '/{{url1}}/router.asc'
          file: 'requestbody.xml'
...

input

The input parameter allows you to create variables on the fly from static values.

The input parameter is a static value or string.

snippet.yaml
...
        before:
          - file: 'CombineEnrichRequest.class'
            input:
              - "{{Host}}"
              - "helloIAmAString"
...

In this example, Host will still be treated as a normal input variable.

The helloIAmAString string will automatically be stored as a variable in the background and treated as a input variable.

headers

The headers parameter adds headers to the request.

Each header consists of a header key/name and a quoted value.

Note: the headers will not override and replace the defaults in the config.

snippet.yaml
...
    - get:
        url: '/rest/events'
        headers:
            X-My-Header: '123'
            accept: 'application/json'
            content-type: 'application/json'
...

json

The json parameter contains the request body in the form of a JSON object.

The json parameter consists of a sequence of yaml code representing the final JSON to use in the request body.

Note: You cannot use JSON code directly. It must be converted to yaml for use in the Scripting YAML file. The service https://www.json2yaml.com/ can be used for this purpose.

snippet.json
{
  "object": {
    "key": "identifier"
  },
  "string": "Hello World"
}
snippet.yaml
...
    - post:
        url: '/rest/shows?event=123'
        json:
            object:
              key: identifier
            string: Hello World
...

form

The form parameter provides a request body in the form of application/x-www-form-urlencodedform data.

The form consists of field name: value pairs making up a URL Encoded HTTP form.

Format

The application/x-www-form-urlencoded MIME Type encodes keys and values are encoded in key-value paiirs separated by &, with a = between the key and the value.

Example:

name=Whitman Price-Haddad&id=3970g+07agr09

Note: Non-alphanumeric characters in both keys and values are encoded, for binary data you should use multipart/form-data.

snippet.yaml
...
        - post:
            name: Whitman Price-Haddad
            id: 3970g+07agr09
...

body

The body request provides the HTTP body for the request.

The body consists of a quoted string containing the data.

Note: The type of content should be specified with a content-type header.

snippet.html
<html>
<body>
<h1>Hello, World!</h1>
</body>
</html>
snippet.yaml
...
        - post:
            url: '/intro'
                body: '<html><body><h1>Hello, World!</h1></body></html>'
...

data

The data parameter is used to provide HTTP body data for the request that is not supported by other parameter formats.

The data parameter consists of quoted data in text/html format. The data can be binary data, such as images, files or certificates and so on.

Note: The data must be encoded into base 64. The service https://www.base64encode.org/ can be used for this purpose.

snippet.html
iVBORw0KGgoAAAANSUhEUgAAAAkAAAALCAYAAACtWacbAAAABGdBTUEAALGPC/xhBQAAACBjSFJN
AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABWWlUWHRYTUw6Y29tLmFkb2Jl
LnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1Q
IENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5
OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91
dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4w
LyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAg
IDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgpMwidZAAAAtElE
QVQYGY2QwQ7BUBBF71P6hI2vIP7A0k+Ib7X0ByQW9lYiEcKCRN8401ZZdGGa2/s69+bOvAYbay9p
ABIYKiiT6Q4bT4fepstrDQJ4giXCCF6BK+ijHOBv2URbkgubamYLEuvyuN+KfHhqrlPJpdaYzEVT
rzZF3VpMmhMf5DsKc9SjzXRGsEbIuYaPLasZhyH/NOGoV5spIVRLS8U/Jk9K36RqUZ+T0U7acTpy
vvCvuXBVb6+aKnkdkit3AAAAAElFTkSuQmCC
snippet.yaml
...
        - post:
            data: 'iVBORw0KGgoAAAANSUhEUgAAAAkAAAALCAYAAACtWacbAAAABGdBTUEAALGPC/xhBQAAACBjSFJN
                   AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABWWlUWHRYTUw6Y29tLmFkb2Jl
                   LnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1Q
                   IENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5
                   OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91
                   dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4w
                   LyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAg
                   IDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgpMwidZAAAAtElE
                   QVQYGY2QwQ7BUBBF71P6hI2vIP7A0k+Ib7X0ByQW9lYiEcKCRN8401ZZdGGa2/s69+bOvAYbay9p
                   ABIYKiiT6Q4bT4fepstrDQJ4giXCCF6BK+ijHOBv2URbkgubamYLEuvyuN+KfHhqrlPJpdaYzEVT
                   rzZF3VpMmhMf5DsKc9SjzXRGsEbIuYaPLasZhyH/NOGoV5spIVRLS8U/Jk9K36RqUZ+T0U7acTpy
                   vvCvuXBVb6+aKnkdkit3AAAAAElFTkSuQmCC'
...

capture

The capture parameter grabs data from the URL parameter and stores it in a variable for later use.

In order to work, the capture parameter requires:

url

The request url is the resource to access with the request.

Extraction Methods

The different extraction methods provide a number of ways to extract data.

Extraction Methods

The different extraction methods provide a number of ways to extract data.

JSONPath

The json method extracts the data using a JSONPath expression.

XPath

The xpath method extracts the data using a XPath expression.

Regular Expression

The regex method extracts the data using a Regular Expression.

Header

The header method extracts a value from the content of a specific HTTP header.

The cookie method extracts the content of a specific cookie value.

Boundary

With the boundary method you provide left_boundary and right_boundary delimiters to extract the content between the delimiters.

Multiple captures

You can add multiple methods and variables to the capture parameter, and extract to multiple variables.

JSONPath

The json method extracts the data using a JSONPath expression.

JSON Path Language - JSONPath - is a query language for selecting nodes from an JSON document.

Example

For some JSON like this:

{
  "base": {
    "node": { "target": "data" }
  }
}

The JSONPath to target would be

$.base.node.target

Attributes

Attributes are not different from normal nodes.

Example

Here we have two targets with the same attribute:

{
  "base": {
    "node": {
      "target1": { "attr": "value1" },
      "target2": { "attr": "value2" }
    }
  }
}

The JSONPath to the attribute attr for the node target for the two nodes would be:

$.base.node.target1.attr

$.base.node.target2.attr

Multiple nodes can be selected with wildcard:

$.base.node.[*].attr

This returns:

[
  "value1",
  "value2"
]

More Information

For more information see this JSONPath article

snippet.yaml
...
- get:
     url: '/rest/events'
     capture:
         json: '$[*].id'    # JSONPath expression
         as: 'eventId'      # Variable name is eventID
...

XPath

The xpath method extracts the data using a XPath expression.

XML Path Language - XPath - is a query language for selecting nodes from an XML document.

Example

For some XML like this:

<root>
  <node>
    <target />
  </node>
</root>

The XPath to target would be

/root/node/target

Attributes

Attributes are used to provide data related to a specific element, for example formatting or meta-data.

Example

Here we have two targets with the same attribute:

<root>
  <node>
    <target1 attr="value1" />
    <target2 attr="value2" />
  </node>
</root>

The XPath to the attribute attr for the node target for the two nodes would be:

/root/node1/target1@attr

/root/node2/target2@attr

More Information

For more information see the XPath Documentation

snippet.yaml
...
...
 - get:
     url: '/rest/shows?event={{eventId}}'
     capture:
       - xpath: '(//show)[1]/showId/text()'  #XPath expression
         as: 'showID'
...

Regular Expression

The regex method extracts the data using a Regular Expression.

A Regular Expression (commonly called RegEx or RegExp) are text templates used to determine if a certain string (such as a piece of text or a file name) matches a particular pattern, or contains a particular substring, or has some other characteristics.

They can be used to search for matches, replace text and convert character formats.

Example

A normal wildcard string to search for text files would be *.txt.

In RegEx, this would be ^.*\.txt$:

Code Description
^ Start of text/line.
.* Any character any number of times.
\. Period character . (escaped with \.)
txt String.
$ End of text/line.

Obviously, RegEx is more useful for more complex cases.

To match all text files starting with File, containing a string, and ending with a number sequence of three numbers, we could use

^File[0-9]{3}.*\.txt$:

Code Description
^ Start of text/line.
File The string File.
[0-9] Set with range of characters to match, (numbers 0 to 9).
{3} Three characters in the set.
txt String.
$ End of text/line.

More information

For more information see documentation for Perl Regular Expresssions.

Or the Java RegEx Documentation

snippet.yaml
...
- get:
     url: '/rest/events'
     capture:
        regex: '"venue:(.*?)"'     # Regular Expression
        as: 'venue'                # Variable name is venue
...

Header

The header method extracts a value from the content of a specific HTTP header.

HTTP headers are fields that can be transmitted as part of HTTP request or response messages. They provide additional parameters or information for the transaction being performed.

An HTTP header consists of a field name for identification and a value containing the data.

More information is available at https://www.iana.org

snippet.yaml
...
 - get:
     url: '/rest/shows?event={{eventId}}'
     capture:
       header: 'x-my-custom-header'       # Header extraction
       as: 'headerValue'                  # Variable name is headerValue
...

Boundary

With the boundary method you provide left_boundary and right_boundary delimiters to extract the content between the delimiters.

The boundaries are specified by providing text patterns that define the starting and ending points for content to extract.

  • left_boundary - start of content.
  • right_boundary - end of content.

The patterns themselves are not included in the extracted result.

snippet.yaml
...
    - get:
        url: '/rest/shows?event={{eventId}}'
        capture:
            left_boundary: 'title:'            # Boundary extraction - left delimiter
            right_boundary: ',text:'           # Boundary extraction - right delimiter
            as: 'title'                        # Variable name is title
...

Multiple captures

You can add multiple methods and variables to the capture parameter, and extract to multiple variables.

To add multiple capture, simply indent them under the capture: parameter, and prefix with - dash to indicate they are part of the array.

Note: When using JSONPath, Xpath or Regex, there may be multiple matches for a single extraction (if the pattern gets multiple matches). In that case, the extraction will be a random result.

snippet.yaml
...
 - get:
     url: '/rest/shows?event={{eventId}}'
     capture:
       - xpath: '(//show)[1]/showId/text()' # XPath expression
         as: 'showID'                       # Variable name is showID
       - header: 'x-my-custom-header'       # Header extraction
         as: 'headerValue'                  # Variable name is headerValue
       - left_boundary: 'title:'            # Boundary extraction - left delimiter
         right_boundary: ',text:'           # Boundary extraction - right delimiter
         as: 'title'                        # Variable name is title
...

assert

With the assert parameter, you can verify the response contents, and choose whether or not to abort the flow/loop.

Other than these methods you can also control whether the test iteration should end when the assertion failed or if the test should continue.

onfail: 'continue'

If this attribute is omitted the loop will be aborted.

Note: Even if the loop continues the assertion will logged.

In order to work, the assert parameter requires:

url

The request url is the resource to access with the request.

Assertion Methods

The different assertion methods provide a number of ways to verify the response content.

onfail

The onfail attribute controls the execution behavior when an assertion fails.

snippet.yaml
- get:
    url: '/rest/events'
    assert:
     status: '302'
     onfail: ‘continue’  #or abort
- get:
    url: '/rest/events'
    assert:
      size:
        target: 3000
        deviation: 35   #deviation from target in %
- get:
    url: '/rest/events'
    assert:
      text:
        present: 'I am a string that exists'
        notpresent: 'I am a {{variable}} that should not exist'

Assertion Methods

The different assertion methods provide a number of ways to verify the response content.

Mime Type

The mimetype assertion method verifies that the response mime type/content-type of the response matches the defined criteria.

Status

The status assertion method verifies that the returned HTTP Status Code matches the criteria.

Size

The size assertion verifies that the size of the response content matches the criteria.

Text

With the text assertion you can verify that a certain text string exists or does not exist in the response body.

Mime Type

The mimetype assertion method verifies that the response mime type/content-type of the response matches the defined criteria.

A MIME type / (properly) media type / (aka) content type is a standardized two-part identifier for file formats and format contents transmitted on the Internet.

A media type consists of top-level type name and sub-type name, possibly ordered into trees, and optional parameters.

Syntax

top-level type name / subtype name [ ; parameters ]

top-level type name / [ tree ] subtype name [ +suffix ] [ ; parameters ]

The top-level type names are:

application, audio, example, font, image, message, model, multipart, text, video.

The sub-type name consists of a media type name or other identifying content.

Examples

application/javascript
application/json
application/x-www-form-urlencoded
application/xml
application/zip
application/pdf
audio/mpeg
audio/vorbis
multipart/form-data
text/css
text/html
text/plain
image/png
image/jpeg
image/gif
snippet.yaml
...
    - get:
        url: '/rest/events'
        assert:
         mimetype: 'text/css'
...

Status

The status assertion method verifies that the returned HTTP Status Code matches the criteria.

The status assertion consists of a quoted Status Code to match.

snippet.yaml
    - get:
        url: '/rest/events'
        assert:
         status: '302'
...

Size

The size assertion verifies that the size of the response content matches the criteria.

The size assertion takes two attributes:

Item Mandatory? Description Comment
 size Mandatory Size of response content in bytes.
 deviation Optional Allowed size target value % percent.  Default value is 0, for an exact size match.
snippet.yaml
...
    - get:
        url: '/rest/events'
        assert:
          size:
            target: 3000
            deviation: 35
...

Text

With the text assertion you can verify that a certain text string exists or does not exist in the response body.

The text assertion consists of a quoted string, and supports inclusive and exclusive match:

Item Description Comment
 present Text that must exist in the response.
 notpresent Text that must not exist in the response.  

The match string can contain variables.

snippet.yaml
...
    - get:
        url: '/rest/events'
        assert:
          text:
            present: 'I am a string that exists'
            notpresent: 'I am a {{variable}} that should not exist'
...

onfail

The onfail attribute controls the execution behavior when an assertion fails.

The onfail attribute can have one of two values.

Option Description Comment
 ‘abort’ Stop execution of the flow/loop.
 ‘continue’ Continue the test. The assertion result is logged.
snippet.yaml
- get:
    url: '/rest/events'
    assert:
     status: '404'
     onfail: ‘abort’          # Abort execution.
snippet.yaml
- get:
    url: '/rest/events'
    assert:
     status: '302'
     onfail: ‘continue’       # Log result and continue execution.

Page

With the Page step you can insert pages into the script.

A page break is a separator in a script that discerns different pages (which typically consist of multiple URL calls) from each other.

Usage

Page Breaks provide reasonable divisions in the page flow, typically by adding a page break before each step of a workflow utilizing multiple web pages in a site.

Page breaks can be entered manually into scripts, or automatically generated when recording web sessions.

Parameters

A page can contain three parameters:

Parameter Mandatory? Description Comment
 name  Mandatory  The name of the page.  
 thinktime  Optional  Duration of time in s seconds when reaching the page.  Fixed value or variable. Default is 0 (seconds).  
 deviation  Optional  Percentage that the thinktime should randomly vary. Default is 35 (%).  
snippet.yaml
...
    - page:
        name: 'MyPage'
        thinktime: '{{mythinktimevariable}}'
        deviation: 35
...

Loop

The Loop node is used to create repeated actions. It can be inserted at different levels in the flow, and a loop can be placed inside another loop.

A loops is a grouping of steps that are performed repeatedly, much like the flow itself.

Loops can be applied at any level of the flow, including other loops. There is no limit to the number of nested loops.

A Loop can contain any step allowed in a flow node.

Parameters

A loop can have three parameters:

Parameter Description Comment
 id  Identifier for the loop.  Use as variable to refer to the current loop iteration.
 count  Number of iterations of the loop. Fixed value or variable. Default is a single iteration.
 over  Defines a list of items to iterate over. Each item can be a fixed value or a variable. 
 _Item  Current item in the over list/array (used with id as a variable). Example: {{MyLoop_Item}}.

Using id:

snippet.yaml
...
    - loop:    # This loop runs 1 time
    id: 'MyLoop'
      - get:
        url: 'http://example.com/id/{{MyLoop}}'
...

Using count:

snippet.yaml
    - loop:
        - get:
            url: 'http://example.com/'
      count: 10    # This loop runs 10 times
...

Using over and _Item:

snippet.yaml
        - loop:
        id: 'OtherLoop'
        - get:
            url: 'http://google.com/{{OtherLoop_Item}}'
        over:
        - 'Hello'
        - 'World'
...

Custom Logic

You can include custom logic in your Scripting YAML scripts, in the form of inline scripts and plugins.

Hooks

Custom logic is inserted into the Scripting YAML script with the before and after hooks.

Inline Scripts

Inline Scripts allow you to enhance the load test scenarios with additional features.

They can be used for test control, custom error reporting or to modify aspects of the scenario, such as make dynamic requests, or extract data from responses for reuse.

Plugins

Java plugin .class files can be used from the Scripting YAML file, to perform any action or workflow supported by the plugin.

Outside Flow

The before and after hooks can be used outside the entire flow context in order to run custom logic before and after the flow.

Hooks

Custom logic is inserted into the Scripting YAML script with the before and after hooks.

The hooks provide an insertion point into the Stamped script, and defines the execution order - if the code should be executed before or after the step.

Before

The before hooks are indented into the step in which the logic should run, right before the parameter.

After

The after hooks are inserted directly after the step after which the logic should run, right before the parameter.

Before

The before hooks are indented into the step in which the logic should run, right before the parameter.

In this example, the before hook is placed directly after the request step, but before the url parameter.

snippet.yaml
...
    - get:
        before:
        - inline: |
            'thinktime = thinktime + 1
             print thinktime'
        url: '/pet/123'
...

After

The after hooks are inserted directly after the step after which the logic should run, right before the parameter.

Example

snippet.yaml
...
    - get:
        after:
        - inline: |
            'thinktime = thinktime + 1
             print thinktime'
        url: '/pet/123'
...

Inline Scripts

Inline Scripts allow you to enhance the load test scenarios with additional features.

They can be used for test control, custom error reporting or to modify aspects of the scenario, such as make dynamic requests, or extract data from responses for reuse.

Note: Inline scripts will always run before plugins regardless of order.

Inline scripts are indented under either a before or an after hook.

Inline scripts have three attributes:

Attribute Mandatory? Description Comment
inline Mandatory Inline script code.
input Optional List of input variables for the script.
output Optional List of output variables for the script.

Example

Note: The inline script is written directly in the Scripting YAML code.

snippet.yaml
...
    - get:
        before:
        - inline: |
            'aJsonValue = jsonGetData(aJsonStructure, "main.1.key")
            aJsonValue = strReplaceRegex(aJsonValue,"replaceMe","value")'
          input:
            - '{{aJsonStructure}}'
          output:
            - '{{aJsonValue}}'
        url: '/pet/123'
...

Placeholders

Scripting YAML has placeholder variables that you can us in inline scripts:

Placeholder Description Comment
 STATUS_CODE Response code for the previous request – Only usable in the after hook.  Replacement for the getHTTPResponseCode() method.  
 RESPONSE_CONTENT  Response content for the previous request – Only usable in the after hook.  Replacement for the getHTTPResponseContent() method.

TODO: Example

Limitations

Some inline script functions are not yet implemented in Scripting YAML.

The functions in the category HTTP Request/Response Integrated Functions are not available in Scripting YAML.

Functions

TODO: List

Plugins

Java plugin .class files can be used from the Scripting YAML file, to perform any action or workflow supported by the plugin.

Plugin declarations are indented under either a before or an after hook.

Plugins have three attributes:

Attribute Mandatory? Description Comment
file Mandatory File name of plugin. The file must be in the same directory as the Scripting YAML file.
input Optional List of input variables for the plugin.
output Optional List of output variables for the plugin.

Example

snippet.yaml
...
    - get:
        before:
        - file: 'RemoveCookie.class'
          input:
            - '{{cookieToRemove}}'
        url: '/pet/123'
...

Sample Code

Examples of Scripting YAML files.

Swagger Petstore

snippet.yaml
config:
  target: 'http://petstore.swagger.io/v2'
  defaults:
    headers:
      accept: 'application/json'
scenarios:
 - name: 'Petstore'
    flow:
      -	page: # Means that the ‘page’ below is an ‘object’ in the ‘flow’ array
          name: 'MyCustomPage'
          thinktime: 3000
          variance: 35
        ◦ get: # Means that the ‘get’ below is another ‘object’ in the ‘flow’ array
          url: '/pet/findByStatus?status=available'
          capture:
            json: '$.[*].id'
            as: ‘randomID’
      - loop:
          - get:
              url: '/pet/{{randomID}}'
              capture:
                regex: '(.*)'
                as: 'regexCapture'
        count: 10

TicketMaster Orderflow

For testing Apica’s demo site ‘Ticket Monster’

JSON used in the example:

snippet.json
{
	"ticketRequests": [{
		"ticketPrice": 9,
		"quantity": 1
	}],
	"email": "hej@apica.se",
	"performance": "3"
}

Code

snippet.yaml
config:
  target: 'http://ticketmonster.apicasystem.com/ticket-monster'

  defaults:
    headers:
      accept: 'application/json'
      content-type: 'application/json'

  environments:
    production:
      target: 'http://ticketmonster.apicasystem.com/ticket-monster'
    integration-test:
      target: 'http://ticketmonsterdev.apicasystem.com/ticket-monster'

  inputs:
    - name: 'email'
      default: 'hej@apicasystems.com'
    - name: 'TT'        # Think Time
      default: '3000'   # 3000 ms

scenarios:
- name: 'TicketMonster Order Flow'
  flow:
    - page:
      name: 'PickEvent_and_Show'
      thinktime: '{{TT}}'
      deviation: 35

    - get:
        url: '/rest/events'
        headers:
           X-Requested-With: 'XMLHttpRequest'     # Example of an added header
        capture:
          json: '$[*].id'   # The value we catch here
          as: 'eventId'     # will be used for the variable 'eventId'
    - get:
        url: '/rest/shows?event={{eventId}}'  # here we used the var eventId
        capture:
          json: '$[*].id'
          as: 'showId'   # we catch the showId

    - page:
      name: 'BuyTicket'
      thinktime: '{{TT}}'
      deviation: 35

    - get:
        url: '/rest/shows/{{showId}}'   # ….and use it here!
        capture:
          - json: '$.performances[*].id'
            as: 'performanceId'
          - json: '$.ticketPrices[*].id'
            as: 'ticketPriceId'
    - post:
        url: '/rest/bookings'
        json:     # The post data is formated as json
          ticketRequests:
            - ticketPrice: '{{ticketPriceId}}'
              quantity: '1'
          email: '{{email}}'
          performance: '{{performanceId}}'
        capture:
          json: '$.id'
          as: 'bookingId'