9.3.1 Adding Keywords to Test Steps
Function steps corresponding to the action(s) performed over web application, can be easily added to the Function Library file. Click on ‘Add Test Step’ button and type the keyword corresponding to your action. A list of matching keywords will be displayed as a search result. Click on the desired keyword to add in your test step. The added test steps can be associated with ‘Test Object’, ‘Input Data’ and ‘Output Data’ as per requirement. In a Function Library, one functional step can be referenced with the other i.e. output of one step can serve as an input for another step.
Function Library (FL) buttons perform the same actions as Test Case buttons do.
Data driving the Function Library by using Object Input Arguments –
Test steps in Function Library can be associated with your Object Repository. Make sure that you have Object Repository file corresponding to your Function Library file. Object Repository file helps in quick Function Library file creation.
There are few advanced settings which can be used to customize test execution.
- ContinueOnError: Check this checkbox if you want execution should be continued even if the error occurs within this step.
- WantSnapshot: check this checkbox if you want to get the snapshot of this step at the time of execution.
- IsNegative: If you check this checkbox, it will change the execution result of the step. It will show a passed step as failed and failed step as passed. This is used for negative testing.
Apart from that above-mentioned settings, there are other settings also that can be applied to the whole test steps as shown below.
- AllContinueOnError: Check this checkbox if you want execution should be continued even if the error occurs in all the steps of this file.
- AllWantSnapshot: Check this checkbox if you want to get the snapshot of all the steps at the time of execution.
- AllIsNegative: If you check this checkbox, it will change the execution result of all the steps. It will show a passed step as failed and failed step as passed. This is used for negative testing.
Data driving the Function Library by using Data Input Arguments –
Function Library file allows you to provide input value for a step from Input Data. You can also provide the input data through the input parameter of the details view of Function Library.
Select FL > Go to details View> Click on Input Parameter tab > Click on ‘Add’ button to add input parameters.
You can even perform other actions like ‘Delete’, ‘Move Up’, or ‘Move Down’ here.
You can use your Function Library file in your Test case. Follow the below-given steps:
Open your Test case file >Click on add Step icon< choose Function Library Tab > Scroll down and select your Function library file.
Using one Function Library within another Function Library –
You can associate a Function Library file with another Function Library file. In a practical scenario, suppose you have a method and you want to call that method into another method. To handle such scenarios, FL in FL feature has been developed. In a Function Library file, one functional step can be used within another Function Library file as well.
Select your FL > Click on Add Step icon > Select your FL test step>Scroll down and select your FL to be used.
But, you cannot call the same Function Library file within itself. While doing so, you get an error message that “Recursions are not allowed in OpKey”.
OpKey also allows you to use the output of a FL step as input to another FL step.
- Select a test step from Function Library.
- Go to the Step Output Data and provide a name to the output Data of the selected step.
- Go to the Output Parameter of Details View in Function Library and map it.
- Now, this Output Data will be visible when we call corresponding Function Library into other Test Case or Function Library.
- Provide a new name to that output data within the TC/FL, in which it is used
- Go to the step output and give a name. This name will be visible in the output of Data Input arguments.
You can perform different actions over the Function Library file by right-clicking over the selected test step. These actions are Copy, Paste, Add Step, Delete, Move Up, Move Down, Set to Run, Skip From Run and Record.