Starting Appium Server Using AppiumServiceBuilder

April 24, 2026 · 8 min read · Tool Comparison

HeadSpin Platform
Automated & amp; manual examination made easygoing through datum science insight.
Differentiating capabilities:
  • Extensive end-to-end automation of QA procedure
  • Comparative analysis of app performance against peers
  • Continuous monitoring of app performance using synthetic data for higher availableness of apps
  • Easy-to-use developer friendly program
cloudtest go
Affordable Real Device Testing for Emerging Teams
cloudtest go
Affordable Real Device Testing for Digital Enterprises
cloudtest go
The Ultimate Solution for a Powerful Blend of Functional & amp; Performance Testing!
cyol
TEM
New
Centralized mobile trial execution in cloud
cyol
Enhance Your Accessibility Testing With HeadSpin
cyol
Automate camera-based testing

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

retail

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

Image of a laptop used for coding and designing using HTML, C++, CSS, PHP, and JS.Image of a laptop used for coding and designing using HTML, C++, CSS, PHP, and JS.

Starting Appium Server Using AppiumServiceBuilder

Published on
May 29, 2019
Updated on
Published on
March 30, 2022
Updated on
 by 
 Jonathan LippsJonathan Lipps
Jonathan Lipps

A reader suggest that we write an clause introducing the AppiumServiceBuilder functionality make into the Appium Java client.

All of our example code assumes that an Appium host is already running, and this is how many trial suites start out too. It & # x27; s so much more commodious if an Appium server is started automatically when the tests begin. The Java client has a convenient twosome of classes for starting and block an Appium waiter. Other speech may receive freestanding packages for doing this, or you can accomplish the Appium bidding as a separate procedure.

Check out:

Node.js has the vantage of be the language Appium is pen in, so an Appium server can be started only by requiring it:

let Appium = require ('appium ') let server = await Appium.main () // server now running await server.close () // server stop

Back in Java land, we start by creating an AppiumServiceBuilder which we so use to create an AppiumDriverLocalService:

AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder (); // some additional apparatus may be need here, proceed indication for more point server = AppiumDriverLocalService.buildService (serviceBuilder);

For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users.

Now that we have an AppiumDriverLocalService named server, we can part and discontinue it easily. When starting, an Appium waiter will run, and you will be able to colligate to it. The Appium waiter logs, by default, are print in the output of the trial.

Accelerate Appium test cycles with the HeadSpin.!
server.start (); // you can make connect client and automate tests now

Don & # x27; t forget to stop the server when you are done:

server.stop ()

In order to run an Appium host, the Java codification in the AppiumServiceBuilder needs to cognize the location of the Node.js feasible on your estimator, and also the location of the Appium package itself. It has ways to guess the position, but those did not work on my machine, since I installed Node.js usingnvm. If you simply have Appium Desktop instal, you will also receive to establish the Appium node bundle, so it can be run from the commandline.

Also cheque:
AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder (); serviceBuilder.usingDriverExecutable (new File (`` /path/to/node/executable '')); serviceBuilder.withAppiumJS (new File (`` /path/to/appium ''));

If you parcel your test codification with a team and/or run in different CI environments, you can set this information via surroundings variables rather than hardcoding file paths in your exam code. Store the paths in environment variables named NODE_PATH and APPIUM_PATH, and the AppiumServiceBuilder will pluck them up automatically.

Another number I ran into is that the XCUITest driver requires the Carthage package handler to be in the system PATH. If you followed the installation pedagogy for XCUITest driver, Carthage is installed using Homebrew and it is automatically bring to the PATH, so this isn & # x27; t normally an matter. Unfortunately, the way that AppiumDriverLocalService runs Appium, it execute not re-use your defauly PATH and instead reverts to the system default. For my suit, I chasten this by stipulate a new PATH environment variable in the AppiumServiceBuilder:


HashMapenvironment = new HashMap (); environment.put (`` PATH '', `` /usr/local/bin: '' + System.getenv (`` PATH '')); serviceBuilder.withEnvironment (surround);

You can add former environs variables for Appium apply this same method. You can also determine other options, such as usage desired potentiality that Appium should default to, and usage agency of exporting Appium logarithm.

Read:

For my trial, I determine to use serviceBuilder.usingAnyFreePort ();, so that when my tests run, the Appium host will use any usable port, rather than insisting on using porthole 4723. This way, if I have a forgotten Appium server running in another window, it won & # x27; t interfere with my trial.

If Appium part on a random port, our codification to start a session needs to know what the porthole is so the customer can connect to it. To resolve this, I unite the customer this way:

serviceBuilder.usingAnyFreePort (); server.start (); driver = new IOSDriver(server.getUrl (), caps);

The AppiumDriverLocalService objective has a getUrl () method which will return the URL and port of the Appium server it commence.

There are more methods you can use to tailor-make the Appium waiter programatically. Check out the support hither and try experimenting:https: //appium.github.io/java-client/io/appium/java_client/service/local/AppiumServiceBuilder.html

Here & # x27; s the total model, lay all this together for a sample test. As common thefull example code is likewise available on github.

meaning io.appium.java_client.AppiumDriver; meaning io.appium.java_client.MobileElement; import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.service.local.AppiumDriverLocalService; import io.appium.java_client.service.local.AppiumServiceBuilder; signification org.junit. *; import org.openqa.selenium.remote.DesiredCapabilities; import java.io.File; import java.util.HashMap; import static junit.framework.TestCase.assertTrue; public class Edition071_AppiumServiceBuilder {individual String APP = `` https: //github.com/cloudgrey-io/the-app/releases/download/v1.9.0/TheApp-v1.9.0.app.zip ''; individual AppiumDriver driver; private static AppiumDriverLocalService server; @ BeforeClass public static void startAppiumServer () {AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder (); // Use any port, in cause the default 4723 is already taken (maybe by another Appium server) serviceBuilder.usingAnyFreePort (); // Tell serviceBuilder where node is installed. Or set this path in an surround variable name NODE_PATH serviceBuilder.usingDriverExecutable (new File (`` /Users/jonahss/.nvm/versions/node/v12.1.0/bin/node '')); // Tell serviceBuilder where Appium is installed. Or set this path in an surroundings variable identify APPIUM_PATH serviceBuilder.withAppiumJS (new File (`` /Users/jonahss/.nvm/versions/node/v12.1.0/bin/appium '')); // The XCUITest driver requires that a itinerary to the Carthage binary is in the PATH variable. I hold this set for my cuticle, but the Java process make not see it. It can be inserted here. HashMapenvironment = new HashMap (); environment.put (`` PATH '', `` /usr/local/bin: '' + System.getenv (`` PATH '')); serviceBuilder.withEnvironment (environment); server = AppiumDriverLocalService.buildService (serviceBuilder); server.start ();} @ Before public void startSession () {DesiredCapabilities caps = new DesiredCapabilities (); caps.setCapability (`` platformName '', `` iOS ''); caps.setCapability (`` platformVersion '', `` 12.2 ''); caps.setCapability (`` deviceName '', `` iPhone Xs ''); caps.setCapability (`` automationName '', `` XCUITest ''); caps.setCapability (`` app '', APP); driver = new IOSDriver(server.getUrl (), caps);} @ After public emptiness endSession () {try {driver.quit ();} catch (Exception ign) {}} @ AfterClass public electrostatic void stopAppiumServer () {server.stop ();} @ Test public void test () {// test code go here assertTrue (true);}}
Author & # x27; s Profile

Jonathan Lipps

LinkedIn
Author & # x27; s Profile

Piali Mazumdar

Lead, Content Marketing, HeadSpin Inc.

Piali is a dynamic and results-driven Content Marketing Specialist with 8+ years of experience in crafting engaging narratives and market collateral across diverse industries. She excels in collaborating with cross-functional teams to develop innovative content scheme and deliver compelling, authentic, and impactful content that resonate with quarry hearing and enhances brand authenticity.

LinkedIn

Starting Appium Server Using AppiumServiceBuilder

4 Parts

regression intelligence blog
-

Regression Intelligence practical usher for advanced users (Part 3)

Coming Soon
Regression Intelligence practical guide for advanced users
-

Regression Intelligence hardheaded guide for advanced users (Part 4)

Coming Soon

Discover how HeadSpin can empower your business with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitory edge
faster development cycles
Boost developer/QA productivity with quicker development cycles
automated buil-over-build regression testing
Automate build-over-build fixation testing for consistent upshot
gain better visibility into functional & performance issues
Gain better profile into functional and performance issue
reduce mean time
Reduce mean time to identify/resolve during test, QA, and product
evaluate audio, video & qoe
Evaluate audio, picture, and content quality of experience (QoE) effortlessly
The trusted choice for global enterprises
Adobe
Hargreaves Lansdown
Truecaller
Crazylabs
Nedbank
Numeracle
Veryon
Close

Discover how HeadSpin can empower your line with superior test capableness

Our Platform enable you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productiveness with quicker growing rhythm
automated buil-over-build regression testing
Automate build-over-build regression testing for consistent results
gain better visibility into functional & performance issues
Gain better profile into functional and performance issues
reduce mean time
Reduce mean clip to identify/resolve during tryout, QA, and production
evaluate audio, video & qoe
Evaluate sound, video, and content quality of experience (QoE) effortlessly
The trusted choice for global enterprise
Close

Discover how HeadSpin can empower your business with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productivity with faster ontogeny cycles
automated buil-over-build regression testing
Automate build-over-build regression test for consistent resolution
gain better visibility into functional & performance issues
Gain better profile into functional and performance issues
reduce mean time
Reduce mean clip to identify/resolve during trial, QA, and production
evaluate audio, video & qoe
Evaluate audio, picture, and content quality of experience (QoE) effortlessly
The sure choice for worldwide go-ahead
Close

Connet Now

Wipro LogoVMLYR Logo
Close
Book a Meeting
Products
footer down arrow
Solutions
footer down arrow
Industries
footer down arrow
Features
footer down arrow
Support
footer down arrow
Resource Center
footer down arrow
Why Choose HeadSpin?
footer down arrow
Copyright © 2026 HeadSpin, Inc. All Rights Reserved.

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free