Create a Testsigma add-on


You should already know about Testsigma add-ons.See:


In Testsigma you can create add-ons for the following use case:

  1. Custom Actions: Testsigma has a comprehensive, built-in actions that lets you automate most user actions in simple English. But sometimes you may need to automate actions unique to your AUT. You can build your own actions and automate those unique actions using add-ons. For more information,refer to How to build a custom action in add-ons.
  2. Test Data Generator: Testsigma has default Data Generators to generate test data for your automation. But you can create your own data generators. For more information,refer to How to build a custom data generator.
  3. Conditional If: You can create an action to execute a sequence of steps if the condition is matched. You can write your own logic for the conditional if. For more information,refer to How to add conditional if actions.
  4. While Loops: You can create an action to execute a sequence of steps until the condition is matched. You can write your own logic for the conditional if. For more information,refer to How to add while actions.

Broadly, this is how you create a Testsigma add-on:

  1. Create an add-on project
  2. Update the code as required in the project
  3. Test the Test Code
  4. Upload the updated project code
  5. Publish the add-on
  6. Additional Step - add-on usage in Test Case

1. Create an add-on template

Navigate to the add-ons page by clicking on the add-ons icon from the navigation bar on the left.

  1. Click on the + New add-on button on the top right to create a new add-on. Testsigma add-on overlay opens up as shown below: Create add-on Form in My add-ons tab on add-ons page
  2. Enter the following details:

    • Add-on name: Name of the add-on.
    • Description: A short description about what the add-on does.
  3. Click on the Create button to create the sample template code. A zip file will be downloaded automatically containing the template code. Create Testsigma add-on using Testsigma add-on Form


2. Update the action code as required

Unzip the downloaded zip file and open the extracted folder in your favorite IDE as a Java project (with Maven as the build tool). The downloaded folder is a Java Maven project folder consisting of a pom.xml file along with example templates for Web/Android/iOS.

Here’s the sample code for Android:

Sample code for Testsigma Android add-on in IDE

Refactor the code based on your requirements by :

  • Modifying the action text.
  • Adding Selenium or Java code for the action to be performed.
  • Changing Elements/locators.
  • In the test class, adding test data.

Here’s some modified code for an Android add-on that swipes left n times:

Updated code for Testsigma Android Swipe Left add-on in IDE

Here’s a GIF that shows all available annotations and their arguments:

Snapshot of the sample code showing most common annotations and options


3. Test the code

Test the code to verify the add-on you have written. You can use either JUnit or TestNG as the Test Runner. Right-click on the Test class to run it as a TestNG or JUnit test and confirm if your code is performing as expected.


4. Upload the updated code to Testsigma

Once you have validated the code, save the changes you made and zip the project folder. You may use the below command on a bash shell:

zip -r addonName.zip . -x ".

Navigate to the add-ons page, select the dropdown for your add-on and click on the Upload Code option to upload the zipped file.

add-on options before code upload

Other available options:

  • Manage Tags: Add more tags/labels for categorizing them. For the swipe left in Android example, for instance, we can use, ‘click’, ‘mobile’.
  • Delete: Delete the add-on.  

5. Publish the add-on

Once the code is uploaded, the add-on options dropdown would show an additional option, Publish:

add-on options after code upload

If you select to publish your add-on, select one of the following on the Publish Add-on window:

  • Public - Choose this option if you want to make the add-on available to the testsigma community.
  • Private -Choose this option if you want to make the add-on available only to users in your organization.

add-on publish private or public Once requested for publishing, an automatic security check is done internally. Upon the successful completion of the security check the add-on is published.In case of a security check failure, an email notification would be sent out to the user.

NOTE:

For trial users once the request to publish is sent, an email will be sent to the Testsigma team for review and you will be notified via email once it is approved.


6. Try using the add-on in a test case

To try out the add-on you just created, create a new test case or open an existing test case and add a new test step. Search for the keywords of the action you just created, select the action from the suggestions, and update the Test Data and Element.

Using custom actions in test steps