Familiarity with Java Selenium APIs is expected to created 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.
The Custom Functions code should adhere to the following guidelines for successful compilation and execution:
- Import Mandatory classes. Refer Code Usage - 1
- Create at least one Class and Method.
- Declare @CustomTestStep Annotation for each Custom Function method.
- 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 Code Usage - 2 and 3
- We need to import the following classes -
- 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
- Method setMessage can be used to set the Test Step result message as follows -
- setMessage("User specific message") for debugging purposes
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 to create Custom Functions
1. Clone this repository and use any of your favourite IDEs(Recommended: Eclipse or Netbeans IDE).
2. Create a sub-package inside 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.
Check the following article for more details on creating Custom Functions - How to create and use Custom Functions in Testsigma?
P.S: 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.