Skip to content

Commit 68b8611

Browse files
salmanltIshavyas9
authored andcommitted
Optimized HyperExecute docs for API Testing
1 parent 1564dd7 commit 68b8611

3 files changed

Lines changed: 155 additions & 226 deletions

File tree

docs/getting-started-with-agent-to-agent-testing.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,15 @@ TestMu AI [Agent Testing](https://www.testmuai.com/agent-testing/) Platform vali
5353

5454
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.
5555

56-
<div className="ytframe">
57-
<div className="youtube" data-embed="DrdnovKzUQY" data-loading-attribute="eager">
58-
<div className="play-button"></div>
59-
</div>
56+
<div style={{ width: "50%", aspectRatio: "16 / 9", margin: "20px auto", borderRadius: "8px", overflow: "hidden" }}>
57+
<iframe
58+
style={{ display: "block", width: "100%", height: "100%", border: 0 }}
59+
src="https://www.youtube-nocookie.com/embed/DrdnovKzUQY?rel=0&showinfo=0"
60+
title="Agent Testing by TestMu AI: The QA Layer AI Agents Never Had"
61+
loading="lazy"
62+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
63+
allowFullScreen
64+
></iframe>
6065
</div>
6166
6267

docs/hyperexecute-api-testing.md

Lines changed: 62 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
id: hyperexecute-api-testing
3-
title: Boost Your API Testing Efficiency with HyperExeucte
3+
title: How to Perform API Testing With REST Assured on HyperExecute
44
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.
77
keywords:
88
- hyperexecute api testing
99
- api automation hyperexecute
@@ -25,6 +25,7 @@ import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/co
2525
import Tabs from '@theme/Tabs';
2626
import TabItem from '@theme/TabItem';
2727
import BrandName, { BRAND_URL } from '@site/src/component/BrandName';
28+
import DocCard from '@site/src/component/DocCard';
2829

2930

3031
<script type="application/ld+json"
@@ -51,88 +52,63 @@ import BrandName, { BRAND_URL } from '@site/src/component/BrandName';
5152
}}
5253
></script>
5354

54-
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.
5556

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.
5758

58-
API testing is crucial for several reasons:
59+
## Prerequisites
5960

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:
6362

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.
6566

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
6768

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:
7270

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.
82-
83-
```bash
71+
```java
8472
given().when().get(url).then().assertThat().statusCode(200);
8573
```
8674

87-
- **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.
8878

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`.
9680

97-
## How to Test API on HyperExecute?
81+
## Run the REST Assured suite on HyperExecute
9882

99-
### Step 1: Setup Your Test Suite
83+
### Step 1: Clone the sample repository
10084

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.
10286

10387
:::tip Sample repo
10488

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.
10690

10791
<a href="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>
10892

10993
:::
11094

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
11496

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.
12098

12199
| Platform | HyperExecute CLI |
122100
| ---------| ---------------- |
123101
| Windows | https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe |
124-
| MacOS | https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute |
102+
| macOS | https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute |
125103
| Linux | https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute |
126104

127-
#### Setup Environment Variable
105+
### Step 3: Set your TestMu AI credentials
128106

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.
132108

133109
<Tabs className="docs__val">
134110

135-
<TabItem value="bash" label="Linux / MacOS" default>
111+
<TabItem value="bash" label="Linux / macOS" default>
136112

137113
<div className="lambdatest__codeblock">
138114
<CodeBlock className="language-bash">
@@ -143,56 +119,72 @@ export LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
143119

144120
</TabItem>
145121

146-
<TabItem value="powershell" label="Windows" default>
122+
<TabItem value="powershell" label="Windows (PowerShell)">
147123

148124
<div className="lambdatest__codeblock">
149125
<CodeBlock className="language-powershell">
150-
{`set LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
151-
set LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
126+
{`$env:LT_USERNAME = "${ YOUR_LAMBDATEST_USERNAME()}"
127+
$env:LT_ACCESS_KEY = "${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
152128
</CodeBlock>
153129
</div>
154130

155131
</TabItem>
156132
</Tabs>
157133

158-
### Step 3: Configure YAML in your Test Suite
134+
### Step 4: Review the hyperexecute.yaml
135+
136+
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.
159137

160138
```yaml reference title="hyperexecute.yaml"
161139
https://github.com/LambdaTest/hyp-api-testing/blob/master/hyperexecute.yaml
162140
```
163141

164-
### Step 4: Execute your Test Suite
142+
### Step 5: Trigger the run from the CLI
165143

166-
> **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:
169145

170146
```bash
171147
./hyperexecute --config RELATIVE_PATH_OF_YOUR_YAML_FILE
172148
```
173149

174-
OR use this command if you have not exported your username and access key in the step 2.
150+
If you did not export your credentials in Step 3, pass them inline instead:
175151

176152
<div className="lambdatest__codeblock">
177153
<CodeBlock className="language-bash">
178154
{`./hyperexecute --user ${ YOUR_LAMBDATEST_USERNAME()} --key ${ YOUR_LAMBDATEST_ACCESS_KEY()} --config RELATIVE_PATH_OF_YOUR_YAML_FILE `}
179155
</CodeBlock>
180156
</div>
181157

182-
### 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
183165

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.
185167

186-
You can validate the tested API via the pre, post, and scenrios logs in the dashboard.
168+
#### Pre-run logs
187169

188-
#### pre
170+
<img loading="lazy" src={require('../assets/images/hyperexecute/integration/products/api/1.png').default} alt="HyperExecute dashboard showing pre-run logs" width="1920" height="868" className="doc_img"/>
189171

190-
<img loading="lazy" src={require('../assets/images/hyperexecute/integration/products/api/1.png').default} alt="automation-dashboard" width="1920" height="868" className="doc_img"/>
172+
#### Scenario logs
191173

192-
#### scenario
174+
<img loading="lazy" src={require('../assets/images/hyperexecute/integration/products/api/2.png').default} alt="HyperExecute dashboard showing scenario logs" width="1920" height="868" className="doc_img"/>
193175

194-
<img loading="lazy" src={require('../assets/images/hyperexecute/integration/products/api/2.png').default} alt="automation-dashboard" width="1920" height="868" className="doc_img"/>
176+
#### Post-run logs
195177

196-
#### post
178+
<img loading="lazy" src={require('../assets/images/hyperexecute/integration/products/api/3.png').default} alt="HyperExecute dashboard showing post-run logs" width="1920" height="868" className="doc_img"/>
197179

198-
<img loading="lazy" src={require('../assets/images/hyperexecute/integration/products/api/3.png').default} alt="automation-dashboard" width="1920" height="868" className="doc_img"/>
180+
## Related resources
181+
182+
<div style={{ display: 'flex', gap: '20px', flexWrap: 'wrap', marginBottom: '20px' }}>
183+
<DocCard heading="Getting started with HyperExecute" link="/support/docs/getting-started-with-hyperexecute/" description="Set up HyperExecute and trigger your first job on the grid." />
184+
<DocCard heading="hyperexecute.yaml parameters" link="/support/docs/hyperexecute-yaml-parameters/" description="Reference for every YAML key, with examples you can copy." />
185+
</div>
186+
187+
<div style={{ display: 'flex', gap: '20px', flexWrap: 'wrap' }}>
188+
<DocCard heading="Auto-split test execution" link="/support/docs/hyperexecute-auto-split-strategy/" description="Distribute tests across parallel machines automatically." />
189+
<DocCard heading="HyperExecute FAQs" link="/support/docs/hyperexecute-faqs/" description="Common questions on YAML, the CLI, and the platform." />
190+
</div>

0 commit comments

Comments
 (0)