1. Home
  2. OpKey Help
  3. 9. Working with Function Libraries
  4. 9.1 Creating Function Library by adding test steps

9.1 Creating Function Library by adding test steps

9.1.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 add keyword button to add in your test step. The added test steps can be associated with ‘Object Input Argument’, ‘Data Input Argument’ or ‘Step Output’ 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.

noteFunction 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 Data Input Arguments. You need to provide input data through input from dockable panel.

Select FL Test Step > Go to dockable panel > Click on Input tab > Click on ‘Add’ button to add input parameters.

You can even perform other actions like ‘Delete’, ‘Move Up’, or ‘Move Down’ here.

7

Now, associate the given input argument(s) with the corresponding steps.

Using Function Library within a Test Case – 

You can use your Function Library file in your Test case. Follow the below given steps:

Open your Test case file > Go to ‘Add Keyword’ tab > Scroll down and select your Function library file > click on ‘Add Keyword’ button.

 

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. In order 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 test step > Go to Add Keyword > 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”.


Using Output of a FL step in another FL step –

OpKey also allows you to use output of a FL step as input to another FL step.

  • Select a test step from Function Library
  • Go to the Step Output of right pane and provide a name to the output of selected step
  • Go to the Output Parameter of Dockable panel and map it
  • Now, this Output Parameter will be visible when we call it into other Test Case or Function Library
  • Provide a new name to that output parameter within the TC/FL in which it is used
  • Go to the step output and give a name. This name will be visible in 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.

Dockable Panel – 

There are six tabs in dockable panel in Function Library module namely Details, Input, Output, UsedBy, AuditTrails, Tags & Execution Status. They provide details about the corresponding Function Library.

Details

Details tab under dockable panel gives you details about the Test Case file as to when it was created with the name of the creator, name of the person who last modified it and when this module was last modified.

Input

Input Parameter allows you to provide input values which can be used in FL steps for iteration.

Output

Output Parameter helps you to save step output which is to be used further.

UsedBy

UsedBy tab under the dockable panel provides details about all the other artifacts which use it. Given details include Name, Full Path, Description, Version_No, Component Type.

Audit Trails

Audit Trails provides the entire audit history details of the function library. The given details include Task, Field, OldValue, NewValue Time Stamp, and ByUser.

Tags

Tags are key-value combination added in the tags panel; they are used for storing information regarding the function library. For example, on which browser or environment we are creating the function library. You can also perform other operations like add, delete, copy, paste, move up and move down.

Execution Status

Execution Status tab in the dockable panel provides you the information about the test execution of the artifact. The information displayed in a tabular form with Session Name, Executed From, Executed By, Execution Time, Executed On & Status as column names.

Was this article helpful to you? Yes No 1