DoxRunner
​
Custom Parameter Operations
Overview
​
Both VUGen and DoxRunner support a type of parameter called Custom.
This parameter type is useful for assigning a constant value to a parameter so that if the value needs to be changed between tests, it can be changed in one place.
​
One typical example is URLs, where a URL may change from test to test if changing environments. This saves time and reduces the likelihood of mistakes. Regardless of this time saving feature, it may be better to consider Additional Attributes.
​
One situation where an Additional Attribute is not appropriate is where a value needs to change per iteration, and no standard parameter type is appropriate. One example is where a bespoke function is needed to execute at the top of each iteration. In this case, even though some manual configuration is required, a Custom Parameter is ideal.
​
This page describes four ways that a scripter can configure them:
3. The usual method;
4. The DoxRunner method.
​
The best method is number 4, the DoxRunner method. It provides a platform for documenting Custom Parameter rules and a process for automatically updating a raw script with the documented rules.
​
Standard VUGen method 1
​
One way of configuring Custom parameters is shown on the right.
1. Select the Parameters menu item in the Solution Explorer;
​
2. Type in the parameter name;
​
3. Choose Custom from the drop-down listbox;
​
4a. Type in the value;
4b. Optionally type in a description;
​
5a. Manually replace all relevant values in the script with the parameter name;
5b. Optionally type in a description at the end of each line;
​
Disadvantages:
-
The process needs to be repeated for every Custom parameter;
-
The process needs to be repeated whenever you need to re-record the script;
-
At run-time the value will be assigned to the parameter once and only once, as if it was assigned at the beginning of vuser_init.
​
Standard VUGen Method 2
​
Another way of configuring Custom parameters is shown on the right.
1. Select the value you want to be replaced;
2. Right-click, and select Replace with a Parameter;
3. Select Create New Parameter;
4. Type in the parameter name;
5. Choose Custom from the Parameter Type drop-down listbox;
6. Type in the value;
7. Optionally press Properties;
8. Optionally type in a description and press Close;
9a. Optionally replace all values with the parameter (dangerous for short values)
or
9b. Manually replace the relevant values with the parameter one by one.
​
Disadvantages:
-
The process needs to be repeated for every Custom parameter;
-
The process needs to be repeated whenever you need to re-record the script;
-
At run-time the value will be assigned to the parameter once and only once, as if it was assigned at the beginning of vuser_init.
The usual method
​
Most scripters simply ignore the VUGen configuration methods described above and use simple lr_save_string() function(s).
​
-
Placed at the top of vuser_init.c, this will achieve the same objective as both of the above methods.
-
Placed at the top of Action.c allows the scripter to form the parameter value in a more complex way such as the use of a function or constructing a value from other parameters where the values update at each iteration.
-
The scripter must replace the relevant values in the script with the parameters.
Advantages:
-
If multiple Custom parameters are required they are easily viewed and updated in the script without having to open multiple dialog boxes;
-
More complex value assignments can be implemented such as the use of a function or building up a value from other parameters;
-
The scripter can do the same thing at the top of Action.c, allowing the value to update for every iteration where a function or a more complex value needs to be assigned.
​
Disadvantages:
-
The process needs to be repeated for every Custom parameter (although it's easier and more flexible);
-
The process needs to be repeated whenever you need to re-record the script.
​
The DoxRunner method
​
DoxRunner is test case-centric, so Custom Parameters are documented in a Custom Parameter section. Refer to the documentation page for details on how to document Custom Parameters.
​
Refer to the How it works section below for how the documented rules are used by the Process Raw operation.
​
Advantages:
-
You only need to document each rule once, and the rule is quickly and accurately applied by the Process Raw operation whenever the script needs to be re-recorded;
-
The test case can be viewed by semi-technical people without having to trawl through the script;
-
The Description is automatically inserted, adding to script readability;
-
If multiple Custom Parameters are required they are easily viewed in the script and updated without having to open multiple dialog boxes;
-
More complex value assignments can be implemented such as the use of a function or building up a value from other parameters;
-
The Process Raw operation automatically determines whether the parameter is assigned at the top of vuser_init or Action.c, or you can specify where. The scripter then only needs to assess each one to see whether a function or other criteria needs to be applied instead of the lr_save_string() function.
​​
Disadvantages:
-
The scripter needs to take the time to document the rules in the test case. We all know that performance testers don't like to document, even though it is more professional to do so.
​
How it works
As well as facilitating performance test documentation, DoxRunner provides operations that enhance scripting by applying the documentation to VUGen scripts. The most important is the Process Raw operation, which includes support for Custom Parameters.
​
The description of the Process Raw operation below as it applies to Custom Parameters uses 7 examples, each one showing a different possibility, reflecting the extra functionality of the DoxRunner method over standard VUGen.
​
​
Process Raw operation
​
Goal
​
1. To convert the documented Custom Parameter rules into lr_save_string() functions;
2. All relevant values in all script files are replaced with the specified Custom Parameter.
​
​
Examples
​
The Process Raw operation description below uses 5 examples to illustrate how different scenarios are handled:
Example 1: Straight use of the documented value by the Process Raw operation;
Example 2: Replace the documented value with an unassociated name / value pair by the Process Raw operation;
Example 3: How an empty documented value is handled by the Process Raw operation;
Example 4: Add a Custom Parameter to the test case during the Process Raw operation;
Example 5: Delete a Custom Parameter from the test case during the Process Raw operation.
​
All examples assume 4 initial steps as discussed below.
​
​
Process Raw initial steps
Before each of the 7 examples are discussed, a brief discussion of the Process Raw preparation follows, illustrated below.
​
-
Any Custom Parameters that are documented in the Solution document outside of any test case (at bookmark V_Custom) are read in;
-
Any Custom Parameters that are documented in the test case at bookmark V_<TestCaseID>_Custom are read in;
-
All Custom Parameters read in at 1 and 2 above are combined. If there are any conflicts, those in the test case take precedence over those at bookmark V_Custom;
-
The combined Custom Parameters are presented to the scripter in the Custom pane of the green Parameter Association screen;
​
It is within the green Parameter Association screen that the scripter has the final opportunity to determine what value the Custom Parameter will take on and where is is assigned. See Detailed examples below for a detailed discussion of the 7 examples.
​
​
Example 1
​
Straight use of the documented Value
The parameter pSupplierPortalURL is used in this example. Its Value is defined in the documentation. Even though the scripter has the opportunity to change that value, this example shows what happens if the documented value is used unchanged.
​
It is assumed that you have read all 4 initial steps above, which deals with the first 4 steps (from the documentation to the green screen). The steps below take the process from the green screen to the configured script, as illustrated on the right.
-
The scripter selects the parameter in the Custom pane;
-
Note that the parameter name, documented value and 'Update value on' (Auto) display in the fields at the bottom of the Custom tab;
-
The scripter simply presses the Associate by value button;
-
The association is displayed in the bottom pane and disappears from the Custom pane;
-
Repeat for all other parameters as appropriate;
-
When finished, press the Apply button;
-
Because the 'Update value on' is Auto, the Process Raw operation determines whether the first occurrence of the Value occurs during the steps that belong to vuser_init, or Action.c:
-
If the first occurrence is in vuser_init, then the lr_save_string() is written at the top of vuser_init.c;
-
Otherwise it is written at the top of Action.c;
-
In the example it will be at the top of vuser_init;
-
The documented value is appended as a comment.
-
-
The Process Raw operation replaces all occurrences of the Value with the parameter {pSupplierPortalURL} and appends the original value to each line as a comment.
​
​
Example 2
​
- Replace the documented value with an unassociated name / value pair
- Manually update the assignment with a function
The parameter pPlotSize is used in this example. Its documented value is 5100.
​
It is assumed that you have read all 4 initial steps above, which deals with the first 4 steps (from the documentation to the green screen). The steps below take the process from the green screen to the configured script, as illustrated on the right.
​
-
Select the parameter in the Custom pane;
-
Note that the parameter name, documented value and 'Update value on' (Iteration) display in the fields at the bottom of the Custom tab;
-
Select a name - value pair from the Unassociated name-value pair pane;
-
The documented value (5100) is replaced by the selected value (5000);
-
Press either the Associate by value or Associate by boundary button. The parameter is displayed in the bottom pane and disappears from the Custom pane. It also disappears from the Unassociated name-value pair pane;
-
Repeat for all other parameters as appropriate;
-
When finished, press the Apply button;
-
The Process Raw operation places the assignment at the top of Action.c. because the 'Update value on' CI is Iteration;
-
The Process Raw operation replaces all occurrences of the assigned value value with the parameter ({pPlotSize});
-
The scripter can leave the assignment as it is, or manually update it with more complex assignments, such as the use of a function that resets the value upon each iteration.
​
​
Example 3
​
How an empty value is handled
The parameter pClientID is used in this example. The Configuration column in the documentation is empty, so no documented value exists, and the 'Update value on' CI defaults to 'Auto'.
​
It is assumed that you have read all 4 initial steps above, which deals with the first 4 steps (from the documentation to the green screen). The steps below take the process from the green screen to the configured script, as illustrated on the right.
​
-
Select the parameter in the Custom pane. Note that the parameter name displays at the bottom of the Custom tab, but the value is blank;
-
The documented 'Update value on' is also blank, but it defaults to Auto;
-
At this point you can manually enter a value, or choose one from the 'Unassociated name-value pairs' pane. To use the parameter without a value, simply press the Configure only button;
-
The parameter is displayed in the bottom pane and disappears from the Custom pane;
-
Repeat for all other parameters as appropriate;
-
When finished, press the Apply button;
-
Since the value is blank, the Process Raw operation cannot make an assessment as to where the first assignment will occur, so it simply types the lr_save_string() at the top of vuser_init.c;
-
The Process Raw operation cannot replace any value in the script files with the parameter. It is up to the scripter as to what to do with the parameter;
-
One option is for the scripter to assign a more complex value to the parameter. In the illustration on the right, a value is extracted from the database and assigned. The assignment is also moved from vuser_init.c to the top of Action.c. This implies that the documentation should have set the 'Update value on' CI to Iteration, rather than leaving it blank.
​​
​
Example 4
​
How to add a Custom Parameter during the Process Raw operation
The parameter pStalkType is used in this example.
​
It is assumed that you have read all 4 initial steps above, which deals with the first 4 steps (from the documentation to the green screen). The steps below take the process from the green screen to the configured script, as illustrated on the right.
-
Type in a parameter name and default value into the two text boxes at the bottom of the Custom tab;
-
Press the Use default value button;
-
The parameter is displayed in the bottom pane;
-
Repeat for all other parameters as appropriate;
-
When finished, press the Apply button;
-
The Process Raw operation determines whether the first occurrence of the default value occurs during the steps that belong to vuser_init, or Action.c:
-
If the first occurrence is in vuser_init, then the lr_save_string() is written at the top;
-
Otherwise it is written at the top of Action.c;
-
In the example it will be at the top of vuser_init.
-
-
The Process Raw operation replaces all occurrences of the default value with the parameter ({pStalkType });
-
The Process Raw operation inserts the new parameter into the Custom Parameters section with description "New";
​
It is expected that the scripter will expand on the description.
​
​
Example 5
​
How to delete a Custom Parameter during the Process Raw operation
The parameter pServiceType is used in this example.
​
It is assumed that you have read all 4 initial steps above, which deals with the first 4 steps (from the documentation to the green screen). The steps below take the process from the green screen to the configured script, as illustrated on the right.
​
-
Select the parameter in the Custom pane;
-
Note that the parameter name and default value display at the bottom of the Custom tab;
-
Press the Delete from document button;
-
The parameter will be deleted from the Custom Parameters section after the Process Raw operation completes all script-related actions.
​