You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting-started-with-agent-to-agent-testing.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,10 +53,15 @@ TestMu AI [Agent Testing](https://www.testmuai.com/agent-testing/) Platform vali
53
53
54
54
It is the first platform to test chat, voice, phone, and image agents in one place. Connecting an agent takes three inputs and no SDK: upload the documents that describe it, define its intended behavior, and point the platform at its endpoint or phone number.
title: Boost Your API Testing Efficiency with HyperExeucte
3
+
title: How to Perform API Testing With REST Assured on HyperExecute
4
4
hide_title: false
5
-
sidebar_label: API Testing
6
-
description: Master API Testing with HyperExecute! This technical doc explains API test automation using Hyperexecute. Learn how to ensure efficient API testing.
5
+
sidebar_label: "REST Assured"
6
+
description: Run a REST Assured (Java + Maven) API test suite on HyperExecute. Download the CLI, set your credentials, configure hyperexecute.yaml, and trigger a cloud run.
7
7
keywords:
8
8
- hyperexecute api testing
9
9
- api automation hyperexecute
@@ -25,6 +25,7 @@ import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/co
25
25
import Tabs from '@theme/Tabs';
26
26
import TabItem from '@theme/TabItem';
27
27
import BrandName, { BRAND_URL } from '@site/src/component/BrandName';
28
+
import DocCard from '@site/src/component/DocCard';
An API acts as a middleman between different software applications, allowing them to communicate and exchange data. Just like any other part of a software system, APIs need to be thoroughly tested to ensure they function as intended.
55
+
To run REST Assured API tests on HyperExecute, download the HyperExecute CLI, set your TestMu AI credentials, point the CLI at a `hyperexecute.yaml` configuration, and trigger the run. REST Assured is a Java library for testing REST APIs, and HyperExecute is the TestMu AI test orchestration platform that discovers your tests, runs the suite on its cloud grid, and reports the results in the dashboard.
55
56
56
-
## Why is API Testing Important?
57
+
Run your own REST Assured (Java + Maven) project or the ready-made sample used in the steps below.
57
58
58
-
API testing is crucial for several reasons:
59
+
## Prerequisites
59
60
60
-
-**Ensures application functionality:** It verifies that the API delivers the correct data and behaves as expected under various conditions.
61
-
-**Catches bugs early:** By testing APIs early in the development process, you can identify and fix issues before they impact the overall application.
62
-
-**Improves application reliability:** Robust API testing leads to a more stable and reliable application for end users.
61
+
Before you start, make sure you have:
63
62
64
-
## How to Automate API Testing with Rest Assured?
63
+
-**Java (JDK 8 or above)** and **Maven** installed and on your `PATH` (`java -version` and `mvn -version` should both succeed). REST Assured is a Java library, so the suite builds with Maven.
64
+
-**Git**, to clone the sample repository.
65
+
-**A TestMu AI account.** Get your `LT_USERNAME` and `LT_ACCESS_KEY` from the [TestMu AI Profile](https://www.testmuai.com/login/?redirectTo=https://accounts.lambdatest.com/details/profile). You will export them in Step 3.
65
66
66
-
REST-Assured, a robust Java library, simplifies interacting with RESTful web services for testing purposes. It provides intuitive syntax for constructing requests and validating responses, streamlining API testing within Java environments.
67
+
## How the REST Assured sample works
67
68
68
-
It is majorly used for:
69
-
- Writing automated API tests
70
-
- Validating REST API endpoints
71
-
- Ensuring API reliability, performance, and security
69
+
The sample is a Java + Maven project that uses REST Assured with TestNG. REST Assured sends HTTP requests (GET, POST, PUT, DELETE) and asserts on the responses using a readable `given().when().then()` syntax. For example, this call fetches a resource and asserts that the API returns a `200` status code:
72
70
73
-
REST-Assured seamlessly integrates with popular testing frameworks like JUnit and TestNG, enabling organized and efficient test execution with its core capabilities:
74
-
75
-
- Sending various HTTP requests (GET, POST, PUT, DELETE, etc.)
76
-
- Parsing various response formats (JSON, XML, etc.)
77
-
- Asserting response status codes and body content
78
-
- Handling authentication mechanisms
79
-
- Supporting data-driven testing with external data sources
80
-
81
-
For e.g. REST-Assured provides function to write get method such as `given().when().get(url).then().log().all();` This will help you to call a get request to fetch all the data from the API. Once the Call is complete you can either verify using the response of that call or by checking the status of the request.
-**Setting Base URI:**`RestAssured.baseURI` specifies the common part of API endpoints, avoiding repetition.
75
+
-`RestAssured.baseURI` sets the common part of your endpoints so you don't repeat it.
76
+
-`given()` sets up the request, `when()` sends it, and `then()` handles the response and assertions.
77
+
-`log().all()` prints the request and response for debugging, and `extract().response().asString()` returns the response body as a string.
88
78
89
-
-**Constructing Request:**
90
-
-**given()** initiates test case setup.
91
-
-**when()** sends the HTTP request (GET in this case).
92
-
-**Capturing Response:**
93
-
-**then()** handles response handling and assertions.
94
-
-**log().all()** logs request and response details for debugging.
95
-
-**extract().response().asString()** extracts the response body as a string.
79
+
You don't need to change the test code to run it on HyperExecute. The steps below build the suite with Maven and hand execution to the HyperExecute grid through `hyperexecute.yaml`.
96
80
97
-
## How to Test API on HyperExecute?
81
+
## Run the REST Assured suite on HyperExecute
98
82
99
-
### Step 1: Setup Your Test Suite
83
+
### Step 1: Clone the sample repository
100
84
101
-
You can use your own project to configure and test it. For demo purposes, we are using the sample repository.
85
+
Clone the REST Assured API testing sample from the TestMu AI GitHub repository, or use your own project.
102
86
103
87
:::tip Sample repo
104
88
105
-
Download or Clone the code sample for the Maestro framework from the <BrandName /> GitHub repository to run the tests on the HyperExecute.
89
+
Download or clone the REST Assured API testing sample from the TestMu AI GitHub repository to run the tests on HyperExecute.
106
90
107
91
<ahref="https://github.com/LambdaTest/hyp-api-testing"className="github__anchor"><img loading="lazy" src={require('../assets/images/icons/github.png').default} alt="Image" className="doc_img"/> View on GitHub</a>
108
92
109
93
:::
110
94
111
-
### Step 2: Setup the CLI in your Test Suite
112
-
113
-
After cloning / downloading the sample repo, you need to setup the CLI and the environment variables.
95
+
### Step 2: Download the HyperExecute CLI
114
96
115
-
#### Download the HyperExecute CLI
116
-
117
-
The CLI is used for triggering the tests on HyperExecute. It is recommend to download the CLI binary on the host system and keep it in the root directory of the suite to perform the tests on HyperExecute.
118
-
119
-
You can download the CLI for your desired platform from the below mentioned links:
97
+
The CLI triggers your tests on HyperExecute. Download the binary for your platform and keep it in the **root directory** of the test suite.
120
98
121
99
| Platform | HyperExecute CLI |
122
100
| ---------| ---------------- |
123
101
| Windows |https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe|
| Linux |https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute|
126
104
127
-
#### Setup Environment Variable
105
+
###Step 3: Set your TestMu AI credentials
128
106
129
-
Now, you need to export your environment variables *LT_USERNAME* and *LT_ACCESS_KEY* that are available in the [<BrandName /> Profile page](https://www.testmuai.com/login/?redirectTo=https://accounts.lambdatest.com/details/profile).
130
-
131
-
Run the below mentioned commands in your terminal to setup the CLI and the environment variables.
107
+
Export the `LT_USERNAME` and `LT_ACCESS_KEY` from your TestMu AI Profile (linked in the [Prerequisites](#prerequisites)) as environment variables. The CLI reads these to authenticate your run.
The `hyperexecute.yaml` at the repository root tells HyperExecute how to build the suite, discover tests, and run them. It ships ready to use. Review it to see the `pre` (Maven build), `testDiscovery`, and `testRunnerCommand` steps.
> **NOTE :** In case of MacOS, if you get a permission denied warning while executing CLI, simply run **`chmod u+x ./hyperexecute`** to allow permission. In case you get a security popup, allow it from your **System Preferences** → **Security & Privacy** → **General tab**.
167
-
168
-
Run the below command in your terminal at the root folder of the project:
144
+
From the root folder of the project, run the CLI against your YAML file:
### Step 5: Monitor and Validate the Test Execution
158
+
:::note macOS permissions
159
+
160
+
If macOS reports **permission denied** when you run the CLI, make it executable with `chmod u+x ./hyperexecute`. If a security popup appears, allow the binary from **System Preferences** → **Security & Privacy** → **General**.
161
+
162
+
:::
163
+
164
+
### Step 6: Monitor the run in the dashboard
183
165
184
-
Visit the [HyperExecute Dashboard](https://www.testmuai.com/login/?redirectTo=https://hyperexecute.lambdatest.com/hyperexecute) and check your Job status.
166
+
Open the [HyperExecute Dashboard](https://www.testmuai.com/login/?redirectTo=https://hyperexecute.lambdatest.com/hyperexecute) and find your job. A successful run shows the job as **Completed** with passing tests, and the **pre**, **scenario**, and **post** stages available as logs. Open each stage to validate the API responses your suite tested.
185
167
186
-
You can validate the tested API via the pre, post, and scenrios logs in the dashboard.
<DocCardheading="Getting started with HyperExecute"link="/support/docs/getting-started-with-hyperexecute/"description="Set up HyperExecute and trigger your first job on the grid." />
184
+
<DocCardheading="hyperexecute.yaml parameters"link="/support/docs/hyperexecute-yaml-parameters/"description="Reference for every YAML key, with examples you can copy." />
<DocCardheading="Auto-split test execution"link="/support/docs/hyperexecute-auto-split-strategy/"description="Distribute tests across parallel machines automatically." />
189
+
<DocCardheading="HyperExecute FAQs"link="/support/docs/hyperexecute-faqs/"description="Common questions on YAML, the CLI, and the platform." />
0 commit comments