View all web browser and mobile devices available in our cloud-based test lab.
Appium is the leading free open source cross-platform test automation framework for Android and iOS mobile testing. In this blog, you’ll learn how to execute Appium tests for Android. Keep reading to learn more about Appium for Android testing.
Appium is widely used and backed by a large user community. It is essentially a bolt-on to Selenium that translates Selenium commands that you are most likely familiar with into ones that will work on mobile platforms.
Appium lets you drive mobile native, web, and hybrid app test automation on real (local & cloud) as well as virtual devices (emulators / simulators). It is regularly updated to support new developments in technologies and mobile platforms.
The Complete Guide to Mobile Automation TestingDownload Now
More and more teams are seeing Appium as their de facto test automation framework. Whether you’re already using Appium or just getting started on mobile testing basics, it’s important to master the Appium basics too.
Perfecto seamlessly integrates with Appium for iOS and Android testing. Test automation engineers and developers can create and execute standard Appium scripts in various languages (Java, C#, etc.). And they can execute these scripts against real devices in the Perfecto cloud — even across various global locations.
Perfecto has been providing support for Appium for many years and has recently added a new architecture for testing on Android and iOS devices that is fully aligned with local Appium testing.
The new architecture has several benefits:
With Perfecto you can easily run tests in parallel and scale across multiple Android platforms.
Most IDEs let you develop Appium tests in much the same way. In our example, we will use IntelliJ. We have a ready-made project that you can quickly adopt here.
In this project, the integration with Perfecto is already built in. The only things you need to provide are your Perfecto cloud name and security token. Here are steps to configure your test.
For example, if you signed up for a free trial account, then your cloud name would be “mobilecloud” and your security token can be found at the top right hand corner of the screen after you have logged in with your account. You will need to generate a new one the first time. The token is a very long set of characters that are unique to you and should not be shared.
You will also need to specify capabilities for selecting the correct device you want to use. By default, it will look for any Galaxy S device (e.g. S10, S20, etc.) that is available at the time of running.
If you want to specify a particular device to use for your testing, you can go to Manual Testing (Open Device), then select a device you would like to use for automation, and see the Capabilities on the right. You can copy and paste the code into your project too.
After adding these values to the PerfectoAppium.java code, your project is ready to run. The tests should fire up on Perfecto using your user account. There is no need to specify user ID or password.
If you have existing Appium scripts, they should largely work after defining the correct endpoint to connect to and the additional capabilities to authenticate the session.
In a nutshell, these are the main things you need to define:
String securityToken = <<some_very_long_token>>;
RemoteWebDriver driver = new RemoteWebDriver(new URL ("https://<<your_cloud_name>>.perfectomobile.com/nexperience/perfectomobile/wd/hub/fast"), capabilities);
And you can carry on with your Appium commands like findElementByCssSelector, etc.
1. Perfecto seamlessly integrates with Appium for iOS and Android, and it allows you to easily scale your testing. By defining additional devices in, say, a TestNG configuration XML (among many others), you can quickly run the same test on a new platform. Perfecto supports various execution frameworks like JUnit, TestNG, etc. which you can use with your Appium tests.
2. With Perfecto and Appium, you can compare up to 32 platforms in parallel and step through your test.
3. Perfecto enables you to carry out deep analysis of failure reasons with the help of AI-driven test reporting and analytics. This helps you find and fix defects quickly.
4. Get access to stack traces, video playback of the whole test, screenshots of every single step of the way, plus additional artifacts like device logs, device vitals (CPU, memory, network in and out), HAR files, PCAP files, and more. Share access to all of these easily, by just sharing just a single URL, as every test report has a unique URL.
Now that you’ve learned about Appium for Android, give it a try in the Perfecto testing cloud. Leveraging a cloud testing solution like Perfecto means you can create, run, and analyze your test automation with Appium on real devices in the cloud.
With Perfecto and Appium for mobile app testing, you’ll be able to:
See for yourself why Perfecto makes mobile testing with Appium so much better. You can get started with a free 14-day trial of Perfecto today.
Senior Sales Engineer, Perfecto
Julius has over 20 years’ experience in software development, consulting, business development, digital marketing, pre and post-sales, and QA operations across the software, consumer product, digital media, and digital marketing industries. He is specialized in helping enterprises optimize their QA strategies and make testing become of value rather than a liability by "shifting testing left."