What is Parameterization
Parametrization is the process in which you replace hard coded values in Action logic with symbolic variables. Instead of using actual literal values in the logic, you define and use a placeholder. This approach promotes modularity and reusability by allowing the same action to be used with multiple variations of inputs.
Statement is the basic building block in action logic. Each statement accomplishes a certain interaction, verification or other command on the test application.
Depending on the nature of statement, you may need to furnish some information to make it complete. For example, if your statement needs to type some text in an input field, you will need to provide the following information.
- What text you want to enter? (text to enter)
- In which field do you want to enter the text? (field name)
Consider the example below. This is the logic for logging onto QBank.
In this example, username and password (encrypted) are hard coded in the action logic in the first 2 statements. Any place this action is used, same set of username/password are entered.
Parameterization is the process where these hard-coded values are replaced with symbolic variables called Action Parameters, so that different set of username/password can be passed every time this action is called.
Action Parameters
Action Parameters define the interface of an Action to the rest of the system. An action can define either Input or Output parameters. Action expects the input parameters' values to be supplied when it is called, and returns the output parameters from its logic. You can define multiple input and output parameters for a given action.
Values for input parameters must be furnished from the place where this Action is called. Remember, an action can be called either from a Scenario or from another action. At the same time, values of output parameters are available where the action is called.
Create Input Parameter
- Click on the "Parameters" tab in the sidebar of the action.
- Click "+" on the Input Parameter listing.
- Type a name and provide brief description.
- Select if this is a mandatory input or not. If the parameter is not mandatory, a blank value is considered as a valid input.
- Define value-restrictions (discussed in next section)
Restricting the permissible values for Input Parameter
When you define an Input Parameter, you can indicate if any restrictions should be placed on permissible values for this parameter. When you use this action from a scenario, user is guided to select one of the list of permissible values.
There are two ways you can restrict the values. Either by pointing the input to a data list or to a data type. Only the values / nodes available in the definition of data list / data type are allowed from the scenario.
In addition to providing guidance (of what values can be used) to the user while creating a scenario, this feature greatly helps with automated test case generation. This will be discussed in greater detail in the Scenario concept.
Creating Output Parameter
- Click on the "Parameters" tab in the sidebar of the action.
- Click "+" on the Output Parameter listing.
- Type a name and provide brief description.
Using an Action Parameter in logic
When you are creating a new statement or editing an existing argument for a statement, click on the "parameter type" icon on the left of the argument (see below). Select Action Parameter list item.
Note: If you are utilizing an action output parameter to change an argument value, make sure the output parameter already has a valid value set in the logic ahead of this statement.
Using Action Parameters as control variables in logic
Action Parameters need not always be for inputting to statement arguments. Sometimes, it may make sense to create action parameters to control the behavior of action logic. Consider the example below, where there is additional back-end validation performed on condition. Verify Purchase Order may be used in a lot of test cases and you may not always want to perform the back-end verification. Is Verify in DB is an action input parameter which provides that ability to control action's behavior. When you define a test case, you pass Yes/No based on if DB validation is necessary or not.
Deciding what inputs to parameterize
While developing action logic, there may be a need for multiple input values across statements. Parameterization is a powerful capability to make the action reusable with multiple variations of input data. However, it is equally important to know that not all inputs should be parameterized.
Consider an Account creation action for Salesforce implementation. There may be a large number of input fields required to create an account. But it is not recommended to parameterize every one of those inputs. For example, a "Descriptoin" field value can probably be hard-coded in the logic itself and you may not need to parameterize and test with different values for this field.
Too much parameterization can lead to overheads in maintenance and you make the test case creation process complex. When creating a scenario, user needs to think about a lot more input values. Optimize this by choosing to parameterize only those inputs that are functionally significant from testing view point.
Summary
Action Parameterization is a powerful capability with significant implications on overall test design and maintenance.
- Action becomes reusable to the next level, with variable input possibilities.
- Promotes Data Driven Testing with each scenario yielding multiple test cases.
- Facilitates automatic test case generation when you restrict the values permissible for an input parameter.
Comments
0 comments
Please sign in to leave a comment.