PreProcess Variables and Parameters
Search Knowledge Base by Keyword
Parameters/Arguments:
VIP uses the concept of Arguments (passed by the user when a workflow is invoked either from command line or from Modeller)
Note: The terms Parameter and Argument may be used interchangeably in this document.
Variables:
Variables can be evaluated using a valid VIP expression e.g. System.DateTime.Now or RandomHelper.GetRandomInt(10, 20) and can be used while generating data for columns.
Both Variables and Parameters can be referred in Column level data generation and Event Hooks and can be combined with other Parameters & Variables as long as the final expression is a valid VB.NET expression.
Using PreProcess Variables to Query Databases and using the Queries in Data Generation functions.
In general, this process is useful to load master data that is used in data generation e.g. list of countries or list of data from any other table in database etc.:
- Go to the PreProcessVariables tab
- Remove varExisting_OrderItem
- Also remove the following:
- varExisting_Country
- varExisting_Customer
- varExisting_Order
- varExisting_Supplier
- varExistingProduct remains in the sheet
Note: The TYPE is very important! See the specified Type in Type Column:
Now we can see the above whenever we are generating a Customer
Go to OrderItem sheet where
The third row contains:
OrderItem ProductID RandomHelper ……….varExisting.Product).id
…but we don’t know which product we are using.
So create varProduct variable in PreProcessVariables tab in row
varExisting_Product Scope column has Customer
Using ‘Add Model’ variables to create PreProcess Variables
Since we deleted all the variables (see previous section) in the PreProcessVariables sheet, we no longer have access to the Supplier variable so if we want to add a variable, we can use ‘Add model’ variables menu (upper right) by selecting the object that we want to use in the PreProcessVariables sheet.
Add Variable Example
In the PreProcessVariables sheet, add a new row:
varExisting_Country
The new Model created and it can be utilized:
…but because the Column Name and ‘Country’ has the Country Column, we must do this:
The Column names must be prepended with an underscore because the table and column cannot be seen otherwise. If you have a look in SQLManager, you will see that the variable in the Database is the same.
The Fix for this is in the Fixing Errors section
Using Parameters to set Max/Min Values for Data Generation
Example
Go to the Product Tab
If we have a look at the UnitPrice. Parameters can be used to supply Values.
In the PreProcessVariable tab, declare 2 new variables:
parMinPrice
parMaxPrice
Define Function column as Parameter, Type Int32 for both.
Set IsParam to YES.
[Filled in values 100, 1000] Use this min/max on price when generating the product.]
[In Product tab–>FunctionParameters Column, UnitPrice row, input parMinPrice and parMaxPrice.] See last figure.
These constants will be used in the generation.
Overview of the Types of PreProcess Variables and Using Scope
Preprocess variables can be very useful and give the user more flexibility in manipulating data. They allow the user to store values/calculated values that they would like to use in another calculation. So for example we could create a preProcessVariable called OrderItemTotal that is the OrderItemPrice * the NumberOfOrderItems :
OrderItemTotal = OrdertemPrice * NumberOfOrderItems
This value could then be saved and used in the calculalation the Total Amount of an Order.
Go to the PreProcess Variable Tab
Look at Type* Columns
Note: Types are ‘typical’ data types such as ‘String’, ‘Boolean’, ‘Int32’ and any Types defined in Generated Model
Examples
- Product
- Different Models from other Generated Models.
Scope (Scope Column) defines whether to re-initialize or not and whether it should be done once or each time it’s used.
-
-
-
- IEnumerable to Data Reader
- Data Table to List
- Nested String List to Data Table
- List to Data Table
- IEnumerable to List
- List to IEnumerable
- Remove from List
- Exists in List
- Value Exists in Dictionary
- Key Exists in Dictionary
- Remove from Dictionary
- Get from Dictionary
- Clear Dictionary
- Add to Dictionary
- Clear List
- Add to List
- Show all articles ( 1 ) Collapse Articles
-
-
-
-
- Explanation of Remaining Sheets in the Control Spreadsheet (for reference only)
- The ForeignKeys Sheet - Specifying which Foreign Keys to read from the Source Database
- The Tables Sheet: Defining Metadata that will be read from the Source Database
- The ProcessModel sheet – Toggling Subset Rules
- Refining the Control Spreadsheet
- Overview of the Advanced Control Spreadsheet
- Introduction
-
- Drop both Primary and Foreign Keys (The composite DROPKEYS Action)
- Validate Both Primary and Foreign Keys (The composite ValidateKeys Action)
- Add Both Primary and Foreign Keys (The Composite ADDKEYS action)
- Drop Tables
- Truncate Data
- Delete Orphans
- Drop Primary Keys
- Drop Foreign Keys
- Validate that Foreign Keys are Unique
- Validate that Primary Keys are Unique
- Add Foreign Keys
- Add Primary Keys
- Overview of Post-Subset Actions
-
-
- Use Event Hooks to call VIP Flows
- Different Methods for Connecting to Source Databases
- PreProcess Variables and Parameters
- Using SQL Functions to query Databases and Using the Queries in Data Generation Functions
- Summary of the Process to Configure the Test Data Configuration sheet
- How the PreProcessVariables Table is used in the Configuration sheet
- Sample Commerce Configuration Sheet Examples
- Adding Event Hooks in Configuration sheet for custom functionality
- How to Configure the Synthetic Test Data Configuration Control Sheet
-
-
-
-
-
- The UI Recorder
- Test Modeller – Maintenance
- Test Modeller Core (Linux) Optional – Postgres LDAP
- Test Modeller Core (Linux) Optional – SSL Certificate Installation
- Test Modeller Core (Linux) Optional – Active Directory
- Test Modeller Core (Linux) Installation
- Test Modeller: Software Pre-requisites
- Test Modeller : Installation components
- Test Modeller : System requirements (Windows, Linux)
-
-
-
- Articles coming soon
-
- Articles coming soon
-
-
-
- Common Problems
- Extend Test Modeller (Advanced)
- Edit Code Templates (Advanced)
- Import existing framework / custom page objects (Advanced)
- Execute Tests (Java)
- Generate Automation Code
- Build a Model (Java)
- Scan an Existing Web App
- Configuration (Java)
- Prerequisites (Selenium Java)
- Welcome Selenium (Java)
-
-
-