Parameterization
Parameterization is a technique to change the value of the variable at run time. It is achieved through the use of NetStorm variables. NS variables are like variables used in programming languages & scripts. 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 right pane, select Parameters and click the desired parameter from the list of parameters.
Type of Parameters
There are following types of parameters, which can be applied on scripts:
- File Parameter
- Search Parameter
- Declare Parameter
- Declare Array Parameter
- XML Parameter
- Index File Parameter
- Date Time Parameter
- Random String Parameter
- Random Number Parameter
- Unique Number Parameter
- Form Parameter
- JSON Parameters
- SQL Parameters
File Parameter
File parameter, also known as Static variable, is used to take values from file created by the user. In file parameter, define a parameter name and that parameter name can be used in URL, Header and Body.
File Parameter window
Description of Fields
- Parameter Name: This field is used to define names of all the variables associated with the current parameter. They are like column name in a database.
- Index: In File parameter window, Index shows the index no. of parameter name. To add more than one parameter, click the More button.
- Encrypt: Select this check box to encrypt sensitive personal information, such as passwords in a file parameter.
- File Path on NetStorm Server: This is used to provide the option to browse the file path of NetStorm server. Create a file browser which gets the name of directories and files for a specified path from Server using servlet communication. If user double-clicks on any directory, then it again communicates with server and get the directories and files for new path.
- 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.
- Parameter Value: There can be situations when user might want to load some column data from some other file. For such situations, this field comes into picture. Here, user specifies to NetStorm which column refers data and which column refers file path.
- First Data Line: In some situations, user might want NetStorm to start reading data from a particular line number. So, user can use this field to indicate NetStorm which line it should consider as first Data Line. By default, first Data Line is 2.
- Column Delimiter: This field specifies which character in data file should be considered as column separator. By default, column delimiter is ‘,’. User can also use special symbols as column delimiter.
- Row Selection Mode: Any data file can contain various numbers of rows. How NetStorm knows which row to pick from these rows? For this, user can have various methods for Row Selection:
- Sequential: This method selects rows sequentially i.e. first row, then second row, then third row and so on. It is selected by default.
- Random: This method selects rows randomly. When enabled, NetStorm can pick any row from the data file.
- Weighted Random: This method randomly selects a row based on a weight value. When used, first column of data file is treated as weight.
- Unique: This method selects row from 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.
- Save Last Used Row Id After: This option becomes activated if user has selected Use Once option in Row Selection Mode. This option is used to tune the performance of NetStorm. NetStorm is designed in such a way that if Use Once is chosen then the state of NetStorm at that moment is written in .last This data is written in post processing phase. If everything runs fine, then this file is deleted. Otherwise, user can view the contents of the file. By default, NetStorm writes in this file for every data used. It can have two types of values:
- Every Use: This option writes data in .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
- Update Value on: This field is used to specify when to pick new data value i.e. generate once and use this value for the entire session, or, pick new data value every time File Parameter is used. User can have two options:
- Session: If Session is selected, data is picked only for first use of File Parameter. Then, for the entire script, same value is used.
- Use: If Use is selected, data is picked from data file for each use of File Parameter i.e. if File Parameter is used, for example, 50 times in script, then for every reference, new data value is picked.
- Encoding Options: This option is used to encode special characters to their ASCII value. This option contains 3 fields:
- Encode: In NetStorm, 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 + – . _ are 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. Here user can specify which special characters should be encoded.
- Encode Space By: This option specifies to NetStorm how to encode Space. User can have two options: ‘+’ and ‘%20’. If ‘+’ is chosen, NetStorm encodes Space by ‘+’ and if ‘%20’ is chosen, NetStorm encodes Space by ‘%20’. Default value is ‘+’.
- Copy File to Test Run: If user selects this option then file used in file parameter is copied in 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 client) and NetOcean (acting as server):
Search Parameter window
Description of Fields
- Parameter Name: Parameter name is a ‘Search Parameter Variable Name’ which is used to access this parameter in the entire script. Parameter name can consist of English alphabet and _. Any other character is not allowed.
- Left Boundary (LB): Left Boundary is the starting pattern which is provided to search any particular string. To search any string, left pattern is searched first. When its existence is verified only then 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 Search Parameter.
![]() |
In LB and RB, use \n, \r, and \t for new line, carriage return and tab respectively. All other backslash must be escaped using another backslash. |
- Search text in page response: User can specify that on which response page he/she wants to search the string. It consists of two options:
- All Pages: If this option is selected, NetStorm searches for the specified pattern in all the pages, starting form the first page.
- Specified: If this option is selected then NetStorm searches for the pattern only in the selected, specified pages.
- Occurrence Count: When the data to be searched is present more than once at the response page(s), then user can specify which occurrence should be picked by the NetStorm. By default, it is set to 1. This means it picks the first occurrence. There are following options:
- ALL: This option captures all occurrences of the pattern and saves 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 Empty value of the pattern.
- Numerals Ranging from 1 to 50: This option picks occurrence of specified pattern which is equal to the chosen numeral. For example, 3rd occurrence is picked if 3 is chosen.
- Retain Previous Value: This option provides a facility to users by which they can able to retain the previous value and also to clear the previous value. There are two possible values first is RetainPreValue=Yese. Yes retain the previous search value and second is RetainPreValue=No i.e. don’t retain the previous search value. Default is Yes.
- Start Offset: If pattern searched by NetStorm 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 Start Offset value is set to 5 then it truncates first 5 characters and save this altered data, starting form 6th position to the last position, in the searched parameter variable. Save Offset value can lie in the range 0-100 (inclusive of boundaries). User can also specify whether to consider complete length or a specified length.
- 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 user wants to convert this data into URL format, then this option comes into picture. If search parameter is used in URL portion, then all of the special symbols are encoded. But if search parameter is used in BODY portion, then to encode special symbols, following ‘Header’ should be used at that particular page:
HEADER=Content-Type: application/x-www-form-urlencoded.
- Action On Not Found: If the pattern, to which NetStorm is searching for, is not found, then user can make NetStorm to behave in following ways:
- Warning: If this option is used and the pattern to which NetStorm is searching for, is not found then NetStorm displays an error message in log and continue its operation.
- Error: If this option is used and the pattern, to which NetStorm is searching for, is not found, then NetStorm displays CVFail in report and event.log and terminates further processing.
- Redirection Depth: If the page, on which NetStorm is searching the pattern, is moved to some other location, then this option is used. It specifies up to how many number of moved location NetStorm is supposed to search for the pattern i.e. up to what redirection depth NetStorm searches the pattern. By default, if a page is moved, then NetStorm do not search on that page. There are following options:
- Last: If this option is chosen, NetStorm searches on the last redirection.
- Numerals ranging 1-32: NetStorm searches only up to the depth which is equal to the numeral selected.
- Search In: By applying ‘Search Parameter’, NetStorm searches in the response page. If 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 search parameter variable. User can have following options:
- Body: If this option is selected, then NetStorm searches for the pattern in the response page.
- Header: If this option is selected, then NetStorm 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.
- Encoding Options: This option is used to encode special characters to their ASCII value. This option contains 3 fields:
- Encode: In NetStorm, 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, NetStorm encodes Space by ‘+’ and if ‘%20’ is chosen, NetStorm encodes Space by ‘%20’. Default value is ‘+’.
Declare Parameter
Declare Parameter or Scratch Parameter is a parameter whose value is initialized by user. This parameter value does not change automatically. User has to write code for assigning its value.
Declare Parameter window
It has only one field, Parameter name. User just has to provide this a name and then user can assign this variable a value anywhere in the script.
Declare Array Parameters
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
Description of Fields
- Parameter Name: Unique name for this parameter. Parameter name must be start with an Alphabet.
- Size: It is the size of array.
- Default Value: If nothing comes in declare parameter value then default value comes in place of parameter name in response.
XML Parameters
NetStorm 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 XML NS variable.
XML Parameter window
Description of Fields
- Parameter Name: It is the name of XML variable being defined. This is the only argument without an argument name.
- XML Node Path: It specifies the XML node.
- 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, NetStorm applies parameter in all the pages, starting form the first page.
- Specified: If this option is selected then NetStorm applies parameter only in the selected, specified pages.
- Node Value: It is the value of the Node. It is selected by default.
- Attribute Value: It specifies the attribute value. If user selects the Attribute value option, he/she needs to specify the attribute value.
- 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.
- 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.
- 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: <03/01/1987>
- 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 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.
- 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.
- 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.
![]() |
If 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. |
- Encoding Options: This option is used to encode special characters to their ASCII value. This option contains 3 fields:
- Encode: In NetStorm, 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, NetStorm encodes Space by ‘+’ and if ‘%20’ is selected, NetStorm encodes Space by ‘%20’. Default value is ‘+’.
Index File Parameters
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. NetStorm 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
Description of Fields
- 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.
- 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.
- 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 NetStorm as Data line for Data file. By default, Header Line is 0.
- Index Variable: Select any parameter from dropdown list for indexing. It can be a File Parameter, Search Parameter or Declare Parameter.
- Encoding Options: Same as File parameter.
Date Time Parameter
Date Time Parameter is used to generate current system Date/Time value. User can set format of displaying date.
Date Time Parameter window
Description of Fields
- 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 (_).
- 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.
- Sample Current Date: This textbox displays current date/time in the format selected by the user.
- Offset Parameter By: To increment the current date/time by a certain value, use this option. User can offset by number of days, hours, minutes and seconds. By default, offset is zero i.e. NetStorm do not offset parameter value. User can offset both in positive direction as well as in negative direction i.e. user can specify future date or in past date. By default, NetStorm offsets in positive direction. To offset in negative direction, select the Prior to date check box.
- Day Type: User can indicate NetStorm 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 NetStorm finds the closest Working Day for the Date calculated so far. This means, if the calculated date falls on a working day then NetStorm does nothing. But if the calculated date falls on a non-working day (Saturday or Sunday), NetStorm finds the nearest working day. It goes in positive direction or negative direction depends on what value user has chosen for offset. If offset is in positive direction, then NetStorm finds next working day. If offset is in negative direction, then NetStorm 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.
- Update Value on: By using this field, user indicates NetStorm 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.
- 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
Description of Fields
- 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 (_).
- Character Set: Define the character set from which NetStorm 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.
- Minimum: Specify minimum length of the string. It can range from 0-10,000.
- Maximum: Specify maximum length of the string. It can range from 0-1,000,000.
- Update Value On: This field is used to indicate NetStorm 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
Description of Fields
- 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 (_).
- Minimum: Specify the minimum number below which random number should not be generated. It can range from 0-10,000.
- Maximum: Specify maximum number above which random number should not be generated. It can range from 0-1,000,000.
- 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
In the above figure, Minimum = 2; Maximum = 5; and Format = %02lu.
If NetStorm generates random number 3, then it saves 03 in random_number.
- 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
Description of Fields
- 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 _.
- 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
In the above figure, Format = %09lu. So, number generated would be 016121217. However, if user gives format as %01lu, then number would be 16121217. NetStorm do not truncate any digit.
- Update Value On: This field is used to indicate NetStorm 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 session is chosen, unique number is generated only for first use of Unique Number Parameter. Then for the entire script, same value is used.
- Use: If Use is chosen, unique number is generated for each use of Unique Number Parameter i.e. if Unique Number Parameter is used, for example, 50 times in script, then for every reference, new unique number is generated.
Form Parameter
It is a convenience API for filling HTML form body to be sent with HTTP request with method POST. This is used to avoid the transmission of 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:
- Open the flow file of the script in the right pane of the Script manager window and right-click over it.
- Go to Insert > Form Parameter, the Form Parameter dialog box is displayed.
- Select the Page name from the Page Name drop-down list.
- Enter the Form name.
- 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
SQL Parameters
SQL parameter is same as file parameter. The only difference between them is that, in SQL parameter, data set is in database rather than in file. Database can be local as well as remotely situated. NS need to fetch dataset form DB according to user provided query and use this dataset to apply parameterization.
There are 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.
Applying Static and Dynamic LB / RB
Follow the below mentioned steps to apply static and dynamic LB / RB in search parameter.
- Login to NetStorm and navigate to Script Manager
- Open the flow file of the script for which the parameterization is to be applied.
- Right click over the flow file and navigate to Parameters > Add > Search Parameters.
- 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 contain 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’.
- Specify all other required inputs in this window, click OK and then Save. The search parameter gets successfully updated.
- 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.
- 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 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 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:
- 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.
- Right-click over the selected text and click the Repeatable Block option.
- The Repeatable block dialog box is displayed.
- Select the Repeat Block from the available options – parameter count, parameter value, fixed number.
- Select the Parameter type from the list of available parameters.
- Select the Parameter name and block separator.
- Click the Apply button to execute the settings.
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.
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
- Open Script Manager window and select a script and open flow file.
- Select the dynamic contents and right click on the selected text and click on Auto Correlate i.e. session id, product id etc.
- Clicking on the menu Auto Correlate opens the Auto Correlation dialog box.
- 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.
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
- After clicking on OK button, Search Var gets added to registrations.spec file.
6. API Added in registrations.spec file:
nsl_search_var(autovar, PAGE=index_html, LB=”userSession value=”, RB=”>”, SaveOffset =0, RETAINPREVALUE=”YES”, EncodeMode=None);
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:
- 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:
- 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.