We've discussed before how to use Appium to automate Windows desktop apps, but of course it's also possible to use Windows as the host environment for traditional mobile testing with Appium. It is not, unfortunately, possible to automate iOS simulators on Windows, because iOS simulators are only designed to run on macOS as part of Xcode. It is also not technically possible to work with real iOS devices plugged into a Windows machine, though some folks have figured this out. It's just not a supported use case.
What is supported is to run your Android tests with Appium on Windows! So let's take a look at all the steps required to support this kind of automation. (Note that I am assuming a recent install of the modern Windows 10 OS).
Appium's requirements for Android testing on Windows are what you'd expect: basically the requirements for Android dev, plus Appium's own requirement for its runtime environment.
C:\Program Files\Java\jdk1.8.0
?).JAVA_HOME
environment variable in your system settings. If you've never set an environment variable before, this is a good guide. Basically, we need to create a new variable with the name JAVA_HOME
, and the value equal to the path where the JDK was installed (e.g., C:\Program Files\Java\jdk1.8.0
). Once you've saved out of all the dialogs, open up a command prompt and type echo %JAVA_HOME%
. You should see your JDK path printed back out to you! Appium needs this in order to know where to find relevant Java binaries.npm install -g appium
appium
(NB: You'll always want to run Appium from an Admin console.)
For now, we can just kill the Appium server until we're ready to actually run a test.
JAVA_HOME
above). This one should be called ANDROID_HOME
, and it should be set to the location of the Android SDK you saw in the SDK Manager window.adb
) are available from a command prompt. To do this, go to the same place you did to edit the environment variables, but look for an existing variable called PATH. You can edit it, and tack this special string onto the end: ;%ANDROID_HOME%\platform-tools
. What is this doing? First of all, the semicolon separates this path segment from other ones that came before. %ANDROID_HOME%
references the environment variable we previously set, and includes it as part of a path to a particular directory, where the program adb.exe
resides.adb devices
and hit enter. If all configuration is correct, you will see some output from ADB telling you that you have one connected device, which is the emulator you booted up a moment ago.%ANDROID_HOME%\emulator
, which gives you access to the emulator
binary from the command line, in case you don't want to open Android Studio just to run your emulator. (If you do add this, make sure not to forget the ;
as a separator between paths).Let's review what we've done: we've installed basic system dependencies, the Appium server itself, and everything related to working with Android specifically. That means we're finished!
All that remains is to start the Appium server (just run appium
from an admin command prompt), load up an Appium test in your editor of choice, tweak anything that needs to be tweaked for your system, and then kick off the test. If all goes well, you should see the Appium server spitting out logs and launching your app on the Android emulator!