Parameterizing reusable components with Input parameter

Reusable components are often used to create test cases as they can be called in multiple test scenarios. However, ever wondered how reusable component handles different input data values for same steps in different test cases. 


For example, a login component mapped in a test case of Oracle's supply chain module may require different user credentials compared to the test case of HCM module. If we map hardcoded static user credentials in steps of Login component, it may fail to execute for some of the test cases requiring different user credentials. 


Thus, to enable use of different data in reusable component as per the test case they are mapped in, we make use of Data parameterization. In this process, we create input parameters and map them in test steps instead of hardcoded values. The parameters passed in the test steps can take different data values from data repositories of the test cases they have been mapped to. 


This way, we can use the reusable component seamlessly across different test cases. Now, let's look at how we can create both input parameters in Opkey and its use cases. 


1. Creating and using Input Parameters


These are the parameters that you pass into the test steps of reusable component. these parameters make the reusable component dynamic by enabling them to use different data in different test cases. Let's look at how Input parameters are created in a component and how we pass data into them.  


1. We have opened a Oracle Login Component with steps to login to an Oracle environment. We will use input parameter to parameterize entering username and password steps of this component. You can use the same method to create new parameters and use them in your reusable component.



2. Click the Input Parameter option at the top.


 3. In the input parameter tab, click the + icon to add a new input parameter. 


4. We created a new parameter named Username. Similarly add another parameter named Password by clicking the + icon.


5. We have named the second parameter as password. You can also select the data type to be passed in the parameter. Clicking the checkbox will enable the parameter to take manual data values from the Data Management feature. You can also add a description of the parameter.

Clicking the three dots icon on the parameter gives access to options for moving the parameters up/down and deleting them. From the toolbar at the top, you can perform actions such as adding, moving, deleting, or refreshing the parameters. Once, you are done editing the parameters, click on close icon to exit this window.



6. Now, to map the parameters created in the steps of reusable component, click the three dots icon on a step and select the Set input data option. Here, we are mapping it for the adding username step.



7. Click the data drive icon in beside the TextToType field as we will be mapping the parameter in this field.


8. Form the list of input parameters in the next window, select the parameter you want to map in the step. Here, we are mapping the Username parameter.


9. Your input parameter should be mapped to the test step.


10. In a similar way, we have mapped the Password parameter in the next step. Once done, Click to save the component as shown below. 



11. Now, to pass values in these parameters, let's call our reusable component in an empty test case. you can use any test case to call and use a reusable component. Click the Add step button at the top.


12. In the new step, search the component you have parameterized. Here we have searched the Oracle login component that we just parameterized in the previous steps. Select the component from the search results to add it to test case.



13. Now to pass the values to this component from ADG or Global Variable, click the three dots icon and select Set Input data option. 



14. Next, click the data drive icon against the field where you want to add the value.


15. On the next page, you can select the option to add an ADG or Global Variable for mapping.



16. If you want to map the data from LDR, change the datasheet mode to Local Datasheet and click the Manage Datasheet icon. 


17. If you are using a new test case,click the + icon to add a new LDR and click the Open DataSheet icon. If you are using a pre-built test case, click the Open Datasheet icon of its LDR.



18. In the LDR, click the Enable Editing button, Next, you can add the data values in the cells corresponding to the field. Here, we will add values for Username and Password field. Once done, click the Save icon on the top and close the datasheet to exit.


19. After this, when you run the test case, it will take the data values from the mapped LDR, ADG, or global variable and execute the test case.


20. You can see in the execution result that the input value of username is successfully fetched in our test case.


Click here to learn more about reusable components.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article