You need to be familiar with programming basics and know how to write Java Code(preferably Selenium) to create Custom Functions.
Note: Our Support Team can create a Custom Function for you in a very short time if you would like to avoid the hassle of coding it yourself!
The code written for Custom Functions code in Testsigma should adhere to the following guidelines for it to be recognised by Testsigma compiler:
- There are a set of prerequisite import statements that are to be included. We need to import the TestsigmaCustomFunctions, CustomTestStep, ResultConstants, and TestStepResult Class.
- There should be at least one Class and a Method present in the code.
- Before each method/procedure in the Custom Function Class, we need to provide the @CustomTestStep annotation for the compiler to recognise it as a Custom Function.
- Each of the methods/procedures should have TestStepResult Class as its return type.
- We need to create an Instance of TestStepResult in each of the methods.
- We need to set the 2 required properties(result message and result status) with the TestStepResult Instance using the methods setStatus and setMessage.
- We will set the status as 'SUCCESS' using the setStatus() method with argument 'ResultConstants.SUCCESS' or simply '0'.
- We can set a useful Message for debugging using the setMessage() method.
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
Steps for using the repository
1. Clone this repository and use any of your favourite IDEs(Recommended: Eclipse or Netbeans IDE).
2. Create your Custom Function Class inside any existing or new subpackage of the package com.testsigma.customfunc and resolve compilation errors in the IDE.
3. Copy the entire code to the Create Custom Functions page in Testsigma and click on Compile and Save.
We can use Custom Function program codes essentially of unlimited length. We just need to keep one Class limited to 5000 lines of code(LOC) which is huge compared to the usual requirement of about 100 lines of code.