Skip to content

Commit

Permalink
Merge pull request #320 from testsigmahq/dev
Browse files Browse the repository at this point in the history
Dev to main [6 Nov]
  • Loading branch information
jayavel-testsigma authored Nov 6, 2023
2 parents d90f647 + 82884a1 commit 8646058
Show file tree
Hide file tree
Showing 7 changed files with 369 additions and 377 deletions.
19 changes: 9 additions & 10 deletions src/pages/docs/api/examples/update-test-case-results-using-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,32 @@ noindex: false
order: 21.65
page_id: "Update Test Case results using API"
warning: false
contextual_links:
- type: section
name: "Contents"
- type: link
name: "Update Test Case results using REST API"
url: "#update-test-case-results-using-rest-api"
---

<br>
---

In Testsigma, you can update the Test Case Results using API. This article discusses how to update Test Case results as Passed, Failed, and Not Executed using REST API.


This endpoint allows users to update the Test Case result using REST API.


|**Request Type**|**PUT**|
|---|---|
|**Endpoint**|https://app.testsigma.com/api/v1/executions/results/&lt;run_id&gt;/override<br> The &lt;run_id&gt; can be obtained from the Run Results.|
|**Endpoint**|https://app.testsigma.com/api/v1/execution_results/&lt;run_id&gt;/override<br> The &lt;run_id&gt; can be obtained from the Run Results.|
|**Authorization**|Bearer **<API\_Token>**<br>Same as the Testsigma API key mentioned above.|
|**Request Body Type (JSON)**|Raw|
|**Request Body**|[<br>{<br>"testCaseResultId": 3646,<br>"comment": "Modifying the results 1",<br>"result": "SUCCESS"<br>}<br>]<br>|
|**Response Body(JSON)**|{<br>"errors": [],<br>"message": "Overridden the results successfully"<br>}|

**Request fields**<br>

### **Request fields**
**testCaseResultId:** ID of Test Case result.<br>
**comment:** Comment you want to add to change the result.<br>
**result:** The result you want to override the current result.<br>

**Response fields**<br>

### **Response fields**
**errors:** Errors in request fields if there are any.<br>
**message:** Message of overridden results.<br>

Expand All @@ -47,3 +45,4 @@ This endpoint allows users to update the Test Case result using REST API.



---
106 changes: 97 additions & 9 deletions src/pages/docs/api/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ contextual_links:
- type: link
name: "Authorization"
url: "#authorization"
- type: link
name: "Get IDs of Projects, Applications and Uploads"
url: "#get-ids-of-projects-applications-and-uploads"
- type: link
name: "Available REST API Endpoints"
url: "#available-rest-api-endpoints"
Expand All @@ -23,29 +26,114 @@ contextual_links:

Testsigma has a set of REST API Endpoints to manage the entities available in Testsigma. The most common usage of these endpoints is within your CI/CD Pipeline.

A fair understanding of REST APIs is expected. If not, please refer to some relevant resources regarding REST API or consult with your Dev team before proceeding further.
A fair understanding of REST APIs is expected. If not, please refer to some relevant resources regarding REST API or consult with your dev team before proceeding further.

---
##**Authorization**

## **Authorization**

All Testsigma API Endpoints require authentication. The user authenticates the request using Bearer Token which is the user’s API Key.

**“Authentication” : “Bearer <API_key>”**
**“Authentication” : “Bearer <API_Key>”**

To know more about generating and obtaining API Keys, see [how to generate API keys](https://testsigma.com/docs/configuration/api-keys/)

To know more about generating and obtaining API Keys, see [How to generate API Keys](https://testsigma.com/docs/configuration/api-keys/)

---
##**Available REST API Endpoints**

## **Get IDs of Projects, Applications and Uploads**


Testsigma has a set of endpoints to retrieve IDs of projects, applications, and uploads using APIs. This article discusses getting these IDs by using APIs.


### **Get IDs using Postman API**

1. From **My Workspace**, go to **APIs** and click on ‘**+**’ to open a new request.
![APIs](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/pmapis.png)


2. From the new request page, select **GET** from the method dropdown.
![GET Method](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/pmgetmethod.png)


3. On the **URL Textbox**,
![URL Textbox](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/pmurltb.png)
- Enter https://app.testsigma.com/api/v1/projects to get project IDs.
- Enter https://app.testsigma.com/api/v1/applications to get application IDs.
- Enter https://app.testsigma.com/api/v1/uploads to get upload IDs.


Let’s use the first URL & retrieve the IDs of projects.


4. Click on **Authorization**, select **Authorization type** and enter the **Token**.
![Authorization](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/pmauthapi.png)

5. Click on **Send** to retrieve details of all projects.
![Send](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/pmrbsend.png)

6. You’ll find IDs of all projects in the response body.
![IDs](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/pmidfrb.png)

Follow the same steps from 4-6 with the other URLs mentioned in step 3 to get details of applications and uploads.

Here’s a quick GIF demonstrating how to retrieve IDs of projects, applications, and uploads using APIs in Postman.
![Workflow to retrive URL](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/getidspostman.gif)


### **Get IDs using Testsigma API**

1. Create a **Test Case** by navigating to **Create Tests > Test Cases**.
![Test Case](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/tsapitc.png)


2. Add a **REST API Step**.
![REST API Test Step](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/tsrestspiteststep.png)


3. On the **REST API** page, select **GET** from the method dropdown.
![GET Method](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/tsgetmthod.png)

4. On the **URL Textbox**,
![URL Textbox](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/tsurltb.png)
- Enter https://app.testsigma.com/api/v1/projects to get project IDs.
- Enter https://app.testsigma.com/api/v1/applications to get application IDs.
- Enter https://app.testsigma.com/api/v1/uploads to get upload IDs.

Let’s use the second URL & retrieve the IDs of applications.


5. Click on **Authorization**, select **Authorization type** and enter the **Token**.
![Authorization](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/tsapiauth.png)


6. Click on **Send** to retrieve details of all applications.
![Send](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/tssendapi.png)

7. You’ll find IDs of all applications in the response body.


Here’s a quick GIF demonstrating how to retrieve IDs of projects, applications, and uploads using APIs in Testsigma.
![Workflow](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/getidtestsigma.gif)

---

## **Available REST API Endpoints**

1. [Environments](https://testsigma.com/docs/api/environments/)
2. [Elements](https://testsigma.com/docs/api/elements/)
3. [Test Plans](https://testsigma.com/docs/api/test-plans/)
4. [Uploads](https://testsigma.com/docs/api/upload-files/)

---
##**Advanced Use Cases**
Here are some advanced use cases for Testsigma APIs

[Trigger Multiple Application Type Test Plans](https://testsigma.com/docs/api/examples/trigger-multiple-test-plans/)
## **Advanced Use Cases**

Here are some advanced use cases for Testsigma APIs:

- [Trigger Multiple Application Type Test Plans](https://testsigma.com/docs/api/examples/trigger-multiple-test-plans/)

[Trigger Test Plan remotely and wait until Completion](https://testsigma.com/docs/api/examples/trigger-test-plan-wait-completion/)
- [Trigger Test Plan remotely and wait until Completion](https://testsigma.com/docs/api/examples/trigger-test-plan-wait-completion/)

---
55 changes: 55 additions & 0 deletions src/pages/docs/test-data/create-data-profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ contextual_links:
- type: link
name: "Using Test Data Profile in a Test Case"
url: "#using-test-data-profile-in-a-test-case"
- type: link
name: "Data-driven Testing with Dynamic Data Sets"
url: "#data-driven-testing-with-dynamic-data-sets"
- type: link
name: "Additional Actions Possible on Test Data Set Name"
url: "#additional-actions-possible-on-test-data-set-name"
Expand Down Expand Up @@ -92,13 +95,65 @@ Here’s a quick GIF that demonstrates how to create a test data profile.
Here’s a quick GIF that demonstrates how to associate and use test data profile in a test case.
![TDP in Test Cases](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/TDPinTCs.gif)


---

## **Data-driven Testing with Dynamic Data Sets**
In data-driven testing, you can only iterate values from start to end. If you want to iterate from data sets from the middle, you have to set the variables in a prerequisite test case and use the variables as start and end by enabling data-driven testing to the test case.


### **Set the Variables in a Prerequisite Test Case**

1. Create a **Test Case** by navigating to **Create Tests > Test Cases**.

![Test Case](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/tsapitc.png)


2. Store start and end data values in ***RunTime\_TestData\_Set\_Start*** and ***RunTime\_TestData\_Set\_End***, respectively in your test steps.

![Store Values](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/dvsdv.png)


For example, in the above test case, we store **delhi** in ***RunTime\_TestData\_Set\_Start*** and **chennai** in ***RunTime\_TestData\_Set\_End***.


### **Creating Data-driven Test Cases with Dynamic Data Sets**


1. Create a **Test Case** by navigating to **Create Tests > Test Cases**.

![Test Case](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/tsapitc.png)


2. Click on **Test Case Settings** and select the above test case as a prerequisite from the dropdown.

![Test Case Settings](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/ddssprereq.png)


3. Select the **Test Data Profile**, enable the **Data Driven** toggle, and select **Overwrite Test Data Set with runtime variable for Data iterates from/to** dropdowns.

![Set Settings](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/ddstcsettings.png)


4. Create test steps and click on run to execute the test case.


Alternatively, you can also set values using **Data iterates from/to** dropdowns.

![Alternatively](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/ddsalternative.png)

---


## **Additional Actions Possible on Test Data Set Name**

1. **Store**: When a test data profile is associated with a test case. The test data set name associated with the test data profile can be stored into a variable for later use as well. Below is how the syntax for the Store NLP looks like:

![store-iteration-count-test-data-set-name](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/test-cases/step-types/for-loop/store-iteration-count-test-data-set-name.png)


2. **if**: The test data set values, from a test data profile being iterated, can be compared within an if condition too. Below screenshot shows the NLP (The NLP can be added as a part of add-on “String Compare”. You can find the add-ons to use here: https://testsigma.com/addons):

![the verify if NLP that is available with the addon String Compare](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/test-cases/step-types/step-group/verify-with-if-with-string-compare.png)

---
Loading

0 comments on commit 8646058

Please sign in to comment.