Appium and TestNG work together: TestNG organizes and runs Java tests, while Appium’s Java client sends mobile automation commands through the Appium server to a platform driver such as UIAutomator2 for Android or XCUITest for iOS. To get a test running, add the Java client and TestNG to your project, install the server and the driver for your target, start a session with the required capabilities, and use TestNG lifecycle hooks to create and close the driver.
How Appium and TestNG fit together
A typical test run follows this path:
- TestNG selects a test method and invokes it.
- The test uses Appium’s Java client, a Selenium-based library, to issue WebDriver commands.
- The running Appium server routes the session to an installed platform driver.
- The platform driver automates the selected emulator, simulator, physical device, or supported hosted target.
TestNG is not an alternative to Appium. It provides test annotations, setup and cleanup hooks, and suite selection; Appium provides the mobile automation connection. The Appium Java client is documented at Appium’s Java client documentation.
Set up a Java test project
Add both Appium’s Java client and TestNG to the test classpath. The Appium client documentation shows Maven with test scope and Gradle with testImplementation. Use versions verified for your project’s current Appium Java client, Selenium compatibility, and TestNG release; the documentation’s placeholder version is not a recommendation for a current release.
Maven dependency pattern
<dependencies>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>YOUR_COMPATIBLE_VERSION</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>YOUR_TESTNG_VERSION</version>
<scope>test</scope>
</dependency>
</dependencies>
Gradle dependency pattern
dependencies {
testImplementation("io.appium:java-client:YOUR_COMPATIBLE_VERSION")
testImplementation("org.testng:testng:YOUR_TESTNG_VERSION")
}
tasks.test {
useTestNG()
}
Replace the version markers with actual versions checked against the official client and driver requirements; these snippets intentionally do not imply a version matrix. Appium’s client installation guidance is at the official client setup page.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- 【Strong Adsorption】The inspiration of the silicone phone suction case comes from the adhesive force of the octopus. Each suction cup phone mount is 3.15 inches long and 2.17 inches wide, with 24 independent suction cups providing a stronger and more stable suction force, so you don't have to worry about your phone falling during use.
- 【Back of Phone Suction Grip】Remove the adhesive film on the phone suction cup and stick it on the phone case. You can then fix the phone on any smooth surface, which is very convenient. (The phone suction cup cannot be removed and reused after being attached to the phone case. It is recommended to attach it to a regular phone case, not a valuable one.)
- 【Widely Used】Our non-slip silicone phone sticky grip mount attaches to almost any flat phone case and make it compatible with common mobile phones such as iPhone and Android.You can shoot, watch videos or video calls in the kitchen, gym, dance studio, bathroom and other places.
- 【Capture the Wonderful Picture】Whether you are a TikTok creator or just like to share videos and photos, this phone suction cup can help you hands-free capture wonderful videos and photos for sharing with friends.
- 【Note】You can fix the phone suction cup on a smooth surface such as a mirror or glass. If necessary, wipe the suction cup with a damp cloth to obtain stronger suction. Before releasing your hand, make sure the phone is firmly fixed. (Not applicable to rough walls, wooden surfaces, and other uneven surfaces)
Install and start Appium and a platform driver
Installing the Appium server alone does not make it capable of automating a device. The Appium project explicitly warns: “Note that this will only install the core Appium server, which cannot automate anything on its own.” Install the driver for the platform you plan to test, and satisfy that driver’s current prerequisites. See the Appium project repository and the chosen driver’s documentation.
- Install the Appium server using the documented workflow for the server version you select.
- Install the required platform driver through the Appium extension CLI workflow documented for that server and driver.
- Prepare the emulator, simulator, physical device, or hosted target, including any platform-specific tools and permissions the driver requires.
- Start the server. The project documents
appiumas the server-start command and port 4723 as the default in its CLI context; verify the address and port for your installed version. - Configure the Java client to use the same server URL. A typical local URL is
http://127.0.0.1:4723; ensure that this matches the server’s actual listening address and any configured base path.
Choose capabilities for the target app and device
Capabilities define the session when the driver is created. At minimum, Appium requires platformName and appium:automationName. Use the platform driver’s current documentation for exact supported values and additional fields. Common automation names are UIAutomator2 for Android and XCUITest for iOS; validate spelling, capitalization, and compatibility for your driver and client versions.
Rank #2
- SUPERIOR COMFORT — Unlike traditional circular ear buds, the design of EarPods is defined by the geometry of the ear. Which makes them more comfortable for more people than any other ear bud–style headphones.
- HIGH-QUALITY AUDIO — The speakers inside EarPods have been engineered to maximize sound output and minimize sound loss, which means you get high-quality audio.
- BUILT-IN REMOTE — EarPods with USB-C plug also include a built-in remote that lets you adjust the volume, control the playback of music and video, and answer or end calls with a pinch of the cord.
- COMPATIBILITY — Works with all devices that have a USB-C port.
- INTEGRATED MICROPHONE — A built-in microphone precisely captures your voice while you’re on the phone, taking a FaceTime call, or summoning Siri — so you’re always heard loud and clear.
Appium-specific capabilities use the appium: prefix under W3C capability conventions. Depending on the target, you may also need an app path or browser target, platform version, device name, or device UDID. The official capabilities documentation explains these session inputs: Appium capabilities.
- App under test: Configure
appium:appfor an application file when appropriate, or specify a browser target for mobile web testing. - Device selection: Use the device name and, when needed, a unique device identifier to select the intended emulator or device.
- Reset behavior:
noResetandfullResetaffect app state and reset behavior in driver-sensitive ways. Check the selected driver’s definitions and choose deliberately; do not assume these flags mean the same thing for every platform or app.
Capabilities are session-start parameters. Changing them requires creating a new session; they are not a way to reconfigure an already-running session.
Rank #3
- Secure Hold: Our PopSockets adhesive phone grip gives your cell phone a secure, comfortable hold in hand to help prevent drops while texting, taking photos, or scrolling on the go. Designed to stick firmly to most phone cases and devices.
- Hands-Free Made Easy: Easily turn your PopSocket into a phone stand to prop up your phone anywhere, perfect for watching videos, video calls, or following recipes. A must-have phone holder that keeps your device secure and ready for anything.
- Compatibility: Works with all phones, tablets, and Kindles. Sticks best to smooth, hard plastic cases and may not adhere to silicone or textured cases. Easily swap your PopTop to change up your style.
- Black PopSockets: Simple, refined, and endlessly versatile. A timeless essential for any phone.
- Travel Must-Have for People On the Go: A must-have travel accessory for flights, flying, airports, air travel, airplanes, planes, international trips, cruises, and long travel days. Key gadget for your airport haul, travel accessories and must-haves.
Create and clean up a driver with TestNG
For independent tests, a method-level lifecycle is a useful default: create a fresh driver in @BeforeMethod, run each test with @Test, and close the session in @AfterMethod. The sketch below shows the lifecycle and required capability concepts; adapt the options class, constructor, and typed capability methods to the current Appium Java client and platform driver APIs before compiling.
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class MobileSmokeTest {
// Declare the current platform-specific Appium driver type here.
private Object driver;
@BeforeMethod
public void startSession() throws Exception {
// Build the current driver's options with at least:
// platformName = "Android" (or "iOS")
// appium:automationName = "UiAutomator2" (or "XCUITest")
// Add the app/browser target and device identity as required.
// Create the driver using the Appium server URL and those options.
}
@Test
public void appOpens() {
// Use the platform-specific driver to assert an expected UI state.
}
@AfterMethod(alwaysRun = true)
public void stopSession() {
// If a session was created, call quit() on the driver and clear it.
}
}
This is a lifecycle template, not a drop-in executable test: the constructor and typed options syntax vary by client release and driver. Consult the current Java client examples and your driver documentation rather than copying an outdated constructor signature. Ensure cleanup runs even when a test assertion fails; guarding the cleanup for a session that was never created avoids replacing the original setup error with a null-driver error.
Rank #4
- [360 ° Flexible Rotation Design] Comes with a rotatable lanyard ring that supports 360 ° free rotation, effectively solving the problem of twisted and tangled lanyards
- [Wide compatibility] The ultra-thin 0.02-inch design does not block the charging port at all, and both wired and wireless charging can be used directly without removing the pad. Compatible with most smartphones such as iPhone, compatible with various wristbands, lanyards, crossbody straps, and keychains
- [Durable and Portable Material] Premium rust-resistant stainless steel material with good flexibility, which not only avoids scratching the phone case, but also has excellent anti rust and anti fading performance
- [Multi scenario Practical] Paired with a lanyard or wristband, hands-free use can be achieved. The phone is within reach and not easily dropped, ideal for daily commuting and outdoor activities. Suitable for full coverage phone cases, does not support half coverage phone cases
- [Quality Service] If you find any damage or other issues with the product upon receipt, please contact us immediately. We will handle it quickly
Method-level or class-level setup?
- Method-level hooks: give each test its own session and stronger isolation, with the trade-off of repeated session setup.
- Class-level hooks: can share a session across methods, but tests must manage state so one method does not silently affect another. Use this only when the shared state is intentional.
TestNG also provides before/after hooks at test, suite, and group scope, and supports inherited superclass hooks. Choose the narrowest lifecycle scope that matches the state you intend to share. See TestNG’s documentation.
Run and organize the suite
A testng.xml suite file can select tests and classes. A minimal example is:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Best Value
- 【PKYAA Double Sided Silicone Suction Phone Case Mount】PKYAA With Double Sided 40 Strong and Reliable individual suction cups, PKYAA provides a thicken and upgraded universal silicon suction mount for your phone.
- 【Friendly to Content Creators】If you are a content creator or an online influencer, you can create videos anywhere with this suction mount completely hands free with this silicone cell phone mount for cases.
- 【HANDS-FREE & Adhere to Mirrors】This Double Sided silicone suction phone case mount allows you to stick your phone to the mirror easily. No longer holding your phone in one hand to watch video tutorials while making up.
- 【Strong Grip on the Smooth Surface】You can easily hang your phone anywhere with a smooth surface. All you do is you clean off your phone and smooth surface. It is STURDY and it not only sticks to mirrors, it also sticks to windows, it sticks to refrigerators, tiles and other clean, flat surfaces.
- 【Press Down Firmly Every 30 Minutes】Use your palm or fingers to press the phone down firmly and check it's secure before letting go. Apply even pressure for a few seconds to allow the suction cup to adhere properly. To maintain the grip and prevent accidental falls, it's a good practice to periodically reapply pressure to the suction cup.
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="Mobile suite">
<test name="Smoke tests">
<classes>
<class name="example.MobileSmokeTest"/>
</classes>
</test>
</suite>
Run the suite through the TestNG command-line route or through your build tool’s configured test runner. There is no single Maven or Gradle command that applies to every project: the command depends on the test plugin, its version, and how the suite file is wired into the build. Configure that runner explicitly so local and team execution use the intended suite and device environment.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Choose an emulator, physical device, or hosted target
| Target | Best fit | Trade-off to account for |
|---|---|---|
| Emulator or simulator | Local iteration when the required platform environment is already configured. | It may not reproduce hardware-specific behavior; availability and setup depend on platform tooling. |
| Physical device | Checks that depend on real hardware or device-specific behavior. | Requires access to and preparation of the device, plus reliable device identity and connection. |
| Hosted device execution | Teams needing device access without owning all execution infrastructure. | Depends on network access, the provider’s current device coverage, and its pricing; verify these directly with a provider. |
Appium supports local or cloud-hosted execution, but this does not establish support, coverage, or pricing for any particular service. The cited capabilities guidance includes device identity such as device name and UDID-style selection. A physical Android phone is optional, not a prerequisite; an already-configured emulator may be enough for local development.
Troubleshoot common setup failures
- Session creation says the automation name or platform is missing: include
platformNameandappium:automationName, and ensure Appium-specific capabilities use the required prefix. - Server starts but cannot automate the target: install the platform driver as well as the core server, then verify the driver matches the requested platform and automation name.
- Client cannot connect to Appium: check that the server is running, the client URL matches its actual address and port, and no network or local configuration blocks the connection.
- The wrong device is selected or none is found: verify the device is available to the host and that the configured device name or unique identifier matches it.
- The app starts in unexpected state: review the driver-specific effects of reset capabilities and decide whether tests need preserved state or a clean install/state.
- Compilation fails around driver options or constructors: compare the sample with the installed Java client release and its Selenium compatibility; APIs and typed options can change between releases.
- Tests affect one another: use method-level sessions or explicitly reset shared state; class-level sharing can expose order-dependent behavior.
- Suite runs no tests or uses a different set than expected: verify the class names in
testng.xmland confirm the build runner is configured to consume that suite file.
Or skip the browser setup
For web-page screenshots used in visual checks or supporting artifacts, ScreenshotNeo offers a single GET request that returns an image or PDF. It is separate from Appium: it captures web pages, not native mobile-app screens. Its capture workflow accepts cookie banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before the shot; those steps can be disabled. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify page verdict and billing status in headers. ScreenshotNeo also has an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for request options. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Learn about ScreenshotNeo or sign up free for 1,000 screenshots a month, with no card required.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallQuick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

