Prerequisite: Familiarity with Java Selenium APIs is expected to create Custom Functions.

Note: Our Support Team can help you in creating Custom Functions in a matter of hours subject to requirement feasibility and availability of Test Automation Experts.

In the next section, we will see how to clone the Testsigma Sample Custom Function Repository to your IDE for viewing some sample Custom Functions and to create Custom Functions easily with IDE-based suggestions.

Cloning the repository

1. Clone this repository and import the same into any of your favourite IDEs(Recommended: Eclipse IDE).

Testsigma Custom Functions Repository

2. Add all dependencies and resolve compilation errors in the IDE.

3. Optional - Create a sub-package inside the package com.testsigma.customfunc to add your custom function class.

4. Refer to one of the existing custom function class in the example package or refer to examples section below in this article to write your custom function.

5. Once you complete writing custom function in IDE copy the entire code to the Create Custom Functions page in Testsigma and click on Compile and Save.

Check the following article for more details on creating Custom Functions - How to create and use Custom Functions in Testsigma?

Note: Though there is no limitation in Custom Function Lines of Code, it is suggested to keep the size of the Class less than 100 lines of code.


The Custom Functions code should adhere to the following guidelines for successful compilation and execution:

  • Import Mandatory classes. Refer point 1 under the section Code Usage below.
  • Create at least one Class and Method.
  • Declare the Annotation '@CustomTestStep' for each Custom Function method.
  • Do not declare the WebDriver class or its implementations. Use the variable 'driver' for WebDriver Implementation Object. Refer point 2 under the section Code Usage below.
  • Declare 'TestStepResult' Class as Return Type for each Custom Function method.
  • Create TestStepResult instance and use the methods 'setStatus()' and 'setMessage()' for each Custom Function method. Refer the points 3 & 4 under the section Code Usage below.

Code Usage

1. We need to import the following classes -

  • com.testsigma.customfunc.common.TestsigmaCustomFunctions
  • com.testsigma.customfunc.common.CustomTestStep
  • com.testsigma.customfunc.common.ResultConstants
  • com.testsigma.customfunc.common.TestStepResult

2. An instance of WebDriver Implementation has been initialized implicitly. You can use the 'driver' variable to access the webdriver instance.

For example, the following line of code would work without any additional changes:


3. Method setStatus can be used to set the Test Step result status as follows -

  • setStatus(ResultConstants.SUCCESS) or setStatus(0) for Custom Test Step Success
  • setStatus(ResultConstants.FAILURE) or setStatus(1) for Custom Test Step Failure

4. Method setMessage can be used to set the Test Step result message as follows -

  • setMessage("User specific message") for debugging purposes

Code Example

An Example of the Custom Function following all the above guidelines is given below:

The above given Custom Function is a simple one that navigates to the Testsigma website. You can find more examples for Custom Functions in our public repository
Testsigma Bitbucket Repository