10.2 Getting started with Coded Function Library
After successfully login into OpKey Web, select the appropriate Project in which you want to create a Coded Function Library.
- You will be navigated to the OpKey Dashboard screen as shown below:
- You can mark the “Don’t show me again” checkbox as checked if you do not wish to view this notification again.
- Click “End Tour” to proceed with the process of creating a Coded Function Library file.
How to create a Coded Function Library File?
Method 1
After clicking on “End Tour” , you may “Click to Create New Artifact“. Select Coded Function Library from the dialer page.
- The “Coded Function Library” text will get highlighted.
- Click on the highlighted icon to create a New Coded Function Library file. A Create Coded FL window will get open as shown
- The fields marked with * are mandatory. Enter the Name of the Coded FL . You can also enter the Description. Click OK.
Method 2
Go to Project Workspace > Select the root Folder > Click Create New file icon > Select Coded FL .
A Coded FL file will be created in the root Folder of the project Workspace.
You may rename the Coded FL accordingly.
Method 3
Right click on root folder > select Create New > select ‘Coded FL ’.
A Coded FL file will be created in the root Folder of the project Workspace.
The Coded Function Library window will get opened. It has three major sections:
- First Section is the Import Section which allows you to import any required pre-built library.
- Second section is for User Defined code section which allows you to write user defined code.
- Third section is Private Functions which allows you to create user defined private functions in to it.
You can write the specific java code in the Coded Function Library.
Getting Familiar with the Coded FL Buttons:
Mapping Associated libraries with Coded FL
Libraries are the Jar files which contain specific Java code for performing an action. These libraries are created by user for for creating Custom Keywords. Now you can import those libraries to the Coded FL, compile them here, execute them and use them in Custom Keywords, as required. Used associated Libraries can be executed in Run Now and Debug now mode.
Follow below given steps to associate and use pre-built libraries:
- Click on the Libraries tab.
- Window containing Linked and Associated Libraries opens as follows.
- Select your library file from the list of Linked Libraries and click on Associate button to add them to the Associated Library list.
Let us see now how to import Package(s) to the Coded FL from the Associated Libraries. You should have know the Package, Class of the Associated Library/Jar file.
In the below given screenshot, you can have a look at the Associated Library file code (package and class).
- Write the Import syntax for importing Package(s) and Class of the associated jar file in the Import Section of the Coded FL as:
import Package_Name.Class_Name
For example: Here, SumPck is the Package name and Division is the Class name in the associated library.
- Let us write a division code in the User Code section. Here, we will divide 10 by 5 which results output as 2. You need to add an Output Parameter of Integer type which will store the Output of Division.
- Once, codes are written successfully, Save it.
Intellisense in Coded Function Library
While writing Java Code in the Coded FL editor, Intellisense feature helps user to view suggested syntax which can be used. Make sure that the Intellisense toggle button is in On state. User can press Ctrl+Spacebar button to trigger the Intellisense and view list of all the suggested syntax to be used.
OpKey Coded FL Compiler window appears. It establishes connection between OpKey Server and client machine.
Now, behavior of Intellisense has been improved. This new version now supports:
- Global Variables
- Local variables
- Classes name
- Input parameters
- Output Parameters
- The Object, Class, Method, Local variables in Intellisense proposal window are visible with their icons.
- Intellisense proposal window now shows all context of available plugins.
- The Classes and Methods of the imported package from associated jar, are now visible in the Intellisense proposals.
Using Coded FL file in Test Case & Function Libraries:
- You can map your Coded FL file with the Test Case or Function Library file.
- Create an FL or a Test Case. Navigate to the Add Keyword section, click on Coded FL tab and select your Coded FL file(s) to be added.
- The Selected Coded FL will get added in to the FL as shown below:
- Once the Coded FL gets added in to the FL. You can add other desired steps in to it.
- Click Run Now, to execute the FL.
- The Execution wizard window will get opened and the FL will get executed.
- You can also generate the desired reports.
Getting familiar with the Dockable Panel Tabs of Coded FL:
(1) Details:

(2) Input:

Output tab under Dockable panel allows you to add Output Parameters to the Coded FL. Added Output Parameters get reflected in the Non-editable section of Coded FL as shown below.
(4) UsedBy:
UsedBy tab under the dockable panel provides information about uses of the Coded FL within a TC or FL.
(5) AuditTrails:
AuditTrails tab under dockable panel of the dockable panel provides detailed information (Task, Field, Old Value, New Value, Time Stamp and By User) about the entire changes made to the Coded FL by the user.
(6) Tags:
From Tags tab under dockable panel in the Coded FL, you can add tags. These tags are very helpful in case you want to search your specific Coded FL file from the list of the Coded FL files.
(7) 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.
(8) Compilation Result:
Compiling Java Code:
- Map Associated Libraries to your code.
- Write your action code, as required.
- Save Coded FL file.
- Click on Compile button.

- When you select the required plugin from the dropdown list, your code get changed as per the selected plugin. After selecting plugin, you should refresh the page.
- Compilation process starts which will take few seconds. Once, it get completed, you can view the code errors in the console view showing under Compilation Result tab in dockable panel.
Executing Coded FL in Run Now mode:
- Map Associated Libraries to your code.
- Write your action code, as required.
- Select Target Plugin from the list.
- Save Coded FL file.
- Click on Run Now button.
- Fill all required fields in the Local Execution Wizard and click on Next.
- Execution Process starts successfully.
Here, you can view the Execution Logs.
- Once, execution process has completed, you can view at the Execution Result.

While working on Coded Function Library feature on Mac machine, local OpKey Agent will not be required for executing Coded Function Library. You can now execute your Coded FL through Spock Agent. Furthermore, you don’t need to install different plugins as Local Agent is not required.
Executing Coded FL in Debug mode:
Now, Spock Agent in Coded Function Library in OpKey supports Java 11. You can execute your Coded FL (developed with Java 11) on Spock Agent.
- Map Associated Libraries to your code.
- Write your action code, as required.
- Select Target Plugin from the list.
- Save Coded FL file.
- Click on Debug Now button.
- Fill all required fields in the Local Execution Wizard (Debug Mode) and click on Next.
- Execution Process starts successfully.
Here, you can view Debug mode execution logs along with the Debugger Window. Debugger window reflects detailed information about the currently executing test step and other details.

OR Tree Implementation in Input Parameters:
Now, user can view the list of OR tree added in the Input Parameter and use them within the Coded Function Library, as required. You can add new Input Parameter as OR Object Data Type and provide default OR value from the OR tree.
- Click on Input. InputParameter tab opens as shown below:
- Click on Add button to add a new Input Parameter. An Input parameter with input-parameter-1 name has been added.
- Navigate to Data Type dropdown tab and click on it. Select ORObject from the dropdown list of Data Types.
- Navigate to the Default Value tab and click on it.
- Browse and select your desired object. Your ORObject input parameter has been added successfully to the Coded Function Library.