Now, let's extend the Login verification scenario by parameterizing some steps.
Objective: Run login verification scenario with multiple sets of usernames and passwords.
In the previous example, we hard-coded the user name and password of the user in the Login action logic. See below:
Now, let's say we want to extend this action so that it works with any given pair of user name/password that we supply. We are talking Parameterization here!
Parameterize Login action
- Open Login to QBank action either from global search or from the Navigator.
- In the Parameters tab, create 2 input parameters: User Name and Password.
- Click on the "+" icon and type parameter name "User Name". Take other settings on the defaults.
- You may get a Reference Confirmation dialog. Click on "Proceed".
Apply Parameters in the Login Action
- Now, let's replace hard-coded values for user name and password in the action logic with the parameters.
- Click on the value, john.todd in the statement. Now click the parameterization icon on the left side.
- Select "Action Parameter" and choose "User Name"
- Repeat the same by clicking the value of password in the second statement in the logic.
- Action logic should now look as follows:
Create Test Cases for Scenario
- Now, navigate to the Scenario you just created in the first example.
- Now that the Login to QBank step is parameterized, scenario needs to supply values for these parameters. You can setup multiple test cases, by providing one set of values in each test case.
- Click on the Test Cases tab.
- Click "..." icon and create a new test case with one set of user name and password. (john.todd, pass123)
- Create another test case by supplying another set of user name and password (qbankadmin, pass123)
- Now when you run this scenario, it gets executed twice - once for each test case!