1. Home
  2. OpKey Help
  3. 9. Working with Function Libraries
  4. 9.6 Working with Coded Function Library

9.6 Working with Coded Function Library

Overview

The Coded Function Library is an advanced feature of OpKey Web. Coded Function editor provides you with a platform where you can write your own function code of tasks to be performed in test automation. Once, they are written in Java, you can compile Java codes and debug easily. You can execute your Coded Function directly or map them with Test Case and execute them. In addition, Coded Function works as a One Stop Solution for creating Custom Keywords in OpKey as you can write your Custom Keyword specific code in Java, compile it to fix code errors, associate required libraries, import pre-built libraries and execute it. Furthermore, this code can directly be called and used in a Test Case or a Function Library and get Executed.

The need of Coded Function Library

OpKey users sometimes needed a platform where they could write their own code for actions (to be performed during test automation) which could be integrated with other OpKey artifacts. Coded Function Library feature fulfilled all those needs by providing a code editor platform. It allows you to write your own action code in Java, compile it, import pre-built libraries, execute it or map with Test Case. It works as a one-stop platform for writing function codes for the task to be performed, compiling written code, making jar file and using jar file in Custom keyword creation. Now, you will not require Eclipse or any other Java code editor for writing your code, making its jar and using it within your Custom Keywords. You can also import your pre-built libraries at Coded Function Library and compile it. Once, your written code is compiled successfully, you can execute it on your machine by using the corresponding Plugin.

For creating Custom keywords in OpKey, you were required to follow the steps mentioned below:

  1. Write the specific code and save it in .jar file.
  2. Upload the .jar file in OpKey and map it with the associated method.
  3. Create and Add a custom Keyword for it.
  4. Call it in a Test Case or a Function Library(FL).
  5. Execute it.

To skip all the steps above, here arises the need of Coded Function Library. One of the major advantages of Coded Function Library over Custom Keyword is that it can be mapped with a number of Function Libraries & Test Cases and modified frequently as per the requirement.

Prerequisites of Coded Function Library

In order to work on Coded Function Library, there are few prerequisites that need to configure correctly. If it’s not configured in your system then you should follow below given steps and configure the JAVA_HOME path, as required.

1. JAVA_HOME configuration in Windows 10:

  • Make sure that JDK 8 version is installed in your system. (Coded Function Library supports JDK version 8, so far).
  • Click on Start button, Type This PC, right-click on This PC and click on Properties.
  • Click on Advanced system settings tab.
  • Click on Environment Variables link under User Variables section. Click on New and fill values as given below in the screenshot.
  • Click on OK to save.

2. Java Path configuration in Windows 10:

  • Make sure that you have installed JDK 8 version in your system.
  • Click on Start button, Type This PC, right-click on This PC and click on Properties.
  • Click on Advanced system settings tab.
  • Click on Environment Variables link under System Variables section. Click on New and fill values as given below in the screenshot.
  • Click on OK to save.

Was this article helpful to you? Yes No