Parameterization

Parameterization is a technique to change the value of the variable at run time. It is achieved through the use of LoadTest variables. NS variables are like 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 registrations.spec file, right-click on the right pane, select Parameters, and click the desired parameter from the list of parameters.

Type of Parameters

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

Types of Parameters

  1. File Parameter (Dataset Using File)
  2. Search Parameter
  3. Declare Parameter (Scratch Parameter)
  4. Declare Array Parameter (Scratch Array)
  5. XML Parameter
  6. Index File Parameter (Index Dataset using File)
  7. Date Time Parameter
  8. Random String Parameter
  9. Random Number Parameter
  10. Unique Number Parameter
  11. Form Parameter
  12. JSON Parameters
  13. SQL Parameters (Dataset Using Query)

File Parameter ( Dataset Using File)

A file parameter, also known as a Static variable, is used to take values from a file created by the user. In the file parameter, define a parameter name and that parameter name can be used in the URL, Header, and Body.

File Parameter window

File Parameter Window

Description of Fields

  1. Select Datadir: It is the directory where the data is stored. By default, the parameter is the data directory.
  2. Parameter Name: This field is used to define the names of all the variables associated with the current parameter. They are like column names in a database.
  3. Index: In the File parameter window, Index shows the index no. of the parameter name. To add more than one parameter, click the More button.
  4. Encrypt: Select this check box to encrypt sensitive personal information, such as passwords in a file parameter.
  5. File Path on LoadTest Server: This is used to provide the option to browse the file path of the LoadTest server. Create a file browser that gets the name of directories and files for a specified path from the Server using servlet communication. If the user double-clicks on any directory, then it again communicates with the server and gets the directories and files for a new path.
  6. File Data: This section is to view, add and modify data of the file.
    • Table Format: If data is required in tabular format then select this check box.
    • Ignore Invalid Data: To ignore invalid data, select this check box.

7. Parameter Value: There can be situations when the user might want to load some column data from some other file. For such situations, this field comes into the picture. Here, the user specifies to LoadTest which column refers to data and which column refers file path.

8. First Data Line: In some situations, the user might want LoadTest to start reading data from a particular line number. So, the user can use this field to indicate LoadTest which line it should consider as the first Data Line. By default, the first Data Line is 2.

9. 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 column delimiters.

10. Update Value: 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, a new data value is picked.

11. Row Selection Mode: Any data file can contain various numbers of rows. How LoadTest knows 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, LoadTest 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 rows from the data files 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.

12. Save Last Used Row Id After This option becomes activated if the user has selected Use Once option in Row Selection Mode. This option is used to tune the performance of LoadTest. LoadTest is designed in such a way that if Use Once is chosen then the state of LoadTest at that moment is written in .last This data is written in the post-processing phase. If everything runs fine, then this file is deleted. Otherwise, the user can view the contents of the file. By default, LoadTest writes in this file for every data used. It can have two types of values:

      • Every Use: This option writes data in the .last file on each use of data.
      • Numerals in range 1-20: The numeral user chooses is the number of data used after data is written in .last

13. Encoding Options: This option is used to encode special characters to their ASCII value. This option contains 3 fields:

  • Encode: In LoadTest, 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 LoadTest how to encode Space. Users can have two options: ‘+’ and ‘%20’. If ‘+’ is chosen, LoadTest encodes Space by ‘+’ and if ‘%20’ is chosen, LoadTest encodes Space by ‘%20’.The default value is ‘+’.

14. Copy File to Test Run: If a user selects this option then the file used in the file parameter is copied into the Test Run directory.

Search Parameter

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

For better understanding, consider the following simple data flow between NetStorm (acting as a client) and NetOcean (acting as a server):

80

Search Parameter window

80.

Description of Fields

  1. Parameter Name: Parameter name is a ‘Search Parameter Variable Name’ which is used to access this parameter in the entire script. Parameter names can consist of the English alphabet and _. Any other character is not allowed.
  1. 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. 
  1. 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.
 1.1In LB and RB, use \n, \r, and \t for the new line, carriage return, and tab respectively. All other backslashes must be escaped using another backslash.
  1. Search text in page response: The user can specify on which response page he/she wants to search the string. It consists of two options:
    • All Pages: If this option is selected, LoadTest searches for the specified pattern in all the pages, starting from the first page.
    • Specified: If this option is selected then LoadTest searches for the pattern only in the selected, specified pages.
  1. Occurrence Count: When the data to be searched is present more than once at the response page(s), then the user can specify which occurrence should be picked by the LoadTest. By default, it is set to 1. This means it picks the first occurrence. There are the following options:
    • ALL: This option captures all occurrences of the pattern and saves them in the 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.
    • Numerals Ranging from 1 to 50: This option picks the occurrence of a specified pattern that is equal to the chosen numeral. For example, 3rd occurrence is picked if 3 is chosen.
  1. 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 first is RetainPreValue=Yese. Yes retain the previous search value and the second is RetainPreValue=No i.e. don’t retain the previous search value. The default is Yes.
  1. Start Offset: If the pattern searched by LoadTest is of length, say, 20 but suppose the requirement is to pick data from the 5th In this case, Start Offset can 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.
  1. 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 a 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.

  1. Action On Not Found: If the pattern, for which LoadTest is searching, is not found, then the user can make NetStorm behave in the following ways:
    • Warning: If this option is used and the pattern to which LoadTest is searching, is not found then LoadTest displays an error message in the log and continues its operation.
    • Error: If this option is used and the pattern, to which LoadTest is searching, is not found, then LoadTest displays CVFail in report and event.log and terminates further processing.
  1. Redirection Depth: If the page, on which LoadTest is searching the pattern, is moved to some other location, then this option is used. It specifies up to how many moved locations LoadTest is supposed to search for the pattern i.e. up to what redirection depth LoadTest searches the pattern. By default, if a page is moved, then LoadTest does not search on that page. There are the following options:
    • Last: If this option is chosen,LoadTest searches on the last redirection.
    • Numerals ranging from 1-32: LoadTest searches only up to the depth which is equal to the numeral selected.
  1. Search In: By applying ‘Search Parameter’, LoadTest searches in 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: If this option is selected, then LoadTest searches for the pattern in the response page.
    • Header: If this option is selected, then LoadTest searches for the pattern in the header.
    • Variable: If this option is selected, then automatically a list of all the variables declared in the script is displayed as a drop-down list. Select which variable to search in for the pattern.
  1. Encoding Options: This option is used to encode special characters to their ASCII value. This option contains 3 fields:
    • Encode: In LoadTest, user can encode any number of special characters i.e. all, specific or none. User can have following options:
      • Encode all special characters except (+), (-), (.), (_): All special symbols except + – . _ is encoded. It is the default value.
      • Encode only specified characters: User can specify which special characters to encode in Characters to encode field.
      • Do not encode special characters: None of the special characters is encoded. However, space is encoded always.
    • Characters to encode: If user selects Encode only specified characters option in Encode, then this field becomes active. Specify which special characters should be encoded.
    • Encode Space By: This option specifies how to encode Space. There are two options: ‘+’ and ‘%20’. If ‘+’ is chosen, LoadTest encodes Space by ‘+’ and if ‘%20’ is chosen, LoadTest encodes Space by ‘%20’. Default value is ‘+’.

Declare Parameter (Scratch Parameter)

Declare Parameter or Scratch 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.

Declare Parameter window

Figure: Declare Parameter

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

  • Parameter Name: Parameter Name is a ‘Declare Parameter Variable Name’ which is used to access this parameter in the entire script.
  • Default Value: If nothing comes in the declared parameter value then the default value comes in place of the parameter name in response.
  • 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.

Declare Array Parameters (Scratch Array)

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.

Declare Array Parameter window

82

Description of Fields

  1. Parameter Name: Unique name for this parameter. The parameter name must start with an Alphabet.
  1. Size: It is the size of the array.
  1. Default Value: If nothing comes in the declared parameter value then the default value comes in place of the parameter name in response.

XML Parameters

LoadTest 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 NS variable.

XML Parameter window

83

Description of Fields

  1. Parameter Name: It is the name of XML variable being defined. This is the only argument without an argument name.
  1. XML Node Path: It specifies the XML node.
  1. Select Pages for XML Parameter: User can specify that on which response page he/she wants to apply the XML parameter. It consists of two options:
    • All Pages: If this option is selected, LoadTest applies parameter in all the pages, starting form the first page.
    • Specified: If this option is selected then LoadTest applies parameter only in the selected, specified pages.
  1. Node Value: It is the value of the Node. It is selected by default.
  1. Attribute Value: It specifies the attribute value. If user selects the Attribute value option, he/she needs to specify the attribute value.
  1. Node Selection Criteria: Argument specifies the qualifiers/clauses. These are particularly useful when NODE occurs multiple times but may also be used to make sure that Node value is assigned only when certain condition is matched.
    • None: Nothing to node selection criteria.
    • Specified: Specify either the node value or the attribute name and value.
  1. Occurrence Count (ORD): It specifies the occurrence count of the searched string (between specified left and right boundaries) on the response document. It is useful in the situations when the same left and right boundaries appear multiple times on a response page.
    • All: It specifies to collect all occurrences of patterns between left and right boundaries. In this case, svar_count variable contains the count of occurrences. svar_1 contains the first occurrence; svar_2 contains seconds and so on.
    • Any: It specifies, any one of the matched pattern is selected and stored in svar.
  1. Conversion: It used to encode search pattern.
    • 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.
    • TextToHtml: Converts plain HTML data into HTML encoded data. (called HTML-encoding) Example- Plain HTML data: <03/01/1987>.After conversion into HTML encoded data: &lt;03/01/1987&gt;
    • UrlToHtml: Converts URL-encoded data into HTML encoded data.
    • HtmlToText: Convert HTML-encoded data into plain data. (called HTML-decoding.Example- HTML-encoded data: &lt;03/01/1987&gt;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 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.
  1. RedirectionDepth: The possible values:
    • Last
    • Integer value 1, 2, 3……n
    • ALL

If RedirectionDepth=Last is specified and the server response is redirection information (HTTP status code 300-303, 307), then 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.

  1. 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 stop the searching.
    • Warning does 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.
 NoteIf Continue on Error is enabled for the script, then even when ActionOnNotFound is set to “error”, the script continues when the boundary is not found, but an error message is written to the Extended log file. This attribute is optional. Default is not do anything.
  1. Encoding Options: This option is used to encode special characters to their ASCII value. This option contains 3 fields:
    • Encode: In LoadTest, user can encode any number of special characters i.e. all, specific or none. User can have following options:
      • Encode all special characters except (+), (-), (.), (_): All special symbols except + – . _ is encoded. It is the default value.
      • Encode only specified characters: 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 user selects Encode only specified characters option in Encode, then this field becomes active. Specify which special characters to be encoded.
    • Encode Space By: This option specifies how to encode Space. There are two options: ‘+’ and ‘%20’. If ‘+’ is selected, LoadTest encodes Space by ‘+’ and if ‘%20’ is selected, LoadTest encodes Space by ‘%20’. Default value is ‘+’.

Index File Parameters (Index Dataset using File)

Index File Parameter is exactly same as File Parameter. The only difference is that to identify how data is selected from the data file. In the data file, first column is considered as the index of that file. User passes the index value to Index File Parameter. LoadTest searches for that value in the data file and stops where it gets that index. It picks the corresponding data and copies it in the Index File Parameter variables declared.

Index File Parameters window

84

Description of Fields

  1. Parameter Name: This field is used to set the name of Parameter which is used in parameterization of the script. Declare multiple parameters in comma separated format. It is a mandatory field.
  1. File Name: It is the name of data file in which all data related for parameterization is stored. It can be an individual name of file and it can be an absolute path for that file.
  1. Header Line: If user wants to add some description to data file for understanding and don’t want to use those lines for data values to parameters then user can set header line value. These lines are not used by LoadTest as Data line for Data file. By default, Header Line is 0.
  1. Index Variable: Select any parameter from dropdown list for indexing. It can be a File Parameter, Search Parameter or Declare Parameter.
  1. Encoding Options: Same as File parameter.

Date Time Parameter

Date Time Parameter is used to generate the current system Date/Time value. User can set format of displaying date.

Date Time Parameter window

Description of Fields

  1. Parameter Name: This field is used to define name of the variable associated with the current parameter. Valid parameter name can have only English alphabets and Underscore (_).
  1. Format: This field is used to specify the format to be used to display date. There are various inbuilt formats like %m/%d/%Y, %Y/%m/%d, User can also create a custom formats. To do so, user can specify the required format in the textbox adjacent to the Format drop down menu. By default, %m/%d/%Y format is chosen.
  1. Sample Current Date: This textbox displays current date/time in the format selected by the user.
  1. Use: You can select specify the offset value or a range for random offset.
    • Offset: To increment 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. LoadTest does not offset parameter value. User can offset both in a positive direction as well as in negative direction i.e. user can specify a future date or in past date.
    • Range: Enables you to specify a range of random offset values. Note that the Range date option is not supported for prior to the current date. 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.
  1. Day Type: User can indicate LoadTest which kind of day to choose i.e. working day or non-working day or all days. 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 date any further.
    • Working Days: If user selects this option, then LoadTest finds the closest Working Day for the Date calculated so far. This means, if the calculated date falls on a working day then LoadTest does nothing. But if the calculated date falls on a non-working day (Saturday or Sunday), LoadTest finds the nearest working day. It goes in positive direction or negative direction depending on what value user has chosen for offset. If the offset is in the positive direction, then LoadTest finds next working day. If the offset is in the negative direction, then LoadTest finds a working day prior to the date calculated.
    • Non-Working Days: It identifies whether the calculated date is non-working day or not. If yes, it does nothing. Otherwise, it offsets to nearest non-working day in the same manner as working day is offset.
  1. Update Value on: By using this field, user indicates LoadTest when to pick new data value i.e. generated once and use this generated value for the entire session, or pick new data value every time while Date Parameter is used. User can have following options:
    • Session: If Session is selected, date/time is generated only for first use of Date Parameter. Then for the entire script, same value is used.
    • Use: If Use option is selected, date is generated from data file for every use of Date Parameter. For example, if user is using date parameter 50 times in script, then for every reference, new data value is picked.
  1. Unique for each Session: If this option is selected, it generates a unique date/time across all the NVMs and all the users.

Random String Parameter

This parameter is used to generate a random string of characters with random length. Specify what character set to use.

Random String Parameter window

86

Description of Fields

  1. Parameter Name: This field is used to define name of the variable associated with the current parameter. Valid parameter name can have only English alphabet and underscore (_).
  1. Character Set: Define the character set from which LoadTest generates random String. User 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, 3 characters only.
  1. Minimum: Specify minimum length of the string. It can range from 0-10,000.
  1. Maximum: Specify maximum length of the string. It can range from 1-1,000,000.
  1. Update Value On: This field is used to indicate LoadTest when to generate new string i.e. generate once and use this value for the entire session, or, generate string every time Random String Parameter is used. User can have the following options:
    • Session: Random string is generated only for first use of Random string Parameter. Then, for the entire script, same value is used.
    • Use: Random string is generated for each use of Random String Parameter. For example, if Random string parameter is used 50 times in script, then for every reference, new random string is generated.

Random Number Parameter

This parameter is used to generate a random number within a specified range.

Random Number Parameter window

87

Description of Fields

  1. Parameter Name: This field is used to define name of the variable associated with the current parameter. Valid parameter name can have only English alphabet and underscore (_).
  1. Minimum: Specify the minimum number below which random number should not be generated. It can range from 0-10,000.
  1. Maximum: Specify maximum number above which random number should not be generated. It can range from 0-1,000,000.
  1. Format: Specify length of the number generated.

It can have following values: –

    • %01lu
    • %02lu
    • %03lu
    • %04lu
    • %05lu
    • %06lu
    • %07lu
    • %08lu
    • %09lu

The number in this format indicates minimum 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.

Example

88

In the above figure, Minimum = 2; Maximum = 5; and Format = %02lu.

If LoadTest generates random number 3, then it saves 03 in random_number.

  1. Update Value On: Specifies when to generate new number i.e. generate once and use this value for the entire session, or, generate number every time Random Number Parameter is used. User can have following options:
    • Session: Random number is generated only for first use of Random Number Parameter. Then for the entire script, same value is used.
    • Use: Random number is generated for each use of Random Number Parameter. For example, if user uses this 50 times in script, then for every reference, new random number is generated.

Unique Number Parameter

Unique Number Parameter is used to generate unique number across all of the users. Unique number is generated from 16121217 and sequentially 1 is added.

 Unique Number Parameter window

89

Description of Fields 

  1. Parameter Name:This field is used to define name of the variable associated with the current parameter. Valid parameter name can have only English alphabet and _.
  1. Format: If user wants to specify length of the number generated, he/she can specify here.

It can have following values:

    • %01lu
    • %02lu
    • %03lu
    • %04lu
    • %05lu
    • %06lu
    • %07lu
    • %08lu
    • %09lu

The number in this format indicates minimum 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.

Example

90

In the above figure, Format = %09lu. So, number generated would be 016121217. However, if user gives format as %01lu, then number would be 16121217. LoadTest do not truncate any digit.

  1. Update Value On: This field is used to indicate LoadTest when to generate new number i.e. generate once and use this value for the entire session, or, generate number every time Unique Number Parameter is used. User can have following options:
  • Session: If the session is chosen, a unique number is generated only for the first use of the Unique Number Parameter. Then for the entire script, the same value is used.
  • Use: If Use is chosen, a unique number is generated for each use of the Unique Number Parameter i.e. if Unique Number Parameter is used, for example, 50 times in the script, then for every reference, a new unique number is generated.

Form Parameter

It is a convenient API for filling the HTML form body to be sent with an HTTP request with the method POST. This is used to avoid the transmission of the user’s sensitive information in the URL while sending a request. So, the user’s information is sent in the body using the POST method.

User needs to follow the below-mentioned steps for using form parameter:

  1. Open the flow file of the script in the right pane of the Script manager window and right-click over it.
  2. Go to Insert > Form Parameter, the Form Parameter dialog box is displayed.

91

  1. Select the Page name from the Page Name drop-down list.
  2. Enter the Form name.
  3. Enter Input field and Value and click OK.

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. Although originally derived from the JavaScript scripting language, JSON is a language-independent data format. Code for parsing and generating JSON data is readily available in a large variety of programming languages.

JSON Structure

 91_1

 91_2

91_3

91_4

91_5

SQL Parameters ( Dataset Using query)

SQL parameter is the same as the file parameter. The only difference between them is that, in SQL parameters, the data set is in the database rather than in a file. The database can be local as well as remotely situated. NS needs to fetch the dataset form DB according to the user-provided query and use this dataset to apply parameterization.

There are the following fields within this window:

  • Driver
    • This argument provides name of Database drivers like – MySQL, PostgreSQL, etc.
    • It is responsible to connect DB.
  • Host
    • This argument provides DB server host.
    • HOST can be IP or hostname.
    • For example:
      • 10.10.70.4
      • localhost
  • PORT
    • This argument provides DB Port.
  • QUERY
    • This argument provides Query to fetch data set.
  • USER
    • This argument provides authorized user name to connect DB.
  • PASSWORD
    • This argument provides corresponding password.
  • File
    • In SQL parameter argument, “File” is used only when argument “IsSaveIntoFile” is Yes.
    • If argument “IsSaveIntoFile” is Yes then Data set fetch from DB and store on provided file.
  • IsSaveIntoFile

This argument provide option to store fetched data set into provided file.

Advanced Parameter

Applying Static and Dynamic LB / RB

Follow the below-mentioned steps to apply static and dynamic LB / RB in the search parameter.

  1. Login to LoadTest and navigate to Script Manager UI.
  2. Open the flow file of the script for which the parameterization is to be applied.
  3. Right-click over the flow file and navigate to Parameters > Add > Search Parameters.

  1. This displays the Search parameter window. Suppose, the user is searching for the occurrences of string “Mercury Tours” in the response of the particular page. For this, user needs to define the LB and RB accordingly. Here, we are explaining how this can be achieved using mixed mode (by using static and dynamic LB / RB). On this window, perform the following operations for using this feature:
    • Provide the parameter name.
    • For a static LB, select ‘Text’ from the drop-down list, provide the static text, such as ‘Mer’ in the Left Boundary field.

    • For adding a dynamic LB along with the static LB, select ‘Parameter’ from the drop-down list and click the Add Parameter This displays the Add Parameter window.

    • Select the parameter type as ‘File’ and Parameter Name as ‘txt1’ and click Add.

Note: Here, we have created a file parameter with the name ‘txt1’. This parameter contains the value as ‘c’.

    • This adds the LB as Mer{txt1}, where {txt1} contains the value as ‘c’. Therefore, the LB becomes a combination of LB and RB and its value is ‘Merc’.
    • Similarly, specify the RB. The user can specify either static text, or dynamic parameter, or a combination of both. Here, we have selected RB as a dynamic parameter {txt3} and its value is ‘our’.

Note:

    • Here, we have created a file parameter with the name ‘txt3’. This parameter contain the value as ‘our’.
    • By setting this, LB becomes ‘Merc’ and RB becomes ‘our’.
  1. Specify all other required inputs in this window, click OK and then Save. The search parameter gets successfully updated.
  2. Add the below line of code (as highlighted) in the flow file of the script that contains the parameter name to be printed in the output file.

7. Compile the script by clicking the  button and then test it by clicking the  button at the top bar of the Script Manager Once the script test is completed, this displays a window where all the executed pages are listed. Click the View Output button.

8. This displays the output window with searched results as highlighted.

Repeatable Block

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

parameters can be, Count of 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. User 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 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 have 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 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 which 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 for string, use random number in 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 value option in reparable block can use index parameter.
  • Declare parameter: Declare parameter can be used in the repeatable block. Value case in repeatable block is used. Count can’t be used, as it is a scalar variable.
  • Declare Array Parameter: Declare array can use count case in the repeatable block. For value case, user need to give index associated with declare array parameter.
  • File Parameter: If user needs string to be repeated on the basis of 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 flow.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 option.

  1. The Repeatable block dialog box is displayed.

93

  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 Parameter name and block separator.
  4. Click the Apply button to execute the settings.

8. Select the required text.

9. Now the selected text is repeated according to occurrence of selected search parameter.

In the above example, the value of Uname is displaying 5 times as search parameter occurrence is 5.

Example for Value:

Declare one declare parameter having value 10.

Apply repeatable block by using Parameter value.

Apply repeatable block changes.

Selected Text value gets repeated for 10 times.

Example for Fixed Value:

Select Text and click on Repeatable block.

Apply changes by selecting fixed value and giving value in value box.

Selected text is repeated two times.

Encode 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. User can use the parameter instead of the encrypted text, but the parameter name should be designed with encrypted tag in parameterization GUI.

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

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

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

There is an option to encrypt the complete file also. For that, user needs to provide input file name, output file name, column number, and start index. This feature is intended to use when user has applied file parameter in a file and wants to encode that file.

To do this, go to Actions menu and click the Encode File option.

This displays Encode File pop-up where user can encode a file with different options.

Specify the following details:

  • Input File: It is the file, which has to be encoded. User needs to browse that file from the file system.
  • Output File: It is the file where encoded details are to be saved. There are following options within this:
    • Same as Input File: The input file will be replaced with the file having encoded data.
    • Is File: This option is used to select already created/available file in which user wants to save encrypted data of input file.
    • Is Dir: To create new file, select this option and Browse directory or path in which you want to create new File. File name needs to be added after path if is Dir is selected.

Note: Is File and Is Dir are File Browsing options whether you want to browse file (available) or directory (path for new File).

  • Column Index: Here, user needs to specify at which column encoding is to be applied. User can specify comma separated column index, such as 1, 3, 5. User can also apply encoding to all columns (complete file) by selecting the Complete File check box.
  • Column Delimiter: This is used to split text strings into multiple columns by space/comma/period and so on. If delimiter not found in file then user has an option to encode complete file.
  • Start Row Index: Here, user needs to specify from which row of the file, encoding has to be performed.

Note: The generic absolute path which needs to open on browse for both input and output option is fixed: /home/cavisson/Controller_Name(Current Script Manager)/scripts

Auto Correlation

Auto Correlation feature is used to fetch the correlated data from executed pages. Executed pages are those pages which 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 contents and right click on the selected text and click on Auto Correlate i.e. session id, product id etc.

94

  1. This displays the Auto Correlation dialog box.

95

  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 name in drop down list.
    • Page URL: Page URL combo show the all URLs of related page which is show 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 use for find the next highlighted text.
    • Prev button: Prev button is use for find the previous highlighted text at first time the button is disable.
    • 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.

The 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 Var gets added to registrations.spec file.

96

6. API Added in registrations.spec file:

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

97

Revert Auto Correlate

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

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.

Parameterization in Checkpoint

User can also parameterize the checkpoints that are used in the scripts. The parameters applicable for checkpoints are – Search parameter, File parameter, and Declare parameter.

Here is an illustration for the application of parameterization in checkpoints:

For Search Parameter:

  1. Add a search parameter, such as search_check, specify the left boundary and right boundary, and search page as index.

2. Add a checkpoint, select the parameter as search_check, and search page as login.

3. Go to spec file and verify the configured details for checkpoint parameterization.

4. Navigate to the Page Snapshot Options and view the applied parameterization in checkpoint.

5. Add another search parameter, for example search_check_1, specify the left boundary and right boundary, and search in index page.

6. Now, add checkpoint. Within the Search for Text by start and end of string section, specify the parameters as search_check and search_check_1. Specify the page as reservation.

7. View the parameterized checkpoint within the Page Snapshot section of the page dump window.

For Declare Parameter:

1. To parameterize a checkpoint using declare parameter, first add a declare parameter, for example, declare_check.

2. Add a checkpoint, specify the parameter as declare_check and specify the page as index.

3. View the parameterized checkpoint within the Page Snapshot section of the page dump window.

For File Parameter:

  1. Add a file parameter for example, Dynamic_check. Specify the file path and text.

2. Add a check parameter and select the same file parameter within the parameter section, and specify the page where it is applied.

3. View the applied checkpoint parameterization within the Page snapshot section in page dump window.