This document will help you import your Custom Functions from your Java IDE to Testsigma Custom Functions page directly.

This guide is intended for advanced users who have some experience programming in Java. If you are new to programming, please check with your Dev team or Testsigma Support for some help in preparing the Custom Functions.

You can also check the below repository for more examples:

Custom Function Examples



  • IDE(Eclipse/IntelliJ preferred)
  • Maven


Steps to upload Custom Function from IDE

Step 1: Creating Project and adding dependencies

1. Create a new Java Maven project in your IDE.

2. Add the Testsigma Custom Functions maven dependency by pasting the below code to the pom.xml file under the `dependencies` tag:

Note: You can always take the latest version from Maven.

<!-- -->

3. Add others dependencies such as Selenium, Appium e.t.c if required in your Custom Function code.

4. Update the Maven Project to fetch the new dependency.

In Eclipse/IntelliJ: Project(Right click) > Maven > Update Sources/Update Project


Step 2: Create Helper Class for File Upload

1. Create a new Java Class named 'CFUploader' with the below code:

import com.testsigma.restapi.TestsigmaConnector;

public class CFUploader {
//You can get the Testsigma API key from Configurations >> API Keys
        private static final String API_KEY = "eyXXXXXXXXXXXXXXXXXXXXXXXXd";

//Name of the project you want to upload the custom function to
        private static String PROJECT_NAME = "Simply%20Travel%20Demo";

//Absolute File path to the Custom Function java files that needs to be uploaded.
        private static String[] JAVA_FILE_PATHS = new String[] {

    public static void main(String[] args) {
        CFUploader cfUploader =new CFUploader();
//Use the addCF() method to add a new CF
//Use the updateCF() method to update an existing CF


    public void updateCF(){
        TestsigmaConnector tsconnector = new TestsigmaConnector();
        tsconnector.updateCustomFunctions(API_KEY, PROJECT_NAME, JAVA_FILE_PATHS);

    public void addCF(){
        TestsigmaConnector tsconnector = new TestsigmaConnector();
        tsconnector.addCustomFunctions(API_KEY, PROJECT_NAME, JAVA_FILE_PATHS);
2. Update the variables in the above code as required:

API_KEY: Generated from Testsigma App - Configurations > API Keys
PROJECT_NAME: The Testsigma Project under which you are trying to upload this Custom Function. If your Project name has spaces, please replace the space with '%20'
For example, Simply Travel Demo will be Simply%20Travel%20Demo

JAVA_FILE_PATHS: The absolute path to the java files that need to be uploaded.


Step 3: Create the Custom Function Java Class to be uploaded

1. Create a new Java Class with the default package(mostly in src/main/java folder) and add your Custom Function code there. Make sure you follow the code guidelines while creating the Custom Functions

Custom Function code guidelines

2. Compile the code and resolve all the compilation errors.


Step 4: Upload the Custom Function

1. Execute the main method in CFUploader class.

2. If you are uploading the Custom Function for the first time, use the cfUploader.addCF() method and comment the cfUploader.updateCF() line.

3. If you are updating an existing Custom Function, use the cfUploader.updateCF() and comment the cfUploader.addCF() line.

4. Check the console to see the response. If it succeeds, you will get a success message. Else, you will get error message with the reason for compilation failure. Correct the errors and try again.

5. Once you get the success message, go back to the Custom Functions page in Testsigma under the mentioned Project and refresh the page to find the Custom Function there.

6. If you made some changes in your code and want to update the CF code in Testsigma, comment the addCF() method and uncomment the updateCF() method and run again.