Script Editor

As the name suggest, user can edit any script through this page. The script editor page is divided into following parts:

  • Left Pane
  • Top Pane
  • Right Pane
Figure 19: Script Editor Page with Pane marking

Let us discuss the above in detail:

Left Pane

Left pane mainly consists of search, script structure and data as shown in figure below.

Figure 20: Left Pane-Script Editor

Script Structure

A Script consists of list of files – flow.c, init_script.c, exit_script.c, registrations.spec, and runlogic.c.

Figure 21: Script Structure

A detailed description of each file of Script structure is provided below:

flow.c

  • This file contains main URLs, headers, and embedded URLs.
  • It contains the main execution loop & the URLs that are accessed by the LoadTest.
  • Transaction and CAPI are added from the c file.
  • The Parameters and Checkpoints can be added from the flow file of the script. After adding checkpoint and Parameter, API is added to the spec file.

 

init_script.c

  • Any Initialization can be done here.
  • Any relevant NS C API can be used in this file.
  • This file is internally called the LoadTest.

exit_script.c

  • When the user completed the execution of flow then c file is called.
  • This file is internally called by LoadTest.

registrations.spec

  • Checkpoints and Parameters are added in this file.
  • Parameters and Checkpoints can be added from the flow file of the script. After adding checkpoint and Parameter, API is added to spec file.
  • Default spec file is hidden and the user can display it after clicking the Show/Hide registrations.spec file option in the View menu.

runlogic.c

RunLogic allows users to create a custom flow to be executed by LoadTest. Flows of the scripts can be ordered here.

  • With RunLogic –
    • All pages/flows can execute as per the requirement.
    • Good control over the execution of pages or on the group of pages (Blocks).
Figure 22: Runlogic Option

Runlogic screen is divided into left pane and right pane as shown in figure below.

Figure 23: Runlogic Screen

Left Pane

Left pane consists of block and flow. Whatever option is selected the corresponding field is shown in Right pane. Block is any node of tree having at least one child. A block can contain pages or another block within itself. User have the following option in block:

A. Block

  • Insert Block: If user select the Insert block option, he has to fill the corresponding fields of block name and block type and select the update block button.
  • Insert Flow: If the user select , corresponding right pane give the option to select the flow which needs to be inserted.
  • Move up/down: User can select option to move up or down the order.
  • Remove: The user can click on icon to remove the block from runlogic.

B. Flow

  • View: Click on the icon to view the script.
  • Move up/down: User can select option to move up or down the order.
  • Remove: The user can click on icon to remove the block from runlogic.

Toolbar

The toolbar consists of following option:

Figure 24: Toolbar
  • Save : This saves the RunLogic. This validates if all properties of blocks are satisfied before saving it.
  • Collapse All : To collapse the blocks and pages. This collapses all blocks and pages inside the blocks.
  • Calculator : It is used to calculate the runlogic. This opens a new window where PVS can be auto-calculated based on the scenario type and the parameters.
  • Rename RunLogic: To rename a RunLogic, click on icon. 
  • Copy Runlogic: To copy RunLogic click icon. 
  • Reset Tree: This resets the currently modified RunLogic to previously saved RunLogic, click icon. 
  • Download Runlogic: : This downloads the RunLogic tree. Users can save this file, clickicon. 
  • Delete RunLogic: To delete RunLogic click icon.

Data

Al the data directories are shown here, User can select a data directory and see data files present in the data directories.

Figure 25: Data

NOTE: By default, all script of the same project/subproject will be shown in left pane. If user wants to edit or use script of other project/subproject, then he can click on .

Toolbar

Top Pane consists of various icons, transaction, Parameter, Assertion and API.

Figure 26: Toolbar

SR#

Icon

Meaning

Description

1

Create New File

To create a new file/directory as per the requirement.

2

Create Flow

To create a new blank flow in the script

3

Save

To save a file after editing.

4

Save All

Save all the file opened in as tabs in the editor.

5

Version Control

To view the version control history of the script.

6

Snapshots

To see the snapshot of pages of a script.

7

Word wrap

Confines the data in the file within defined margins.

8

Compare Script

To compare two scripts.

9

Synchronize user’s script

To refresh the script manager GUI. You can sync the scripts at the project, subproject, or script level.

10

Compile Script

To compile a script.

11

Test Script

To execute the script from the script manager.

12

Debug Script with 1 iteration

User can choose one or more iterations to debug the flow/ script with break points.

13

Continue

To start the script replay and pauses it at the next breakpoint of the script.

14

Step by Step

To run the script one line at a time.

15

Stop Test

To stop the test.

Create File/Directory

As the name suggest, this helps to create new file/ directory as per the requirement. For this click the  icon. Once you click the icon, the following page opens:

Figure 27: Create File/Directory

Enter the file or directory name as per the requirement. It is used to create a new file/directory inside the script.

Create Flow

The ‘Create Flow’ option is used to create a new blank flow in the script. On clicking this option, a pop up window is displayed in which the user can select a project name and a sub-project name to create a flow file in that script and add pages/URL transaction manually into the flow file.

Steps to create a flow

  1. Click the Create Flow Icon on the Top Pane.
Figure 28: Create Flow Option

2. Provide the following details and click OK:

  • Flow Name: Name of the flow file.
  • Location: Path where the flow is saved (project/subproject scripts).
  • Template: User can select some predefined templates for ease of creating script.
Figure 29: Create Flow Page

Version Control

Here, the user can view the version logs of a record. If there is a change in scenario, such as changes in API configuration, changes in Load configuration etc., then these changes are reflected in UI in the form of a modified file. If the user has GIT configured, then he will see GIT History and GIT Commit else he will see Cavisson Version System options. 

It has following options:

  • GIT Commit(file)
  • GIT Commit(Script)
  • GIT History
  • GIT Pull

 

GIT Commit

This is used to commit the changes of opened file to GIT. To access this, click the GIT Commit option in Version Control. If user used GIT commit file, then open file will be commited to GIT if user use GIT commit script then complete script will be commited.

Figure 30: GIT Commit Icon
Figure 31: GIT Commit

GIT History

User can view the version logs of a Scenario through GIT history. Once user click GIT history in Version Control, the following page opens.

Figure 32: GIT history

In GIT history there are two GIT options:

  • Show Logs: It shows the version log of a script. You have the following columns in show logs:
  • Date time: Shows the date and time of the log.
  • Author: The owner of the file/logs.
  • Comments: Any comment made by owner is mentioned here.
  • Show Modified Files: It shows the files modified in script.
Figure 33: Show Modified List

It has the following columns:

  • File: Shows the files which are modified.
  • Status: Shows the status whether the files are modified or not.

In Git History user can perform below 2 actions:

  • Diff: Shows the changes between new and old version of modified files/logs.
  • Revert: If the user want to revert to older file/logs without the changes.

GIT Pull

It is used to pull the latest commits from the remote server to the local repository. By refreshing scenarios/scripts, all the recently committed files on master repository are fetched to the scenarios/scripts directory of local repository. Select a record and click the GIT Pull button. On successful processing, a message is displayed – Refresh successfully.

Figure 34: GIT Pull

Compare Script

This icon is used to compare two or more scripts. For this click on compare script icon on the top pane in the script manager page and click the compare button as shown in the below figure.

Figure 35: Compare Script

The compare script page opens. Press control and select the script to be compared. The compare scripts will be shown as shown in below figure.

Figure 36: Compare Script Screen

In Side by side comparison scripts to be compared are shown side by side and are highlighted in red or green showing the added or deleted rows. In Inline comparison, the script compared one above the other. If you check the Show whitespace changes checkbox, the blank space in the script is shown as white space.

Script Compilation

If there is any syntax error, then the user gets a proper Error message while compiling the script.

Below is a Flow file of the script having Syntax Error:

Figure 37: Script Compiler Icon

Compilation Error while compiling script having some Syntax Error:

Figure 38: Script Compiling Error

The detail of Errors is displayed on the lower panel while compiling the script:

Figure 39: Error Details on Lower Panel

Highlighting Missing API Close Brackets in Script Compilation

During script compilation, if there is any syntax error in multiline API, like if ‘);’ left in multiline API, LoadTest highlights the error for the same.

Continue

On selecting this  icon, the script execution is started from the first break point and jumps to the next breakpoints.

Figure 40: Continue Icon

When a user clicks the  icon, the script execution is jumped to the next breakpoint and executes the intermediary steps.     

Figure 41: Script Execution after Continue

Further, on clicking this icon, the script execution jumps to the next break point.

Figure 42: Script execution at Breakpoint

The user can view the script execution report in the lower panel.

Figure 43: Script Execution Report
Step by Step

On selecting this option, the execution is done line by line. It starts the script replay and then pauses it on the next line of the script.

When the user clicks the  icon, the execution is performed in a sequential manner line by line.

Figure 44: Step By Step Icon

User can view the script execution report in the lower panel.

Clicking it further executes the next line of the flow file.

Figure 45: Execution on Step By Step

User can view the script execution report in the lower panel.

Figure 46:Script Execution Report

Note:

  • Shortcut keys to perform the BreakPoint-related operations.
  • Continue – F5
  • Run Step by Step – F10
  • Remove Breakpoint – F9
  • The user can remove all the breakpoints in current flow by right-clicking on the flow file and selecting ‘Remove All Breakpoints’ option.

Script Compilation

If there is any syntax error, then user gets a proper Error message while compiling the script.

Below is a Flow file of script having Syntax Error:

Figure 47: Script Compiler Icon

Compilation Error while compiling script having some Syntax Error:

Figure 48: Script Compiling Error

The detail of Errors is displayed on the lower panel while compiling the script:

Figure 49: Error Details on Lower Panel

Highlighting Missing API Close Brackets in Script Compilation

During script compilation, if there is any syntax error in multiline API, like if ‘);’ left in multiline API, LoadTest highlights the error for the same.

Figure 50: Compile Script Error

Advance Options

Recording Logs

Recording logs have following types:

  • Debug log
  • Error log

Debug log

Debug logs are system-generated logs that are sent to your Dashboard along with every new conversation. Debug log option will be available only for recorded scripts. Debug log will be displayed in new dialog box.

Figure 51: Debug log

Error Log

Figure 52: Error Log

View Recorded request response

A user can see Page Detail information, such as URL, Headers, Request and Response, and Cookies of the recorded script. To view the page details, follow the below-mentioned steps:

On the Script Manager UI, go to the View menu and click the Page Details menu item.

Figure 53: Page Detail Selection

2. This displays various details, such as URL, Headers, Request and Response, Cookies, of the recorded pages in the flow files.

Figure 54: Script Page Details

3. User can select the flow and page name from the drop-down list. The details are categorized into main URL (with green color) and inline URL (with grey color) and displayed in tabular format according to the selected page, such as the path of the main/inline URL, response, host, status code, size of the component (page/image), method, content type, and URL.

The detailed information includes – Raw data, Request body, Response body, headers, cookies, and query string. To view the response to a request, click the View Response check box.

Page List

Page list shows all the pages in the script. We can also edit the page name.

Figure 55: Page List

Add External Libraries

User can include thirdparty library and use it with Script files using this utility. When User have a library to be used or have reusable/logically distinct set of functions, it is helpful to build a library from it so that you don’t have to copy the source code into script files.

 Once it’s been written and tested, user can safely reuse it over and over again, saving the time and hassle of building it into each script every time.

Figure 56: Add External Libraries 

Transactions

Any sequence of interactions or page clicks may be grouped as a transaction. Transactions are mechanism to measure server response time for any operation. In simple words, the use of “Transaction” helps measure the time taken by the system for a particular request. It can be as small as a click of a button or an AJAX call upon losing focus from the text box.

Transactions are added by using the following APIs:

  • ns_start_transaction (“transaction name”); – It acts as a marker to define the start of a transaction
  • ns_end_transaction (“transaction name”,status);  – It acts as a marker to define the end of a transaction

Need of Transaction

Transactions in Script are needed due to following reasons:

  • To measure server response time for a particular user request/action.
  • To measure server response time for a logical group of actions. For Example, to measure response time of a checkout having 3 pages, users can group them into a transaction. This is done to enhance our scripts to get the real feel of end user and behavior of a real user.

Using Transactions in Scripts

User needs to follow the below-mentioned steps to use transactions in the recorded script:

Go to the Script Manager GUI and double-click the flow.c file of the recorded script. The flow.c file is displayed. Select transaction from the top left corner as shown in figure below.

Figure 57: Transactions

Start Transaction

In script, Transactions API(ns_start_transaction) can be used anywhere in the flow files. Start transaction is normally added before ns_web_url API.

Alternatively, start a transaction before the main URL.

Example:

Example:

                  void Flow1()

                              {

                               // Using transaction for home page

                               ns_start_transaction(“HomePage”);

                              ns_web_url(“Homepage”,   “URL=http://127.0.0.1/tours/index.html”);

                               ns_end_transaction(“HomePage”, NS_AUTO_STATUS);

                              }

Figure 58: Start Transaction
  1. Enter the transaction name and click Advanced.
  2. In Advanced, you have the following options of whether you want:
  • Transaction Name as a text: In this, the transaction name is taken as plain text.
  • Transaction Name as a Variable. In this, the transaction name is taken as a programming variable and value of that parameter is used as transaction name
  • Transaction name as a Script parameter: In this, the transaction name is taken as a script parameter and value of that parameter is used as a transaction name.

End transaction

In C script, Transactions API can be used anywhere in the flow files. End Transaction is normally before ns_page_think_time API.

Alternatively, end the transaction after the URL.

Example:

                  void Flow1()

                              {

                               // Using transaction for home page

                               ns_start_transaction(“HomePage”);

                              ns_web_url (“Homepage”, “URL=http://127.0.0.1/tours/index.html”);

                               ns_end_transaction (“HomePage”, NS_AUTO_STATUS);

                              }

Figure 59: End Transaction
  1. Enter End Transaction Name or select from the available list of started transactions.
  2. In Advanced, you have the following options:
  • Status: It shows the status of the transaction, which can be passed, failed, or auto status.
  • Transaction Name as a text: In this, the transaction name is taken as plain text.
  • Transaction Name as a Variable. In this, the transaction name is taken as a programming variable and value of that parameter is used as transaction name.
  • Transaction name as a Script parameter: In this, the transaction name is taken as a script parameter and value of that parameter is used as a transaction name.
  • End transaction as different name: If you want to end the transaction as a different name, you have to select this checkbox. You will get the option to fill the new name and also to select whether you want the end transaction as text, variable, or Script manager.

Start End Transaction

In the script, Transaction API can be used anywhere in the flow files. For using Start-End transaction user has to select one or more pages from the script editor. It will automatically add ns_start_transaction API before selected page(s) and ns_end_transaction API after the selected page(s).

Figure 60: Start End Transaction

Example:

                        void Flow1()

                                    {

                                     // Using transaction for home page

                                     ns_start_transaction(“HomePage”);

                                    ns_web_url (“Homepage”, “URL=http://127.0.0.1/tours/index.html”);

                                     ns_end_transaction (“HomePage”, NS_AUTO_STATUS);

                                    }

  1. Enter the Transaction Name.
  2. In Advanced, you have the following options:
  • Status: It shows the status of the transaction, which can be passed, failed, or auto status.
  • Transaction Name as a text: In this, the transaction name is taken as plain text.
  • Transaction Name as a Variable. In this, the transaction name is taken as a programming variable and the value of that parameter is used as the transaction name.
  • Transaction name as a Script parameter: In this, the transaction name is taken as a script parameter and the value of that parameter is used as a transaction name.

Parameters

Parameterization is a technique to change the value of the variable at run time. It is achieved with NetStorm variables. NS variables are variables used in programming languages & scripts. The primary use of the NS variables is to parameterize a function in the flow file.

To view the parameterization window, go to registration.spec file, right-click on right pane, select Parameters and click the desired parameter from the list of parameters.

To access this, click the Parameter in the Script editor page as shown in below figure:

Figure 61: Parameters Detail

There are following types of parameters, which can be applied to scripts:

  • Dataset using File
  • Search Parameter
  • Scratch Parameter
  • XML Parameter
  • Index Dataset using File
  • DateTime Parameter
  • Random String Parameter
  • Random Number Parameter
  • Unique Number Parameter
  • Scratch Array Parameter
  • JSON Parameter
  • Unique Range Parameter
  • Dataset Using Query Parameter

Let us discuss the parameters in detail.

Dataset Using File

Dataset Using File Parameter is formerly called File Parameter. The Dataset Using File Parameter is used to read data values from a file that the user has created or uploaded and can be used in the URL, Header, and Body.

Figure 62: Dataset using File

Adding the Parameter

The following fields need to be filled to add the Dataset Using File Parameter:

  • Parameter Name: This field is used to set the name of the parameter, which is used in the parameterization of the script with curly braces { } . It is a mandatory field.
  • Parameter Type(s) (only in case of Advance Settings):Select the following from the drop-down:
    • Parameter Type Value: The value from the data file is treated as the file parameter value.
    • Parameter Type File: The value from the data file is treated as a new file path and content from that file is treated as the value.
    • Parameter Type File_Param: The value from the data file is treated as a file path and the content from that file is treated as a parameter whose value is treated as the parameter value.
  • Column: It is the column on which the parameter is to be entered.
  • Encrypt: To encrypt the parameter name check this box.
  • Data Directory: Data directory is a directory that is used to save all data files.  Data from data files will be used in Script as a value of the parameter variable.
  • Data File:It shows the location from where the data file will be selected and uploaded in the data dir directory. Click the cloud icon which will open the popup window. Users can browse the location in the pop-up window and upload the data files in the selected Datadir directory. From the browse and get the location from where the file is to be fetched.
  • First Data Row: In some situations, the user might want the Load Test to start reading data from a particular line number. So, the user can use this field to indicate Load Test which lines it should consider as the first data row. By default, the first data row is 1.
  • Column Delimiter: This field specifies which character in the data file should be considered as a column separator. By default, the column delimiter is ‘,’. Users can also use special symbols as the column delimiter.

Advanced

Figure 63: Advanced( Dataset Using File Parameter)
  • Selection mode: Any data file can contain various numbers of rows. Value selection mode specifies how a variable value is initialized from the list of values. Possible options are:
  • Sequential: This option selects rows sequentially i.e. the first row, then the second row, then the third row, and so on. It is selected by default.
  • Random: This option selects rows randomly. When enabled, the Load Test can pick any row from the data file.
  • Weighted Random: Value is randomly selected from the list of values but in a weighted random fashion. It means certain values would be selected more often than others depending upon the weight of certain values.
  • Unique: This option selects a row from the data file uniquely i.e. for all the sessions running currently, one data value is used only once.
  • Use Once: This option uses one data value only once. Once a data value is used, it is deleted from the data file. Each deleted value is written in a separate data file with the extension .used.
    • RemoveDupRecords (if selection mode is UNIQUE): Select ‘Yes’ if you want to remove the duplicate records otherwise select ‘No.
    • UseOnceWithinTest (if selection mode is USE ONCE)- Select ‘Yes’ if you want to use data value once within the test otherwise select ‘No.
    • Save Last Used Data After (if selection mode is USE ONCE)- In this, you can save the last used data either after every value or a particular value.
    • After All Parameters are used (if selection mode is USE ONCE)- Select any of the following option once all the parameters are used:
    • Abort Session
    • Abort page
    • Abort Test
    • Abort user
  • Updated Value On: This field is used to specify when to pick a new data value i.e. generate once and use this value for the entire session, or, pick a new data value every time File Parameter is used. Users can have two options:
  • Session: If Session is selected, data is picked only for the first use of File Parameter. Then, for the entire script, the same value is used.
  • Use: If Use is selected, data is picked from the data file for each use of File Parameter i.e. if File Parameter is used, for example, 50 times in the script, then for every reference, the new data value is picked.
  • New Vuser: Data is picked only for Vuser.
  • Encoding Options: This option is used to encode special characters to their ASCII value. This option contains 3 fields:
  • Encode: In Load Test, the user can encode any number of special characters i.e. all, specific, or none. Users can have the following options:
  • Encode all special characters except (+), (-), (.), (_):All special symbols except + – . _ are encoded. It is the default value.
  • Encode only specified characters:The user can specify which special characters to encode in Characters to encode.
  • Do not encode special characters:None of the special characters is encoded. However, space is encoded always.
  • Characters to encode: If the user selects Encode only specified charactersoption in Encode, then this field becomes active. Here user can specify which special characters should be encoded.
  • Encode Space By:This option specifies to Load Test how to encode space. Users can have two options: ‘+’ and ‘%20’. If ‘+’ is chosen, Load Test encodes space by ‘+’ and if ‘%20’ is chosen, Load Test encodes space by ‘%20. The default value is ‘+’.
  • Ignore Invalid Data Lines: To ignore the invalid data lines,check the respective available check box.
  • Copy to run: This option is available only when you are using the data directory other than the script. It will copy the data directory on the test run at the below path:

Notes:

  1. Data directory can be overridden from the scenario only if you are using a data directory other than the script.
  2. You can edit data files upto 10 MB. For more than 10 mb it will open as Read Only mode.

Search Parameter

Search Parameter is used to search for a particular string in the response message of the server. Users can send this searched string in the subsequent request messages. To search the desired string, provide the left boundary and right boundary. The pattern which lies in between these defined boundaries is searched and is stored in a Search Parameter variable.

Figure 64: Search Parameter

Adding the Search Parameter

The following fields need to fill to add the Search Parameter in the script:

  • Parameter Name: This field is used to set the name of the Parameter, which is used in the parameterization of the script with curly braces {}.
  • Boundary
  • Left Boundary(LB): Left Boundary is the starting pattern that is provided to search any particular string. To search any string, the left pattern is searched first. When its existence is verified only then the right pattern is searched.
  • Right Boundary(RB): Right Boundary searches for the ending pattern i.e. occurrence of this pattern terminates the search and the data lying between Left Boundary and Right Boundary is the value of the Search Parameter.
  • Ignore Case: If you check this box then the string to be searched in LB and RB becomes non case-sensitive.
  • Search Text in page response:The user can specify on which response page he/she wants to search the string.
  • Occurrence Count: When the data to be searched is present more than once on the response page(s), then the user can specify which occurrence should be picked by the Load Test. By default, it is set to 1. This means it picks the first occurrence.

      There are the following options:

  • Index: In index, you can select any particular occurrence from the list of Index. For eg- if there are 10 occurrences of patterns, then you can select the 5th or sixth one from the index file.
  • All: This option captures all occurrences of the pattern and saves them in search variable in the form of an array.
  • Any: This option picks data randomly from any one of the occurrences of the pattern.
  • Any Non Empty: This option picks data randomly from any one of the occurrences but not the empty value of the pattern.
  • Last: This option picks the last occurrence of the pattern.

Advanced

Figure 65: Advanced-Search Parameter
  • You have to click the   Icon to view all the options in the Advanced section.

    You will get the following option in Advanced:

    • Retain Previous Value: This option provides a facility to users by which they can able to retain the previous value and also clear the previous value. There are two possible values, the first is RetainPreValue=Yeswhich retains the previous search value, and the second is RetainPreValue=No that don’t retain the previous search value. The default is Yes.
    • Start Offset: If the pattern searched by Load Test is of length 20 but suppose the requirement is to pick data from the 5th In this case, Start Offsetcan be used. It is enabled when From Beginning check box is disabled. If the Start Offset value is set to 5 then it truncates the first 5 characters and saves this altered data, starting from the 6th position to the last position, in the searched parameter variable. Save Offset value can lie in the range of 0-100 (inclusive of boundaries). Users can also specify whether to consider a complete length or a specified length.
    • Maximum Length:If the pattern searched by Load Test is of length, say, 20 but suppose the requirement is to pick data till the 4th last position. In this case, Maximum length can be used. It is enabled when Till the end check box is disabled. If the Maximum Length value is set to 5 then it truncates the last 5 characters and saves this altered data, ending from the 6th position from the last position, in the searched parameter variable.

    Note: You will also get the option to select the checkbox, if you want the maximum length to be till the end.

    • LB Match: This option is used to select LB in case of multiple LB. By this argument, the user can select the LB that he wants to use.
    • Conversion:This option is used for converting the searched data to some other format. By default, there is no conversion. So, the data is placed in the request as it is. But if the user wants to convert this data into URL format, then this option comes into the picture. If the search parameter is used in the URL portion, then all of the special symbols are encoded. But if the search parameter is used in the BODY portion, then to encode special symbols, the following ‘Header’ should be used on that particular page:

    HEADER=Content-Type: application/x-www-form-urlencoded.

    • Search in: By applying ‘Search Parameter’, Load Test searches on the response page. If the user wants to search some data in the value of any ‘Search Parameter Variable’, in that case ‘Search in’ is used i.e. ‘Search in’ searches in the value of the search parameter variable. Users can have the following options:
    • Body
    • Header
    • All
    • Parameter
    • Action on Not found: If the pattern, for which Load Test is searching, is not found, then the user can make Load Test behave in the following ways:
      • Warning: If this option is used and the pattern for which Load Test is searching, is not found then Load Test displays an error message in logand continues its operation.
      • Error: If this option is used and the pattern, for which Load Test is searching, is not found, then Load Test displays CVFail in reportand log and terminates further processing.
    • Redirection Depth:If the page, on which Load Test is searching the pattern, is moved to some other location, then this option is used. It specifies how many moved locations Load Test is supposed to search for the pattern i.e. up to what redirection depth Load Test searches the pattern. By default, if a page is moved, then Load Test does not search on that page. There are the following options:
      • Last: If this option is chosen, Load Test searches on the last redirection.
      • Numerals ranging from 1-32: Load Test searches only up to the depth which is equal to the numeral selected.
      • All: Load test searches till the last redirection depth.
    • Encoding Option: Encoding is used to encode special characters to their ASCII value. Users can encode any number of special characters i.e. all, specific, or none. User can have the following options:
    • Encode all special characters except (+), (-), (.), (_): All special symbols except + – . _ are encoded. It is the default value.
    • Encode only specified characters: The user can specify which special characters to encode in Characters to encode.
    • Do not encode special characters: None of the special characters is encoded. However, space is encoded always.
    • Encode Space By:This option specifies to Load Test how to encode Space. User can have two options: ‘+’ or ‘%20’. If ‘+’ is chosen, Load Test encodes Space by ‘+’ and if ‘%20’ is chosen, Load Test encodes Space by ‘%20’. The default value is ‘+’.

    Scratch Parameter

    Scratch Parameter formerly called as Declare Parameter, is a parameter whose value is initialized by the user. This parameter value does not change automatically. The user has to write code for assigning its value.

Figure 66: Scratch Parameter

Adding Scratch Parameter

The following fields need to be filled for adding scratch parameter:

  • Name:This field is used to set the name of the Parameter, which is used to access this parameter in the entire script.
  • Default Value: If the user gives a default value then the Scratch Parameter will be initialized by this value. User can set scratch parameter values using ns_eval_string.
  • Retain Previous Value:This option provides a facility to users by which they can able to retain the previous value and also clear the previous value.

XML Parameter

Load Test XML variables are initialized as a result of searching a response document for user-specified criteria. Any pattern appearing within the XML node would be used to initialize the value of the XML Load Test variable.

Figure 67: XML Parameter

Adding Xml Parameter

The following fields need to be filled to add XML parameters in the script.

  • Parameter Details
  • Parameter Name: This field is used to set the name of the Parameter, which is used in the parameterization of the script with curly braces { }.
  • XML Node Path: This specifies the XML nodeThe most common nodes in XML are Document Node, Element Node, and Attribute Node.
  • Select Pages for XML Parameter: The user can specify on which response page he/she wants to apply the XML parameter. Users can select any one of the following options:

After filling in the above fields, you have to select any one of the following:

  • Find: It has two options:
  • Node: It finds the value of the XML node path provided above. It is elected by default.
  • Attribute: It specifies the attribute value with a specified key. If the user selects the Attribute option, he/she needs to specify the attribute key.  

After selecting any one of the above, we can add Selection Criteria.  When the user clicks on Add Selection Criteria, a Where clause is added. User can select either node or attribute with value and Value with key respectively. User can add multiple conditions according to their requirement.

 

Advanced

The user will get the following fields in Advanced:

Figure 68: Advanced- XML Parameter
    • Occurrence Count (Ord): It provides the number of times the searched string appears on the answer document (within the defined left and right boundary). It comes in handy when the same left and right boundaries occur on a response page several times. Users can select any one of the following as per the requirement from the drop-down:
    • Index: In Index, the user can select any particular occurrence from the list of Index. For eg- if there are 10 occurrences of patterns, then you can select the 5th or sixth one from the index file.
    • All:It specifies to collect all occurrences of patterns between left and right boundaries. In this case, the svar_count variable contains the count of occurrences. svar_1 contains the first occurrence; svar_2 contains seconds and so on.
    • Any: It specifies, that any one of the matched patterns is selected and stored in svar.
    • Last: In this, the last matched occurrence is selected. For eg- if there are 15 occurrences, then the 15th one will be selected.

    After selecting one of the above options, we have the following checkbox:

    • Conversion: It is used to encode the search pattern. You will get the following option:
    • HTMLToURL: Converts HTML-encoded data to a URL-encoded data format. Here, HTML to URL conversion means text to URL conversion i.e. URL encoding.
    • UrlToHtml: Converts URL-encoded data into HTML encoded data.
    • HtmlToText: Convert HTML-encoded data into plain data. (called HTML-decoding. Example- HTML-encoded data: <03/01/1987>

    After conversion into plain data: <03/01/1987>

    • TextToUrl: Converts plain text data into URL-encoded data. (called URL – encoding) Example- plain HTML data: <03/01/1987>

    After conversion into URL encoded data: %26lt%3B03%2F01%2F1987%26gt%3B

    • UrlToText: Converts URL-encoded data into plain text data. It is just the reverse of TextToUrl (called URL-decoding).
    • TextToBase64: Converts plain text data into base64-encoded data.

    Example: Plain HTML data: <03/01/1987>

    After conversion into base64 encoded data: ICAmbHQ7MDMvMDEvMTk4NyZndDsgIA==

    • Base64ToText: Converts base64-encoded data into plain text.
    • Redirection Depth: If RedirectionDepth=Lastis specified and the server response is redirection information (HTTP status code 300-303, 307), then the response is not searched. Instead, after receiving a redirection response, the GET request is sent to the redirected location and the search is performed on the response from that location. This attribute is optional. Empty RedirectionDepth is not allowed. Default value is 
    • Last: If this option is chosen, Load Test searches on the last redirection.
    • Numerals ranging 1-32: Load Test searches only up to the depth which is equal to the numeral selected.
    • All: Load test searches till the last redirection depth.
    • Action On Not Found: It is the handling option when a boundary is not found and an empty string is generated.
    • Error causes an error to be raised when a boundary is not found and stops the search.
    • Warningdoes not issue an error. If the boundary is not found, it sets the parameter count to 0, and continues executing the script. The “warning” option is ideal to see if the string was found, but do not want the script to fail.
    • Encoding Option: Encoding is used to encode special characters to their ASCII value. Users can encode any number of special characters i.e. all, specific, or none. Users can have the following options:
    • Encode all special characters except (+), (-), (.), (_):All special symbols except + – . _ are encoded. It is the default value.
    • Encode only specified characters:The user can specify which special characters to encode in Characters to encode
    • Do not encode special characters:None of the special characters is encoded. However, space is encoded always.
    • Encode Space By:This option specifies to Load Test how to encode Space. User can have two options: ‘+’ or ‘%20’. If ‘+’ is chosen, Load Test encodes Space by ‘+’ and if ‘%20’ is chosen, Load Test encodes Space by ‘%20’. The default value is ‘+’.

     

    Index Dataset Using File

    Index Dataset Using File is same as File Parameter. The only difference is that it identifies how data is selected from the data file. The first column is considered as the index of that file and the second column will be the value. The user passes the index value in Index File Parameter and the corresponding value will be picked as the parameter value.

Figure 69: Index Dataset Using File

Adding The Parameter

The following fields need to be filled to add the Index Dataset Using File Parameter:

  • Parameter Name:This field is used to set the name of the parameter, which is used in the parameterization of the script. It is a mandatory field.
  • Parameter Type(s) (only in case of Advance Settings):Select the following from the drop-down as per requirement:
    • Parameter Type Value:The value from the data file is treated as the file parameter value.
    • Parameter Type File:The value from the data file is treated as a new file path and content from that file is treated as the value.
    • Parameter Type File_Param:The value from the data file is treated as a file path and the content from that file is treated as a parameter whose value is treated as the parameter value.
  • Directory:This field contains the list of data directories present. By default, the script name is selected.
  • File Name:It is the name of the data file in which all data related to parameterization is stored. It can be an individual name of the file and it can be an absolute path for that file.
  • File Data:This section is to view, add and modify data of the file.
  • First Data Row:In some situations, the user might want the Load Test to start reading data from a particular line number. So, the user can use this field to indicate Load Test which lines it should consider as the first data row. By default, the first data row is 1.
  • Column Delimiter:This field specifies which character in the data file should be considered as a column separator. By default, the column delimiter is ‘,’. Users can also use special symbols as the column delimiter.
  • Index Variable:Select any parameter from the dropdown list available for indexing.

Advanced

In Advanced, we have the following fields to be filled:

Figure 70: Advanced- Index Dataset Using File
  • Encoding Options: This option is used to encode special characters to their ASCII value. This option contains the following fields:
  • Encode:In Load Test, the user can encode any number of special characters i.e. all, specific, or none. Users can have the following options:
  • Encode all special characters except (+), (-), (.), (_):All special symbols except + – . _ are encoded. It is the default value.
  • Encode only specified characters:The user can specify which special characters to encode in Characters to encode
  • Do not encode special characters:None of the special characters is encoded. However, space is encoded always.
  • Characters to encode:If the user selects Encode only specified characters’ option in Encode, then this field becomes active. Here user can specify which special characters should be encoded.
  • Encode Space by:This option specifies to Load Test how to encode space. Users can have two options: ‘+’ and ‘%20’. If ‘+’ is chosen, Load Test encodes space by ‘+’ and if ‘%20’ is chosen, Load Test encodes space by ‘%20. The default value is ‘+’.

Notes:

  • Data directory can be overridden from the scenario only if you are using a data directory other than the script.
  • You can edit data files upto 10 MB. For more than 10 mb it will open as Read Only mode.

DateTime Parameter

Date Time Parameter is used to generate the current system Date/Time value. Users can add offset to the current date and set the format of displaying the date.

Figure 71: DateTime Parameter

Adding Date Time Parameter

The following fields need to be filled in to add the Date Time Parameter:

  • Name:This field is used to set the name of the Parameter, which is used in the parameterization of the script with curly braces { } . Parameter name can be any alphanumeric string that stores the value of date.
  • Format:This field is used to specify the format to be used to display the date. There are various inbuilt formats like YYYY-MM-DD. User can also create a custom format. To do so, user can specify the required format in the textbox adjacent to the Format drop down menu. 
  • Expected Date/Time:This textbox displays the expected date as per the format selected by the user.

Advanced

In advanced, you will see the following fields which need to be filled:

Figure 72: Advanced- DateTime Parameter
  • Fixed Offset:To increase the current date/time by a certain value, use this option. User can offset by the number of days, hours, minutes, and seconds. By default, offset is zero i.e., current date and time.
  • Random Offset:Enables you to specify a range of random offset values. For example, if you need your parcel to be delivered on some specific date, you can specify the delivery date between 10- 15 days of offset. The date will always pick a random offset value with 10 to 15 days offset.
  • Day Type: User can have the following options:
  • All Days: If this option is selected, then it displays the date calculated as it is. It does not modify the date any further.
  • Working Days: If the user selects this option, then Load Test finds the closest working day for the date calculated so far. This means, if the calculated date falls on a working day then Load Test does nothing. But if the calculated date falls on a non-working day (Saturday or Sunday), Load Test finds the nearest working day.
  • Non-Working Days: It identifies whether the calculated date is a non-working day or not. If yes, it does nothing. Otherwise, it offsets to the nearest non-working day in the same manner as the working day is offset.
  • Updated Value On: By using this field, the user indicates Load Test when to pick a new data value i.e. generated once and use this generated value for the entire session, or pick a new data value every time while Date Time Parameter is used. Users can have the following options:
  • Session: If Session is selected, date/time is generated only for the first use of Date Time Parameter. Then for the entire script, the same value is used.
  • Use: If the Use option is selected, the date is generated from the data file for every use of the Date Time Parameter. For example, if the user is using the Date Time Parameter 50 times in the script, then for every reference, a new data value is picked.
  • Unique for each session:If this checkbox is selected, it generates a unique date/time across all the NVMs and all the users.

 

 

Random String Parameter

Random String parameter is used to generate a random string of characters with a random length.

Figure 73: Random String Parameter

Adding Random String Parameter

The following fields need to be filled to add the Random String Parameter:

  • Parameter Details
  • Name:This field is used to define the name of the variable associated with the current parameter. Valid parameter names can have only alphabets and underscore (_).
  • Character Set:Define the character set from which Load Test generates a random string. Users can use a-z, A-Z, and 0-9 and their sub-sets. Their combination can also be used e.g. b-e1-3. In this case, the string generated is from b, c, d, e, 1, 2, and 3 characters only
  • Minimum:Specify the minimum length of the string. It can range from 0-10,000.
  • Maximum:Specify the maximum length of the string. It can range from 1-1,000,000.
  • Sample Output:Once we fill the above fields, the sample output is automatically populated based on the details.

Advanced

Figure 74: Advanced- Random String
  • Updated Value On: This field is used to indicate Load Test when to generate a new string i.e. generate once and use this value for the entire session, or, generate a string every time Random String Parameter is used. Users can have the following option:
  • Session:Random string is generated only for the first use of the Random String Parameter. Then, for the entire script, the same value is used.
  • Use: Random string is generated for each use of the Random String Parameter. For example, if the Random String parameter is used 50 times in the script, then for every reference, a new random string is generated.

Random Number Parameter

Random Number Parameter is used to generate a random number within a specified range.

Figure 75: Random Number Parameter

Adding Random Number Parameter

The following fields need to be filled to add the Random Number Parameter:

  • Parameter name:This field is used to set the name of the parameter, which is used in the parameterization of the script with curly braces { } .
  • Minimum:Specify the minimum number below which a random number should not be generated. It can range from 0-10,000.
  • Maximum:Specify the maximum number above which a random number should not be generated. It can range from 1-1,000,000.
  • Minimum Length:It is the minimum length of the digit of the number which we want to generate.
  • Sample Output:It is the sample output as per the details filled in the above fields.

Advanced

In Advanced you have the following fields to be filled:

Figure 76: Advanced-Random Number
  • Updated Value On:
  • Session:Random number is generated only for the first use of the Random Number Parameter. Then for the entire script, the same value is used.
  • Use:Random number is generated for each use of the Random Number Parameter. For example, if the user uses this 50 times in the script, then for every reference, a new random number is generated.
  • Number System: In the number system, you have the following option:
  • Octal (0-8)
  • Decimal (0-9)
  • Hexadecimal (0-9, A-F)

By default, the number system selected is ‘Decimal’.

Unique Number Parameter

The unique number parameter is used to generate unique numbers across all of the users. The unique number is generated from 16121217 and sequentially 1 is added.

Figure 77: Unique Number

Adding Unique Number Parameter

There are the following fields that need to be filled to add a Unique Number Parameter:

  • Parameter Name:This field is used to define the name of the variable associated with the current parameter. Valid parameter name can have only the alphabets and _.
  • Minimum Length:If the user wants to specify the minimum length of the number generated or the minimum number of digits, he/she can specify it here.
  • Update Value On: This field is used to indicate Load Test when to generate a new number i.e. generate once and use this value for the entire session, or, generate a number every time Unique Number Parameter is used. Users can have the following options:
  • Session:Unique Range is generated only for the first use of the Unique Range Parameter. Then for the entire script, the same value is used.
  • Use:Unique Range is generated for each use of the Unique Range Parameter. For example, if the user uses this 50 times in the script, then for every reference, a new Unique Range is generated.
  • Sample Output:It will show some sample output of that parameter according to the fields filled above.

Scratch Array Parameter

Scratch Array parameter formerly called Declare Array Parameter is used to declare a variable and its size. Sometimes multiple declare parameters are required to store multiple parameter values. So for this, declare array parameter is used. If the user needs multiple declare variable to store some temporary data during the session, then it can take single declare array with a given length (equal to the required number of declare variable). User can also set a default value for Scratch array.

Figure 78: Scratch Array Parameter

Adding The Scratch Array Parameter

The following fields need to be filled to add scratch array parameter in the scripts:

  • Parameter name:It is the unique name of this parameter. The Parameter name must start with an alphabet. It is used in the parameterization of the script with curly braces { }.
  • Array Size:It is the size of the array. (if n is the size of the array then it can store n values means it can replace n number of declare array) By default, the size is set as “1”. For example, if there are elements such as 0,1,2,3,4, its array size is 5.
  • Default Value: If the user gives a default value then the Scratch array will be initialized by this value. User can set scratch array parameter values using ns_eval_string.

JSON Parameter

JSON or JavaScript Object Notation is an open standard format that uses human-readable text to transmit data objects consisting of “attribute”: “value” pairs. It is used primarily to transmit data between a server and web application, as an alternative to XML.

Figure 79: JSON Parameter

Adding JSON Parameter

The following fields need to be filled to add JSON Parameter:

  • Parameter Details
  • Parameter Name:This field is used to set the name of the parameter, which is used in the parameterization of the script with curly braces { } . It is a mandatory field.
  • Object Path:This specifies the full path of the node value the user needs to be fetched. For example, if the user needs to get the value of node email which is under root, then Object Path should be “root.email”.
  • Pages: If All Pagesis selected, Load Test searches for the specified pattern in all the pages, starting from the first page. If Specified is selected then Load Test searches for the pattern only in the selected and specified pages.
  • Occurrence Count: It is required if multiple occurrences are found of a specified node. The user has four options for this.
  • Index: By selecting this, the user can define which index of occurrence needs to pick.
  • All: If the user selects this option then the system takes all occurrences of the specified node.
  • Any: It takes randomly any one occurrence out of all.
  • Last: It takes the Last occurrence.

Advanced

Figure 80: Advanced- JSON Parameter
  • Start Offset:This is required if only part of the delimited value needs to be assigned to the parameter. It defines the starting position of the portion, which needs to be extracted. (0 indicates the first character, 1 indicates the second, and so on) The offset value must be non-negative.

From the beginning: Check this box if you need the offset from the beginning.

  • Maximum Length:This is the length of a sub-string of the found value, from the specified offset, to search in the parameter. The default is 0, indicating until the end of the string.

Till the end: Check this box if the Maximum Length is till the end.

  • Action On Not Found: If the pattern, for which Load Test is searching, is not found, then the user can make Load Test behave in the following ways:
  • Warning:If this option is used and the pattern for which Load Test is searching is not found, then Load Test displays an error message in event.log and continues its operation.
  • Error:If this option is used and the pattern, for which Load Test is searching is not found, then Load Test displays CVFail in progress.report and event.log and terminates further processing.
  • Conversion: This option is used to encode search patterns. It has following options:
  • None:In this option, no encoding is applied.
  • HTMLToURL:It converts HTML-encoded data to a URL-encoded data.
  • HTMLToText:It converts HTML-encoded data to plain text format.
  • TextToUrl:It converts TEXT-encoded data to URL format.
  • UrlToText:It converts URL-encoded data to plain text format.
  • UrlToHtml:It converts URL-encoded data to HTML text format.
  • TextToBase64:It converts Text data to Base64 format.
  • Base64ToText:It converts Base64 data to Text format.
  • Redirection Depth:If the page, on which Load Test is searching the pattern, is moved to some other location, then this option is used. It specifies how many moved locations Load Test is supposed to search for the pattern i.e. up to what redirection depth Load Test searches the pattern.
  • Encoding Option
  • Encode only Specified Character:
    • Specify the characters to encode in the ‘Character to Encode’ box.
    • Mention how to encode the space either by ‘+’ or ‘%20’.
  • Encode all special characters except (+) (-) (.) and (_):All the special characters are encoded except (+) (-) (.) and (_).
  • Do not encode Special Character:Special characters are not encoded on selecting this option.

Note: JSON path should start with “root.”.

Unique Range Parameter

Unique Range Parameter is used to generate a unique range for numbers across all of the users.

Figure 81: Unique Range Parameter

Adding Unique Range Parameter

  • Parameter Name:Parameter name can be any alphanumeric string that stores the value of a unique number for a range.
  • Start Range: This is the starting value of a unique number from where the first user will start using it.
  • User Block Size:The block size indicates the range of the block of numbers assigned to each Vuser. e.g. If the start range is 1 and User Block Size is 10 the first Vuser will use 1-10, the 2nd Vuser will use 11 -20, and so on.
  • Minimum Length:Specify the length of the number generated. If the length of the number generated is less than the specified length, then it is left padded with zeros.
  • Update Value On:Specifies when to generate a new number i.e. generate once and use this value for the entire session, or, generate a number every time Unique Range Parameter is used. Users can have the following options:
  • Session:Unique Range is generated only for the first use of the Unique Range Parameter. Then for the entire script, the same value is used.
  • Use:Unique Range is generated for each use of the Unique Range Parameter. For example, if the user uses this 50 times in the script, then for every reference, a new Unique Range is generated.
  • Action On Range Exceed:It states the action to be performed when the unique range exceeds the block size. Actions are as follows: –
  • Continue with last value:It means when the unique number range gets exhausted then for the next session Vuser would continue with the last value used.
  • Repeat the range from start:It means when the unique number range gets exhausted then for the next session Vuser would repeat the unique number from start.
  • Fail Session:It means when the unique number range gets exhausted then the session would be marked as failed.
  • Stop Test:It means when the unique number range gets exhausted then the test should be stopped.

Dataset Using Query Parameter

Dataset using query parameter is used where the user wants to fetch response from a database using query and use the value using this parameter.

Figure 82: Dataset Using Query Parameter

Adding The Parameter

The following fields need to be filled to add Dataset Using Query Parameter:

  • Query: Query is a question which is communicated formally. It can either be aselect query or an action query, for e.g. select name, price, size, id from items_table where skuid=S80 and price >= 1000.
  • Parameter Name: This field is used to set the name of the Parameter, which is used in the parameterization of the script with curly braces {}. It is a mandatory field.

For example:sid,browserplugins,bpcompleted,bpabandoned,channel,trnum.

  • HostIt is the host name for the database.
  • Port: It is the listening port/default port for SQL Server.
  • Username: The username of the database.
  • Password: The password for a particular user.
  • Database: The name of the databases of DSN such as Postgres, MySQL, Oracle, and SQL Server.
  • Driver: A database driver is a computer program that implements a protocol (ODBC or JDBC) for a database connection.

Once all the above fields are filled, click the Test DB Connection button to test the connectivity with database.

Advanced

Click the icon  to see the fields in the advanced option.

Figure 83: Advanced- Dataset using Query Parameter
  • Save To File: There can be situations when the user might want to save this data in the file. For such situations, this checkbox comes into the picture.

Once you check this box following fields appear:

  • Data File:Enter the data file location in this field.
  • First Data Row:In some situations, the user might want the Load Test to start reading data from a particular line number. So, the user can use this field to indicate Load Test which lines it should consider as the first Data row.
  • Column Delimiter:This field specifies which character in the data file should be considered as a column separator. By default, the column delimiter is ‘,’. Users can also use special symbols as the column delimiter.
  • Selection Mode: Any data file can contain various numbers of rows. How Load Test know which row to pick from these rows? For this, users can have various methods for Row Selection:
  • Sequential:This method selects rows sequentially i.e. the first row, then the second row, then the third row, and so on. It is selected by default.
  • Random:This method selects rows randomly. When enabled, Load Test can pick any row from the data file.
  • Weighted Random:This method randomly selects a row based on a weight value. When used, the first column of the data file is treated as weight.
  • Unique:This method selects a row from the data file uniquely i.e. for all the sessions running currently, one data value is used only once.
  • Use Once:This method uses one data value only once. Once a data value is used, it is deleted from the data file. Each deleted value is written in a separate data file with extension .used.
  • Updated Value on: This field is used to specify when to pick a new data value i.e. generate once and use this value for the entire session, or, pick a new data value every time File Parameter is used. Users can have two options:
  • Session:If Session is selected, data is picked only for the first use of File Parameter. Then, for the entire script, the same value is used.
  • Use:If Use is selected, data is picked from the data file for each use of File Parameter i.e. if File Parameter is used, for example, 50 times in the script, then for every reference, the new data value is picked.
  • NewVuser: In this data is picked up for new user.
  • Encoding Options: This option is used to encode special characters to their ASCII value. This option contains 3 fields:
  • EncodeIn Load Test, the user can encode any number of special characters i.e. all, specific, or none. Users can have the following options:
  • Encode all special characters except (+), (-), (.), (_):All special symbols except + – . _ are encoded. It is the default value.
  • Encode only specified characters:The user can specify which special characters to encode in the Characters to encode
  • Do not encode special characters:None of the special characters is encoded. However, space is encoded always.
  • Characters to encodeIf the user selects Encode only specified charactersoption in Encode, then this field becomes active. Here user can specify which special characters should be encoded.
  • Encode Space By:This option specifies to Load Test how to encode Space. Users can have two options: ‘+’ and ‘%20’. If ‘+’ is chosen, Load Test encodes Space by ‘+’ and if ‘%20’ is chosen, Load Test encodes Space by ‘%20 The default value is ‘+’.
  • Copy File to Test Run: Check this box if you want to copy the file in the Test Run.

Assertion

Assertions are used to verify the expected page content. It is needed to make sure that the requested page has loaded correctly. If an HTTP request completes successfully with HTTP OK code, it does not necessarily mean that the page contents have loaded successfully. For example, log in to a web application may fail and a failed login message may be displayed back. From an HTTP perspective, the page would be successful but from an application point of view, a page hit may be considered a failure. A successful login may be verified by checking the received page response. The presence or absence of a certain text string or text pattern may signify the success or failure of the page.

In the Assertions tab, you can apply assertions on the created transactions to verify the expected result with the actual result. You can also ensure that the requested page has loaded correctly.

Adding Assertion

To add an Assertion, you have the following fields to be filled:

Figure 84: Adding Assertion
  • Select the page(s)from the dropdown on which the assertion is to be applied.
  • Assert: The Assertdropdown list displays the following option. The fields are dynamic and depend upon the option selected from the dropdown list:
  • Content: On selecting Content, you will get the following options in the corresponding dropdown list:
  • Body- Content will be searched in the response body.
  • Header- Content will be searched in the response header.
  • Both- Content will be searched in both response body and response header

After selecting the content to be checked, we need to choose how the user wants to search for the content.

For that we have the following option:

  • specific text

OR

  • From mentioned the start and the end string.
  • Regular Expression: In the case of Regular expression, any special character in the text will be taken as Regular expression.
  • Ignore Case:Enable the checkbox to make the provided text non-case sensitive.
  • Complete response from a file: If you selectComplete response from a file in Check, you have to choose the file in the file field.
  • Checksum: If you selectChecksum in Assert, then you have to choose whether you want to check with Checksum or with Cookie.
  • Checksum: Here user gives a checksum value which has to be compared with a checksum of response.
  • Cookie:Here user specifies the cookie name which has to be compared with the Checksum of response.
  • Failure Condition: There are two failureconditions on the basis of which action will be taken:
  • Match text not found: It means that the assertion would fail if the text string or pattern were not found in the received response. If the FAIL argument is not specified, it is assumed to be NOTFOUND.
  • Match text found: It means that the assertion would fail if the text string or pattern were found in the received response.
  • Actions on failure: Based on the above failure conditions following, you have the following actionoptions:
  • Stop Session: If the string that the user is searching for is not found, then Load Test displays CVFail in progress. report and event.log and stop the session.
  • Continue Session: If the string that the user is searching for is not found, then Load Test continues its operation and the warning message will be logged in the event.log file.

Once the above failure and its action are selected, you have to type the failure message which can be seen when the failure condition is satisfied.

  • Save Occurrence count in Scratch Parameter: If you want to utilize assertion as a count parameter, then disable the checkbox for the failure condition and use the save count as a scratch parameter.

From the assertion list, the user can make changes to a particular assertion by clicking the edit   or delete icon as per the requirement.

 

API

APIs provide users to enhance test scripts. LoadTest allows user to use its own inbuilt APIs written in C and Java also called as LoadTest functions. These APIs can further be divided into categories and sub categories depending upon the usage and functionalities.

To access API, click on API option on Script Editor page as shown in below figure.

Figure 85: API Option

Below are some highly used C APIs

C-APIs list

1

ns_save_string()

To save a null terminated string to a ns variable.

2

ns_eval_string()

To evaluate the string representation of the ns variable.

3

ns_log_msg()

Helps to log message from script, with format specifier to test run directory.

4

ns_log_string()

To log a simple string from script to test run directory.

5

ns_get_ua_string()

Returns the user agent string

6

ns_set_ua_string()

Used to set the user agent string.

7

ns_get_pg_think_time()

Returns the page think time in milliseconds.

8

ns_page_think_time()

Sets the page think time for ctype scripts. Accepts value in double.

9

ns_encode_url()

Escapes URL strings (Converts all letters considered illegal in their %XX values).

10

ns_decode_url()

It un-escapes all URL encoding to string representation.

11

ns_paramarr_len()

Returns the length of the search parameter array

12

ns_paramarr_idx()

Returns value of search parameter array at a particular index.

13

ns_paramarr_random()

Returns a random value from the search parameter array.

14

ns_get_int_val()

Returns the integer value of a ns variable

15

ns_set_int_val()

Sets a ns variable to an integer value.

16

ns_encode_save_string()

Encodes a string and saves it to a ns variable.

17

ns_encode_eval_string()

This further encodes the evaluated string.

18

ns_url_get_http_status_code()

Returns the HTTP status code. Ex 200, or 404

19

ns_url_get_body_msg()

Returns the whole body part of the URL.

20

ns_url_get_body_size()

Returns the size of body in bytes.

21

ns_url_get_resp_msg()

Returns the response message of the URL

22

ns_get_redirect_url()

Returns the url to which the main URL is redirected.

23

ns_is_rampdown_user()

Returns 0 if user is ramped down and 1 if user is not ramped down.

24

ns_save_data_var()

Saves LoadTest variable value to a data file.

25

ns_save_data_ex()

Saves data as per the given format in the data file

26

ns_save_data_eval()

Saves data as per the given eval string in the data file.

27

ns_set_cookies_disallowed()

Sets disallowed cookies flag

28

ns_get_cookies_disallowed()

Gets disallowed cookies flag

29

ns_get_auto_cookie_mode()

Returns the mode value. It can be 0,1,2,3,4

30

ns_add_cookie_val_ex()

Sets the value of the cookie.

31

ns_get_cookie_val_ex()

Returns pointer to a cookie value populated in a static buffer or NULL if cookie name is not found

32

ns_get_cookie_idx()

Gets cookies Idx from its name.

33

ns_get_cookie_val()

Returns Pointer to cookie value populated in a static buffer or NULL if cookie name is not found.

34

ns_set_cookie_val()

Set the cookie value using hash code.

35

ns_advance_param()

Advances to the next available value in the file parameter.

36

ns_get_max_ka()

Returns the maximum num_ka used by the LoadTest at the time of calling this API.

37

ns_get_min_ka()

Returns the minimum num_ka used by the LoadTest at the time of calling this API.

38

ns_get_num_ka_pct()

Return the keep alive percentage used by the LoadTest at the time of calling this API

39

ns_set_ip_address()

Sets the local IP address.

40

ns_get_user_ip()

Returns the user IP.

41

ns_get_area_ip()

Takes area ID and returns IP in integer format.

42

ns_get_area_ip_char()

Same as above but outputs in AAA.BBB.CCC.DDD format

43

ns_get_session_status()

Returns the status of the session in string format

44

ns_get_sessid()

Returns the session id of each session if multiple sessions are being used while running test.

45

ns_get_test_id()

Returns the test run no of current test.

46

ns_get_guid()

Returns the global unique ID.

47

ns_get_nvmid()

Returns the LoadTest Virtual ID

48

ns_param_sprintf()

Writes formatted string to a LoadTest variable.

49

ns_set_embd_objects

Sets embedded url or objects for a main URL. Takes first argument as number of embedded URL’s and second one is list of embedded URL’s to set in page.

50

do_shmget()

Creates a shared memory and returns the start address that can be type casted to other type.

51

ns_get_status_name

Takes status as argument and returns URL,Page and Transaction status string.

52

ns_encode_decode_url_free()

Used to de-allocation in the same unit that did the allocation.

53

ns_add_user_data_point()

Used to set graph data value of user monitor.

54

ns_check_response_size()

Used to compare the response size with user-defined value1 and value2.

Return values are:-

0-On success if the response size is as per mode.

1-If response/reply size is small

2-If response/reply size is big

-1 On error.

55

ns_get_num_nvm()

Returns the no of process in LoadTest execution(NVM-LoadTest Virtual Machine )

56

ns_url_get_resp_size()

Returns the size of the response (bytes of body received or bytes of chunks).

Returns -1 on error.

57

ns_get_session_status_name()

Takes status as string and returns in char string like MiscErr.

58

ns_get_userid()

Returns the id of the user executing the script.

59

ns_ip_to_char()

Takes int as argument and returns IP in dotted decimal notation.

 

Right Pane

Right pane mainly consists of scripts of corresponding script structure.

Figure 86: Scripts

Right Click Advanced Options

Right Click Options in Script Management enable a user to perform some specific actions on scripts and its recorded pages. In NetStorm Script Management, user can have the following right click options:

  • Convert to Body
  • Convert to ItemData
  • Auto Correlation
  • Revert to Auto Correlate
  • Encrypt Selected Text
  • Repeatable Block
  • Split Page
  • Merge Page
  • Delete Page
  • Replace with Parameter

Convert to Body

It is used to convert the Item data in to Body Begin. To use this, select the Item data, right-click > Convert to Body option.

Figure 87: Convert To Body Selection

The item data is converted to Body Begin as shown below:

Figure 88: Converted to Body Page

Convert to Item Data

 It is used to collect all of the name|value pair data from any previous requests and pair them with your foundation skills in C to dynamically build the string that you need to populate the web_custom_request (). Select the text (within the Body begin section), right-click the script file and select the Convert to ItemData option.

Figure 89: Convert To ItemData Selection

The section is converted to ItemData as shown below:

Figure 90:Section Converted to Item Data Page

Auto Correlation

Auto Correlation feature is used to fetch the correlated data from executed pages. Executed pages are those pages that have the correlated data of their sequence of occurrence before that page.

  • All auto-correlated page name is displayed in the Page Name combo box.
  • All URL of selected page name are shown in the page URL combo box.
  • All dump path name of selected URL is shown in the dump file.
  • Name Combo Box when user selects the dump file path of URL.
  • Then it goes on the server and fetch the data of that dump file path which is selected in the dump file combo in GUI.
  • The text which is used for autocorrelation is highlighted in the text area using red color.
Auto Correlation Usage
  1. Open Script Manager window and select a script and open flow file.
  2. Select the dynamic content, right-click on the selected text, and click the Auto Correlate Example: session id, product id.
Figure 91: Auto Correlate Selection

3. This displays the Auto Correlation dialog box.

Figure 92: Auto Correlate Dialog Box
  1. User needs to input the following details:
  • Parameter Name: Parameter Name is the name of search parameter name.
  • Left Boundary: Left boundary is the left side text of highlight text which is in the text area.
  • Right Boundary: Right boundary is the right side text of highlight text which is in the text area.
  • Page Name: Page name is showing all correlated page names in drop-down list.
  • Page URL: Page URL combo show the all URLs of related page which is shown in the Page combo. box
  • Dump File: Dump file name combo show the all dump file path of URLs.
  • Set LB: Set LB button is used to set the selected text in left boundary text field.
  • Set RB: Set RB button is used to set the selected text in Right boundary text field.
  • First: It is used to find first highlighted text.
  • Last: It is used to find last highlighted text.
  • Next button: Next button is used to find the next highlighted text.
  • Prev button: Prev button is used to find the previously highlighted text at first time the button is disabled.
  • Text Area: Text area show the dump file content of related URL.
  • Test: This button is used to find all values between LB and RB.

Following options of Auto Correlation have already been covered in Search Parameter section.

  • Occurrence Count
  • Save Offset
  • Save Length
  • Conversion
  • Search in Search
  • Redirection
  • Encoding Option
  1. After clicking on OK button, Search Philadelphia gets added to spec file.
Figure 93: Adding Auto Correlate

6. API Added in spec file:

nsl_search_var(autovar, PAGE=index_html, LB=”userSession value=”, RB=”>”, SaveOffset =0, RETAINPREVALUE=”YES”, EncodeMode=None);

Figure 94: Adding API

Revert Auto Correlate

A user can revert an auto correlated string (selected text including curly braces) by clicking the Revert Auto Correlate option.

Figure 95: Revert Auto Correlate Selection

There are two options for reverting:

  1. Replace: On clicking Replace, the original string is replaced with the selected auto-correlated string for only one occurrence.
  2. Replace All: On clicking Replace All, the original string is replaced with the selected auto-correlated string for all occurrences.
Figure 96: Revert Auto Correlate Dialog Box

Encrypt Selected Text

We have provided a feature to encode and decode sensitive data in script like user name and password. While the script will be executed, the encoded text will be decoded first then it will execute. Users can use the parameter instead of the encrypted text, but the parameter name should be designed with an encrypted tag in parameterization GUI.

Select the text to encrypt, right-click and go to Encrypt Selected Text option.

Figure 97: Encrypt Selected Text

This displays a pop-up where encoding details are displayed for text.

Figure 98: Encrypt Window

Clicking the replace button will replace the selected text with the encoded one.

Repeatable Block

In repeatable block, blocks can be repeated based on certain parameters. The parameters can be:

  • Count the parameters
  • Value of the parameter and
  • Constant value provided by user
  • Count: If the parameter is search parameter and if it is ord all, and its occurrence is 4, then 4 times the block of text can be repeated.
  • Value: If the value of given parameter defined in spec file has value 3, then 3 times the block of text can be repeated.
  • Num: If the value provided by the user is 10, then block of text can be repeated 10 times.
  • The block which user is going to repeat can be a constant string, variable or combination of constant string and variable.
  • Nested (Repeat block inside repeat block) repeatable block can be used.
Repeatable Block Format

{$CAVREPEAT_BLOCK_START,sep(<char>),Count(<parameter_name)} String{$CAVREPEAT_BLOCK_END}

Where:

  • $CAVREPEAT_BLOCK_START: Start of repeat block.
  • sep: Separator is used to separate the block which is repeating. Users can give any character in separator. Example: , | & etc. Default value of separator is no separator. Separator is optional. Separator is in double quotes so that string or a char can be given. String can be combination of all char.
  • Count: Count is used to specify that user is going to repeat the block on the number of occurrence of the parameter. Parameter name is specified inside count. Parameter which has specified ALL in its ORD option is only allowed inside count. These can be search parameter and XML parameter.
  • If someone specifies parameter having ORD other than ALL, parsing error comes.
  • String: String is the block which user wants to repeat. This can be a constant string, variable or a combination of both.
  • $CAVREPEAT_BLOCK_END: It indicates the end of repeatable block.

 

{$CAVREPEAT_BLOCK_START,sep(<char>),Value(<parameter_name>)} String{$CAVREPEAT_BLOCK_END}

Where:

  • Value: Value of a parameter can be used to repeat a block. The parameter that user wants to use to repeat is specified inside value(). User can use any parameter name inside value. If the parameter name specified inside value is not found in the list of parameters in script, then parsing error comes.

{$CAVREPEAT_BLOCK_START,sep(<char>),Num(<IntegerValue>)} String{$CAVREPEAT_BLOCK_END}

Where:

Num: Num is used to specify the number of times, a block of text needs to be repeated. It must be an integer value. This value must not be negative. Num value must not be 0. In case of negative value, parsing error appears.

Nested Repeatable Block Format

Nested repeatable block is also supported. Another repeat block can be specified inside repeat block. 100 levels of recursion are supported. Nested repeatable block format would be like:

{$CAVREPEAT_BLOCK_START, sep(<char>),Count(<parameter_name>){$CAVREPEAT_BLOCK_START,sep(<char>),Count(<parameter_name)} String{$CAVREPEAT_BLOCK_END}{$CAVREPEAT_BLOCK_END}

Repeatable Block for Request URL

Repeatable block can be used in request URL so that certain query parameter value can be repeated based on the condition. The format which is used for the repeatable block for requested URL is:

 ns_web_url (“Page1”, “URL=http://127.0.0.1/tours/index.html?{$CAVREPEAT_BLOCK_START, sep(&), Count(search_var)}name={query_var}{$CAVREPEAT_BLOCK_END} “);

Repeatable Block for Header

Repeatable block is supported in request header. The format which is used for the repeatable block for requested URL is:

ns_web_url (“Page1”,  “URL=http://127.0.0.1/ tours/index.html” “Header={$CAVREPEAT_BLOCK_START,sep(&), Count(search_var)}Accept-Language:en-IN{$CAVREPEAT_BLOCK_END} “);

Repeatable Block for Body

Repeatable block is supported in request body. The format which is used for the repeatable block for requested URL is:

ns_web_url (“Page1”, “URL=http://127.0.0.1/tours/index.html”,  “Header=Accept-Language: en-IN”,

 “BODY= {$CAVREPEAT_BLOCK_START,sep()Count(search_var)}<name>{search_var}</name>

{$CAVREPEAT_BLOCK_END} “, INLINE_URLS);

Repeatable Block Behavior for All Parameters

Random Number: For random repetition of a string, use random number in a repeatable block. Count case in repeatable block does not use random var as it is scalar variable. If random value comes 0, then string is not repeated.

Search Parameter: For search parameter, Count case in repeatable block supports search variable in ord all case. Value case in repeat block can use ord for all types.

XML Parameter: Same as search parameter.

Index Parameter: Only the value option in reparable block can use index parameter.

Declare parameter: Declare parameter can be used in repeatable block. Value case in repeatable block is used. Count can’t be used, as it is scalar variable.

Declare Array Parameter: Declare array can use count case in repeatable block. For value case, user needs to give index associated with declare array parameter.

File Parameter: If user needs string to be repeated based on file parameter value, user can use. Only value option repeatable block can be used for repeatable block.

Steps for Repeatable Block

User needs to follow the below-mentioned steps for using repeatable block feature:

  1. Open the c file of the script in the right pane of the Script Manager window and select the text block that wants to be repeated.
  2. Right-click over the selected text and click the Repeatable Block
Figure 99: Repeatable Block Selection

3. The Repeatable block dialog box is displayed.

Figure 100: Repeatable Dialog Box
  1. Select the Repeat Block from the available options – parameter count, parameter value, fixed number.
  2. Select the Parameter type from the list of available parameters.
  3. Select the block separator.
  4. Click the Apply button to execute the settings.

Inline URL Transaction

In this the transaction name is to be entered for Inline URL. To access this, click on any Inline URL and select the Inline URL transaction as shown in below figure.

Figure 101: Inline URL Transaction Option

Once you click, a new dialog box for Inline URL transaction opens.

Figure 102: Inline URL Transaction

Enter the transaction name and press OK. The said transaction name is added in the URL.

Repeat Inline URL

In this the selected parameter or count is repeated in Inline URL. To access this, click on any Inline URL and select the Repeat Inline URL as shown in below figure.

Figure 103: Repeat Inline URL Option

Once you click, a new dialog box of Repeat Inline URL opens.

Figure 104: Repeat Inline URL

Select any one of the parameter or count and mention it in the box provided below and press OK. The said parameter name or count is added in the URL.

Figure 105: Repeat added in URL

Comments

In this comment is added in the Inline URL. To access this, click on any Inline URL and select the Comments as shown in below figure

Figure 106: Comments

Once you click, a new dialog box of Comments opens.

Figure 107: Add Comments

Split Page

The Split Page utility is used to split any inline or embedded URLs from a main URL and makes it a separate main URL. There may be cases when some inline URLs need to be treated as main URL, hence this tool is useful for the same. Splitting of a page can happen within a flow itself and only inline URL can be splitted.

Steps to split a page

  1. Expand the Project, Subproject from the Left Pane.
  2. Select the script and then open flow file.
  3. Right click on any embedded URL inside the flow file and select Split Page
Figure 108: Split Page Selection

4. Provide a name for the page to be splitted.

Figure 109: Split Page

5. Click the OK button, a new page is created with the same name provided while splitting, containing the splitted page as main URL.

Figure 110: New Split Page

Merge Page 

The Merge Page utility is just the reverse of split page. In some cases, some extra pages may come after recording the scripts. In those cases, user might need to delete that page or a much better way is to merge the page with the page above it. Merging a page makes it the inline URL of the page above it. Merging can only happen for main URLs and the very first page in the script cannot be merged.

Steps to Merge a page:

  1. Expand the Project, Subproject from the Left Pane.
  2. Select the script and then open flow file.
  3. Right click on any main URL inside the flow file and select the Merge Page

As an example, user can merge the same page, which is splitted in the Split Page section.

Figure 111: Merge Page Option

4. An alert message pops-up for Confirmation. Click Yes.

Figure 112: Merge Confirmation

The page is merged to its previous page and appears in its inline URLs.

Delete Page

The Delete Page utility allows users to delete a page from scripts. In some cases, some extra pages may come after recording the scripts. In those cases, user might need to delete that page from the script. Deleting can only happen if the script has more than one page because script having only one page cannot be deleted.

Steps to Delete a page:

  1. Expand the Project, Subproject from the Left Pane.
  2. Select the script and then open flow file.
  3. Right click on any Page inside the flow file and select Delete Page
Figure 113: Delete Page Option

4. An alert message pops-up for Confirmation of page deletion.

Figure 114: Deletion Confirmation Message

5. Click the Yes The page is deleted from the script and a Confirmation Message is displayed.

Figure 115: Deletion Complete Message

Replace with Parameter

It is used when user want to replace the added parameter in flow.c for Parametrization. Let’s take an example:

Select any text which you want to replace with parameter. Then press right click and select replace with parameter.

Figure 116: Conversion to Flow.c

Select the text, right-click, and then select Replace with Parameter option. The following window is displayed:

Figure 117: Selection of Parameters

All added parameter list is displayed here. Select the parameter name, and click OK.

Figure 118: Parameter Name Selection

The parameter is replaced and a confirmation message is displayed.

The user can see the replaced parameter in the flow file.

Figure 119: Replace Parameter Marking