Skip to content

Commit

Permalink
Added doc for Mock API Support (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
bharathk08 authored Jul 19, 2024
1 parent ac1be28 commit 14e85d2
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/left-nav-title.json
Original file line number Diff line number Diff line change
Expand Up @@ -681,5 +681,6 @@
"record-elements": {"/docs/elements/mobile-web-application/record-elements/": "Record Multiple Elements" },
"add-test-cases-for-mobile-web-app": {"/docs/test-cases/manage/add-test-cases-for-mobile-web-app/": "Test Cases (Mobile Web App)" },
"most-common-issues": { "/docs/troubleshooting/salesforce-testing/most-common-issues/": "Most Common Issues" },
"developer-mode-for-ios": {"/docs/troubleshooting/mobile-apps/developer-mode-for-ios/": "Developer Mode (iOS 16 & Above)" }
"developer-mode-for-ios": {"/docs/troubleshooting/mobile-apps/developer-mode-for-ios/": "Developer Mode (iOS 16 & Above)" },
"mock-apis": {"/docs/test-cases/create-steps-restapi/mock-apis/": "Mock API Support" }
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ contextual_links:
---

---

Adding body data in RESTful API testing is the process of sending additional data to the server in the body of the request. You will need to send body data with requests whenever you need to add or update structured data. For example, if you're sending a request to add a new customer to a database, you might include the customer details in **JSON**. Typically, you will use body data with **PUT**, **POST**, and **PATCH** requests.

[[info | NOTE:]]
Expand Down
62 changes: 62 additions & 0 deletions src/pages/docs/test-cases/create-steps-restapi/mock-apis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: "Mock API Support in Testsigma"
page_title: "Mock API Support in Testsigma"
metadesc: "Learn how to handle mock APIs and experiment with the different types of test data | Testsigma allows you give inputs while mocking an API in Testsigma"
noindex: false
order: 4.993
page_id: "Mock APIs"
search_keyword: ""
warning: false
contextual_links:
- type: section
name: "Contents"
- type: link
name: "Prerequisites"
url: "#prerequisites"
- type: link
name: "Adding Various Inputs for Mock APIs"
url: "#adding-various-inputs-for-mock-apis"
---

---

The goal of mocking an API is to ensure that users can experiment with the data before authoring the API step. With Testsigma, users can select default and custom values associated with each key for various variables, such as parameters, runtime, environment, random data generator, phone number, and mailbox, and verify responses.

This article discusses providing test data inputs while mocking an API in Testsigma.

---

> ## **Prerequisites**
>
> - You should know how to [create a Test Case](https://testsigma.com/docs/test-cases/manage/add-edit-delete/#creating-a-test-case).
>
> - You should know how to [add Rest API in the test steps](https://testsigma.com/docs/test-cases/step-types/rest-api/#add-restful-api-in-test-steps).
---

## **Adding Various Inputs for Mock APIs**

1. From the left-side navbar, select **Create Tests > Test Cases** and then click **Create Test Case**.

2. On the **Test Case Details** page, click the option next to the test step and select **Rest API**.

3. Click on the test step to open the **Rest API** window.

4. Enter the **Title**, choose the **Method**, and enter the **Endpoint**.

5. Select the data you want to parametrize and click **Insert Test Data**.

6. Choose the test data type you want to add (e.g., **@Parameter**).

7. Click **Add Request Values**. The **Request values** overlay will open.

8. In the **Request Values** overlay, click **URL**, add the value to the parameter in the **URL**, and click **Apply**.

9. Click **Send** and verify the response received from the API.


Here’s a quick GIF demonstrating an example of adding an input for mocking API.

![Mock APIs](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/MockAPI.gif)

---
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ warning: false
contextual_links:
- type: section
name: "Contents"
- type: link
name: "Prerequisites"
url: "#prerequisites"
- type: link
name: "Resources"
url: "#resources"
Expand All @@ -21,9 +24,11 @@ Testsigma supports Restful APIs Testing. RESTful APIs allow you to access resour

---

### **Prerequisites**

You'll need to know how to [create a test case](https://testsigma.com/docs/test-cases/manage/add-edit-delete/#creating-a-test-case) and [add RESTful API in the test steps](https://testsigma.com/docs/test-cases/step-types/rest-api/#add-restful-api-in-test-steps).
> ## **Prerequisites**
>
> - You should know how to [create a Test Case](https://testsigma.com/docs/test-cases/manage/add-edit-delete/#creating-a-test-case).
>
> - You should know how to [add Rest API in the test steps](https://testsigma.com/docs/test-cases/step-types/rest-api/#add-restful-api-in-test-steps).
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ contextual_links:
---

---

Stored objects have **GLOBAL** scope, which can be used for cross-test case verification. Objects can be saved using the Rest API. Stored objects in RESTful API testing refer to the data that is stored in the database and is used to test the API. This data can include user accounts, product information, and other data that is used to test the API. The stored objects are used to ensure that the API is functioning correctly and that the data is being returned correctly. You can **download** objects from **save response** and **stored objects** tab.

---

## **Store Objects from Save response**

1. **Send** an API request, and at the bottom of the screen, the **response body** will appear for the request you sent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,55 @@ Testsigma platform allows you to execute your tests using different Test

Let’s learn more about these grids.

1. [Testsigma Labs](https://www.testsigma.com/)
1. Testsigma Labs

This option allows you to run tests on Testsigma′s own cloud infrastructure. Testsigma Labs hosts a set of devices which can be used to run the tests with maximum security and compatibility. This is the recommended option as the systems are pre-configured with optimal settings for the test environments and the devices are used for only one purpose, i.e for running tests.
This option allows you to run tests on Testsigma′s own cloud infrastructure. Testsigma Labs hosts a set of devices which can be used to run the tests with maximum security and compatibility. This is the recommended option as the systems are pre-configured with optimal settings for the test environments and the devices are used for only one purpose, i.e for running tests.
Use this option only if the application that you need to test is accessible over the Internet and not blocked by the firewall of a company network.

2. Local Devices

It enables you to use your own local machines for setting up the test environment and running the tests on them. This is the most preferred option if your application is hosted locally on company premises and is not accessible over the internet and this is mostly the case when an application is under active development.
It enables you to use your own local machines for setting up the test environment and running the tests on them. This is the most preferred option if your application is hosted locally on company premises and is not accessible over the internet and this is mostly the case when an application is under active development.

Note: You need to install a helper agent application on your local machine to use this option. This agent configures the connection between Testsigma servers and your machine to perform the Test Plan on your local machine.
[[info | **NOTE**:]]
| You need to install a helper agent application on your local machine to use this option. This agent configures the connection between Testsigma servers and your machine to perform the Test Plan on your local machine.

Learn [how to Create a Test Plan to Run Tests on Local Machines](https://testsigma.com/tutorials/test-plans/using-local-devices/).
Learn [how to create a Test Plan to run tests on mocal machines](https://testsigma.com/tutorials/test-plans/using-local-devices/).

3. [BrowserStack](https://www.browserstack.com/#)

Testsigma also allows us to use cloud devices on the BrowserStack Model to run your tests. You just need to integrate your BrowserStack account with your Testsigma Account by entering the login credentials. Also, while creating a test plan, provide the required device details on the test plan configurations page.
Testsigma also allows us to use cloud devices on the BrowserStack Model to run your tests. You just need to integrate your BrowserStack account with your Testsigma Account by entering the login credentials. Also, while creating a test plan, provide the required device details on the test plan configurations page.

Learn how to [Configure BrowserStack](https://testsigma.com/docs/integrations/test-labs/browserstack/).

Use this option only if the application that you need to test is accessible over the Internet and not blocked by the firewall of a company network.

4. [Sauce Labs](https://saucelabs.com/)

Similar to BrowserStack, it is possible to use Sauce Labs for your test execution by integrating it with Testsigma Account. You just need to integrate your Sauce Labs account with your Testsigma Account by entering the login credentials. Also, while creating a test plan, provide the required device details on the test plan configurations page.
Similar to BrowserStack, it is possible to use Sauce Labs for your test execution by integrating it with Testsigma Account. You just need to integrate your Sauce Labs account with your Testsigma Account by entering the login credentials. Also, while creating a test plan, provide the required device details on the test plan configurations page.

Learn how to [Configure Sauce Labs](https://testsigma.com/docs/integrations/test-labs/sauce-labs/)

Use this option only if the application that you need to test is accessible over the Internet and not blocked by the firewall of a company network.

5. [Kobiton Test Lab](https://kobiton.com/)

Testsigma also allows us to use cloud devices on Kobiton Test Lab to run your tests. You just need to integrate your Kobiton Test Lab account with your Testsigma Account by entering the login credentials. Also, while creating a test plan, provide the required device details on the test plan configurations page.
Testsigma also allows us to use cloud devices on Kobiton Test Lab to run your tests. You just need to integrate your Kobiton Test Lab account with your Testsigma Account by entering the login credentials. Also, while creating a test plan, provide the required device details on the test plan configurations page.

Use this option only if the application that you need to test is accessible over the Internet and not blocked by the firewall of a company network.

6. [LambdaTest](https://www.lambdatest.com/)

Testsigma also allows us to use cloud devices on LambdaTest to run your tests. You just need to integrate your LambdaTest account with your Testsigma Account by entering the login credentials. Also, while creating a test plan, provide the required device details on the test plan configurations page.
Testsigma also allows us to use cloud devices on LambdaTest to run your tests. You just need to integrate your LambdaTest account with your Testsigma Account by entering the login credentials. Also, while creating a test plan, provide the required device details on the test plan configurations page.

Use this option only if the application that you need to test is accessible over the Internet and not blocked by the firewall of a company network.

5. Private Grid

Similar to Local Devices, a Private grid allows you to configure a set of Machines for local Execution. Please contact the Testsigma Support team for more details as this involves Advanced Steps.
Similar to Local Devices, a Private grid allows you to configure a set of Machines for local Execution. Please contact the Testsigma Support team for more details as this involves Advanced Steps.

For more info, see [Testsigma Private Grid](https://testsigma.com/docs/runs/executing-tests-in-private-grid/)




---

0 comments on commit 14e85d2

Please sign in to comment.