After successfully login into OpKey Web, select the appropriate Project in which you want to create a Coded Function Library.

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.


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:
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:

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).
import Package_Name.Class_Name
For example: Here, SumPck is the Package name and Division is the Class name in the associated library.

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:

Using Coded FL file in Test Case & Function Libraries:



Getting familiar with the Dockable Panel Tabs of Coded FL:
There are various tabs in the dockable panel of the Coded FL. They are used for performing different tasks.
(1) Details:
Here, you can view detailed information (created by, created on, modified by and modified on) about about the Coded FL.

(2) Input:
Input tab under Dockable panel allows you to add Input Parameters to the Coded FL. Added Input Parameters get reflected in the Non-editable section of Coded FL as shown below.

(3) Output:
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:
Compilation Result tab provides the result of your Java code compilation in the console view.
Compiling Java Code:
Once, you have mapped desired associated libraries and written your Java Code, you need to compile it. Code compilation leads easily identification of existing code errors. You can view the code errors in the Compilation Result tab showing under the dockable panel. You need to follow below given steps while compiling Java code in Coded FL:


Executing Coded FL in Run Now mode:
Once, your java code has been compiled successfully, you can execute your Coded FL file. However, it’s not mandatory to compile your Java Code before execution through Run Now. When you execute your Coded FL file, code compilation process runs prior to execution.
Here, you can view the Execution Logs.



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:
It is an alternative way of execution which allows developers to execute test and debug existing bugs quickly and easily. You can click on Debug Now button and follow steps which are similar to the execution through Run Now. During ongoing execution process, you can pause a step, debug it and do more. OpKey Debugger allows you to execute Test, stepwise and view associated input arguments/objects. For Test Execution in Debug mode, you can pause, resume, skip, shrink window, add breakpoint to a Test Step etc. In paused mode, you can view all associated input arguments & object properties and verify them and resume Test Execution later.
During Test Execution, you can also put a breakpoint for a specific Test Step which has not yet been executed. When the Test Step with the breakpoint is executed, the execution process get paused until it is resumed. Breakpoints cannot be applied on a recovery scenario Test Step. If you want to stop your Test Execution at once, click on Stop button to do so. In paused execution mode, Step Into (F6) button allows you to start the Test Execution and automatically pause the execution of next Test Case or Function Library.

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.
Follow the below mentioned steps to execute Coded FL in Debug mode:
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.


