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
title: Run automation tests on HyperExecute using TestNG
4
-
hide_title: true
3
+
title: TestNG Automation on HyperExecute
4
+
hide_title: false
5
5
sidebar_label: TestNG
6
6
description: Learn how to run Selenium automation tests on HyperExecute using the TestNG framework
7
7
keywords:
@@ -51,149 +51,66 @@ import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/co
51
51
}}
52
52
></script>
53
53
54
-
# Running TestNG Framework Tests on HyperExecute
55
-
TestNG is a widely-used testing framework for Java applications, designed to simplify and enhance the testing process for developers. It provides a flexible and powerful platform for running test suites, enabling effective unit testing, integration testing, and end-to-end testing of Java applications
56
-
<!--
57
-
HyperExecute is an AI Native Test Orchestration Cloud Platform that empowers you to run **end-to-end** tests **quickly** and **efficiently**. It provides Just-in-Time (JIT) testing infrastructure with fast execution **speeds**, **smart orchestration**, and **detailed logs**. -->
54
+
TestNG is a popular testing framework for Java applications that supports unit, integration, and end-to-end testing. This documentation will help you run your TestNG tests on LambdaTest HyperExecute using a local system setup.
58
55
59
-
This guide details how to execute your **TestNG** framework tests on **HyperExecute** using [YAML 0.2](/support/docs/hyperexecute-yaml-version0.2/) via two different methods:
56
+
## Run a Sample Project
57
+
### Step 1: Clone Sample Repository
60
58
61
-
-[**Using Local System**](/support/docs/testng-on-hyperexecute-grid/#1-testing-using-local-system) - You can use your own local machine to execute tests.
62
-
-[**Using Gitpod Platform**](https://hyperexecute.lambdatest.com/hyperexecute/jobs?type=gitpod&frameworkType=Selenium&framework=TestNG) - Execute tests using GitPod. (Requires a [Gitpod](https://gitpod.io/login/) account)
63
-
64
-
## Testing using Sample Project
65
-
66
-
Follow the step-by-step guide to execute your test on HyperExecute.
67
-
<!--
68
-
### Prerequisites
69
-
70
-
To run the Tests on HyperExecute from your Local System, you are required:
71
-
72
-
- Your LambdaTest [Username and Access key](/support/docs/hyperexecute-how-to-get-my-username-and-access-key/)
73
-
- [HyperExecute YAML](/support/docs/hyperexecute-yaml-version0.2/) file which contains all the necessary instructions.
74
-
- [HyperExecute CLI](/support/docs/hyperexecute-cli-run-tests-on-hyperexecute-grid/) in order to initiate a test execution Job .
75
-
- Setup the [Environmental Variable](/support/docs/hyperexecute-environment-variable-setup/) -->
76
-
77
-
### Step 1: Download the Sample Project
78
-
79
-
You can use your own project to configure and test it. For demo purposes, we are using the sample repository.
80
-
81
-
:::tip Sample repo
82
-
Download or Clone the code sample for the TestNG from the LambdaTest GitHub repository to run the tests on the HyperExecute.
59
+
:::tip TestNG repo
60
+
Download or Clone the TestNG sample from LambdaTest’s GitHub Repository
83
61
84
62
<ahref="https://github.com/LambdaTest/testng-selenium-hyperexecute-sample"className="github__anchor"><img loading="lazy" src={require('../assets/images/icons/github.png').default} alt="Image" className="doc_img"/> View on GitHub</a>
85
63
:::
86
64
87
65
### Step 2: Download the CLI in your Project
88
-
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 project to perform the tests on HyperExecute. You can download the CLI for your desired platform from the below mentioned links:
66
+
Download the HyperExecuteCLI and copy it into the root folder of the downloaded sample repository.
89
67
90
68
| Platform | HyperExecute CLI |
91
69
| ---------| ---------------- |
92
70
| Linux |https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute|
93
71
| Windows |https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe|
Now, you need to export your environment variables *LT_USERNAME* and *LT_ACCESS_KEY* that are available in the [LambdaTest Profile page](https://accounts.lambdatest.com/detail/profile).
99
-
100
-
Run the below mentioned commands in your terminal to setup the CLI and the environment variables.
set LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
124
-
</CodeBlock>
125
-
</div>
126
-
127
-
</TabItem>
128
-
</Tabs> -->
129
73
130
74
### Step 3: Execute your Test Suite
131
-
132
-
> **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**.
133
-
134
-
Run the below command in your terminal at the root folder of the project:
75
+
From the project root directory, execute the below CLI command in your terminal:
> **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**.
Visit the [HyperExecute Dashboard](https://hyperexecute.lambdatest.com/hyperexecute) and check your Job status.
91
+
🎉 Congratulations! You've successfully triggered the TestNG tests on HyperExecute. Visit the [HyperExecute Dashboard](https://hyperexecute.lambdatest.com/hyperexecute) and check your Job status.
HyperExecute also facilitates the provision to download the [Artifacts](/support/docs/hyperexecute-artifacts/) and [Reports](/support/docs/hyperexecute-reports/) on your local machine. Click on the corresponding button to download your generated artifacts and reports.
You can also use the Gitpod platform to execute our sample repository. It will fetch all the sample codebases and trigger the CLI to execute the tests.
97
+
### Step 1: Download the CLI in your Project
98
+
Download the HyperExecute CLI and copy it into the root folder of the downloaded sample repository.
161
99
162
-
Follow the below steps to run Test using Gitpod:
163
-
164
-
**Step 1:** Click '**Open in Gitpod**' button. You will be redirected to Login/Signup page. This button is configured to redirect you to the Gitpod platform where you will be able to execute our sample repository. -->
**Step 2:** Login with LambdaTest credentials. Once logged in, a pop-up confirmation will appear, asking you to **'Proceed'** to the Gitpod editor in a new tab. The current tab will display the HyperExecute Dashboard.-->
**Step 4:** As you are running a sample project, Fetching of the Test Scripts, [HyperExecute YAML](/support/docs/deep-dive-into-hyperexecute-yaml/), [HyperExecute CLI](/support/docs/hyperexecute-cli-run-tests-on-hyperexecute-grid/) and Triggering your tests using the `Execution Command` will be automated. -->
**Step 5:** Once you see the `Job Link` in the logs, you can visit the [HyperExecute dashboard](https://hyperexecute.lambdatest.com/hyperexecute) to see the tests getting executed. -->
185
-
186
-
<!-- :::tip
187
-
188
-
You can also implement [Secret Keys](https://www.lambdatest.com/support/docs/hyperexecute-how-to-save-and-manage-secrets/) in your YAML file.
189
-
::: -->
190
-
191
-
## Testing using your own Project
100
+
| Platform | HyperExecute CLI |
101
+
| ---------| ---------------- |
102
+
| Linux |https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute|
103
+
| Windows |https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe|
If you are using your own project, make sure you update the **Hub endpoint** in your tests file. By setting up the Hub endpoint, you establish the communication channel between your tests and the browser nodes, enabling effective test distribution and execution. Configure the desired capabilities based on your test requirements. For example:
106
+
### Step 2: Setup Hub Endpoints and Capabilites
107
+
Update your TestNG test configuration to point to the LambdaTest hub and set capabilities as needed:
> You can also use **dev** and **beta** browser versions. To generate capabilities for your test requirements, you can use our inbuilt 🔗 [Capabilities Generator Tool](https://www.lambdatest.com/capabilities-generator/).
206
123
207
-
### Step 2: Download the CLI in your Project
208
-
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 project to perform the tests on HyperExecute. You can download the CLI for your desired platform from the below mentioned links:
124
+
### Step 3: Configure YAML in your Test Suite
125
+
Use the sample YAML below to configure your execution:
209
126
210
-
| Platform | HyperExecute CLI |
211
-
| ---------| ---------------- |
212
-
| Linux | https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute |
213
-
| Windows | https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe |
Configure your YAML file as per your use cases using **key value** pairs.
138
+
testDiscovery:
139
+
type: raw
140
+
mode: local
141
+
command: grep 'test name' xml/testng_linux.xml | awk '{print$2}' | sed 's/name=//g' | sed 's/\x3e//g'
219
142
220
-
In this sample YAML file, we have mentioned:
143
+
testRunnerCommand: mvn test -Dplatname=linux -Dmaven.repo.local=./.m2 -DselectedTests=$test
221
144
222
-
- **version** of the YAML file
223
-
- **Timeouts** for executing your project
224
-
- **Mode of execution** is [Autosplit](/support/docs/hyperexecute-auto-split-strategy/). You can also opt for [Matrix](/support/docs/hyperexecute-matrix-multiplexing-strategy/) or [Hybrid](/support/docs/hyperexecute-hybrid-strategy/) mode.
225
-
- **Pre and Post** commands
226
-
- **Reports and Artefacts** that will be generated after the completion of tests
227
-
- and other necessary YAML Parameters
145
+
# Fail the job early if2 tests fail (saves time on large suites)
> 📘 For a deeper understanding and project-specific configurations, check out the [YAML documentation](https://www.lambdatest.com/support/docs/hyperexecute-yaml-parameters/).
160
+
234
161
### Step 4: Monitor the Test Execution
235
162
236
163
Visit the [HyperExecute Dashboard](https://hyperexecute.lambdatest.com/hyperexecute) and check your Job status.
@@ -248,66 +175,12 @@ The snapshot below shows the videos, logs and other meta data for that specific
248
175
249
176
250
177
## Advanced Parameters
178
+
Optimize your test pipeline using the following advanced features:
<p>HyperExecute also manages all of your test artifacts and provides you with the option to implement smart workflows on your test code without modifying it.</p>
<p>Root Cause Analysis and Error Classification features in HyperExecute to view different kinds of errors and directly land on corrective measures or fixes.</p>
- 🔄 [Auto-Healing](/support/docs/hyperexecute-auto-healing/) – Automatically recover from certain failures
311
184
312
185
> For any query or doubt, please feel free to contact us via <span className="doc__lt" onClick={() => window.openLTChatWidget()}>**24×7 chat support**</span> or you can also drop a mail to **[email protected]**.<br />
0 commit comments