Skip to content

Commit

Permalink
Updated Creating an Addon Doc
Browse files Browse the repository at this point in the history
  • Loading branch information
sangithravichandran committed Aug 9, 2024
1 parent cf5910d commit 5a8bd9a
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 104 deletions.
179 changes: 76 additions & 103 deletions src/pages/docs/addons/create.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "Create a Testsigma add-on"
metadesc: "This article discusses how to create an addons for customized actions in Testsigma application | Creating addons will boost your Test Automation"
title: "Creating an Addon in Testsigma"
pagetitle: "Create Custom Add-ons: Automate Unique Actions Easily"
metadesc: "Create an add-on in Testsigma to automate custom actions, data generation, and more. Follow simple steps to extend your testing capabilities."
noindex: false
order: 17.5
page_id: "Create a Testsigma add-on"
Expand All @@ -10,150 +11,122 @@ contextual_links:
- type: section
name: "Contents"
- type: link
name: "In Testsigma you can create add-ons for the following use case"
url: "#in-testsigma-you-can-create-add-ons-for-the-following-use-case"
name: "Prerequisites"
url: "#prerequisites"
- type: link
name: "1. Create an add-on template"
url: "#1-create-an-add-on-template"
name: "Understanding the Purpose of Addons"
url: "#understanding-the-purpose-of-addons"
- type: link
name: "2. Update the action code as required"
url: "#2--update-the-action-code-as-required"
name: "Creating an Addon Template"
url: "#creating-an-addon-template"
- type: link
name: "3. Test the Code"
url: "#3-test-the-code"
name: "Updating the Action Code"
url: "#updating-the-action-code"
- type: link
name: "4. Upload the updated code to Testsigma"
url: "#4-upload-the-updated-code-to-testsigma"
name: "Validating the Addon Code"
url: "#validating-the-addon-code"
- type: link
name: "5. Publish the add-on"
url: "#5-publish-the-add-on"
name: "Uploading the Updated Code"
url: "#uploading-the-updated-code"
- type: link
name: "6. Try using the add-on in a Test Case"
url: "#6-try-using-the-add-on-in-a-test-case"
name: "Publishing the Addon"
url: "#publishing-the-addon"
- type: link
name: "Using the Addon in a Test Case"
url: "#using-the-addon-in-a-test-case"
---

---

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

* [What is an add-on?](https://testsigma.com/docs/addons/what-is-an-addon/)

* [Prerequisites for creating an add-on](https://testsigma.com/docs/addons/pre-requisite-to-create-addon/).

Testsigma enables you to extend its functionality by creating add-ons. You can use add-ons to perform specific tasks that the default features of Testsigma do not cover. This document guides you through the process of creating and using an addon in Testsigma.

---
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](https://testsigma.com/tutorials/addons/how-create-addons-actions/)*.

2. **Test Data Generator:** Testsigma has [default Data Generators](https://testsigma.com/docs/test-data/data-generators/default-list/) 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](https://testsigma.com/tutorials/addons/how-create-addons-test-data-generators/)*.

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](https://testsigma.com/tutorials/addons/how-create-addons-conditional-if/)*.

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](https://testsigma.com/tutorials/addons/how-create-addons-while-loops/)*.
## **Prerequisites**

Broadly, this is how you create a Testsigma add-on:
Before you start creating an addon, ensure you have:

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
- Basic understanding of Java and Maven.
- Ensure you have JUnit or TestNG configured as the Test Runner in your IDE.
- Set up a development environment with an IDE for Java (e.g., IntelliJ IDEA, Eclipse).

---

## **1.** **Create an add-on template**
## **Understanding the Purpose of Addons**

Navigate to the add-ons page by clicking on the add-ons icon from the navigation bar on the left.
Addons in Testsigma enhance your testing capabilities by enabling you to create custom functionalities tailored to your specific needs. Each add-on action has a distinct purpose:


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](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/addons/create/addon-create-updated-screenshot.png)

2. Enter the following details:
<br>
* **Add-on name**: Name of the add-on.<br>
* **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](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/addons/create/addon-create-gif.gif)

&emsp;
- **Custom Actions**: You can automate tasks specific to your application using Custom Actions not covered by Testsigma's built-in actions. Integrate unique functionalities into your tests as needed with these actions. For more details, refer to the guide on how to build a [custom action in addons](https://testsigma.com/tutorials/addons/how-create-addons-actions/).
- **Test Data Generators**: Create custom data generators for the specific test data your scripts require. Customize these generators to fit the unique data needs of your testing scenarios. For more information, refer to how to build a [custom data generator addon](https://testsigma.com/tutorials/addons/how-create-addons-test-data-generators/).
- **Conditional If Actions**: Execute a sequence of steps based on specified conditions to control test flows dynamically. You can use these actions to manage test execution based on runtime conditions. For further details, check how to create [conditional if loop addon](https://testsigma.com/tutorials/addons/how-create-addons-conditional-if/).
- **While Loops**: Repeat the steps until you meet a condition, which is useful for scenarios that require multiple iterations. Implement these loops to handle repetitive actions until you achieve the desired outcome. For guidance, see how to create [while loop addon](https://testsigma.com/tutorials/addons/how-create-addons-while-loops/).
- **Post-Plan Hooks**: Define actions that run after the completion of a test plan, regardless of its outcome, using Post-Plan Hooks. Use these hooks to automate tasks that need to occur after a test plan finishes. For further details, here is how you can create a [Post-Plan Hook addon](https://testsigma.com/docs/addons/create-a-post-plan-hook-add-on/).

---
## **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](https://docs.testsigma.com/images/create/addon-sample-code-android.png)

## **Creating an Addon Template**

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](https://docs.testsigma.com/images/create/addon-updated-code-swipe-left-android.png)

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

![Snapshot of the sample code showing most common annotations and options](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/Addonnew.gif)
1. Click on the **Addons** icon from the left navigation bar.
2. Click on the **+ New Addon** button at the top right of the Addons page.
3. Enter the **Addon Name** and provide a brief **Description** of what the addon does on the **Testsigma Addon** pop-up, then click **Create**. A zip file containing the template code will be downloaded automatically.
4. Alternatively, open the addon and click the **Download** icon to get the source code. This action will download a zip file containing the sample template code, which you can use to add your code. ![creating an addon](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/creating_an_add_on.gif)

---
## **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.
## **Updating the Action Code**

---
## **4.** **Upload the updated code to Testsigma**
1. Unzip the downloaded file and open the extracted folder in your IDE as a Java project. Ensure that Maven is set as the build tool.
2. The downloaded folder contains a Java Maven project with a **pom.xml** file and sample templates for **Web**, **Mobile Web**, **Android**, and **iOS Application**. ![Snapshot of the sample code showing most common annotations and options](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/Addonnew.gif)
3. Refactor the sample code based on your requirements:
- **Action Text**: Customize the action text.
- **Selenium or Java Code**: Add Selenium or Java code to define the action.
- **Elements/Locators**: Modify elements or locators as needed.
- **Test Data**: Update the test data in the test class according to your requirements. ![Updated code for Testsigma Android Swipe Left add-on in IDE](https://docs.testsigma.com/images/create/addon-updated-code-swipe-left-android.png)

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:
[[info | Example:]]
| Here’s how you can change the code for an Android add-on to swipe left a specific number of times.

`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.
## **Validating the Addon Code**

![add-on options before code upload](https://docs.testsigma.com/images/create/addon-options-dropdown-before-upload.png)
1. Use JUnit or TestNG as your test runner.
2. Right-click on the test class in your IDE and choose to run it as a JUnit or TestNG test.
3. Verify that the add-on performs as expected. ![validate addon code](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/validate_addon_code.png)

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’.
## **Uploading the Updated Code**

* **Delete**: Delete the add-on.
&emsp;
1. Once you have validated the code, save your changes. Zip the project folder. You can use a command in a bash shell like:
```bash
zip -r addonName.zip . -x "*"
```
2. Go to the **Addons** page, select your add-on, and click **Upload Code**. Browse and select the zipped file, then click **Update**. ![upload actions code](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/upload_action_code.gif)
3. Additional options in the dropdown include:
- **Edit Description**: Update the description of your add-on if needed.
- **Manage Tags**: Add tags or labels to organize your add-on.
- **Deprecate**: Delete the add-on if necessary.

---
## **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](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/addons/create/add-ons-1.png)

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

* **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.
1. After uploading the code, click on **Publish** from the dropdown menu. Then, choose your publish options:
- **Public**: Make the add-on available to the entire Testsigma community.
- **Private**: Restrict availability to users within your organization.
2. An automatic security check will be done. If it passes, the add-on will be published. If it fails, you will get an email notification. ![publish addon](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/publish_addon_ts.gif)

![add-on publish private or public](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/addons/create/publish_addon.png)
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.
[[info | NOTE:]]
| Testsigma Support team will review your publishing request for trial users and send you an email notification once they approve the add-on.

---

[[info | **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.
## **Using the Addon in a Test Case**

1. Create a new test case or open an existing one. Click **Add New Step** and search for the action using the keywords.
2. Look for the **Addon** icon before the test step to indicate it's from the Addon.
3. Select it from the suggestions, update the test data and element, and then click **Create Step**. ![using addon in test case](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/use_addon_in_testcase.gif)

---
## **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](https://docs.testsigma.com/images/create/custom-addons-in-test-steps.png)

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Running tests in parallel allows multiple tests to run simultaneously, which red
[[info | NOTE:]]
| - When you add a new machine to a test suite, the **Run in Parallel** checkbox is selected by default.
| - To remove the parallel execution settings, follow the steps above and uncheck the boxes for **Run Test Suites in Parallel** and **Run Test Cases inside the Test Suite in Parallel**.
| - Your account plan and the remaining parallel test slots determine how many parallel tests you can run.
| - Upgrade your subscription for parallel and queued runs to run more tests simultaneously.

<style>
.example-container {
Expand Down

0 comments on commit 5a8bd9a

Please sign in to comment.