June 16, 2024

Mobile Automation with Appium

5 min read
Appium

image 2022 05 09T08 51 58 452Z

Spread the love

An integral part of any development process is quality assurance. Developers can use it as a sanity check to make sure that whatever they’re developing is bug-free and works seamlessly. QA Engineers used to perform all tests manually, meticulously checking a product over and over until they were sure there was nothing left to fix. Even though such an approach was dedicated and rather functional, it had frequently proved to be inefficient and time-consuming

Fortunately, things have improved since then. The number of tools for automated quality assurance testing has grown dramatically in recent years: Robotium, Espresso, UI Automator, Selendroid, Testdroid, Calabash, and so on. However, after trying dozens and dozens of tools, we, here at Suntech Application ., came to the conclusion that Appium is the best choice when it comes to high-quality automated testing. The purpose of this article is to provide our reasoning for making this choice, so you know why we use some particular tools when developing your projects.

So Why Appium?

First, we’d like to start with a table comparing the most popular mobile automation tools.

Table

As you can see, Appium has far more advantages than do the other tools available on the market. However, it’s definitely not perfect. Any given instrument has its strong and weak sides, and we’re more than happy to tell you about Appium’s .

Pros:

  • Appium is compatible with Android and iOS. Additionally, when switching between them, you do not need to change anything. The code, programming languages, and user experience are all the same. In other words, any test would run on any platform just fine.
  • Appium does not require any in-app modifications. Upon downloading and installing an application, it can be tested right away.
  • Appium’s developers, SauceLabs, specialize in creating open source automation and manual testing solutions. Every new release of Appium includes useful new features and bug fixes due to its frequent updates. from that, there is a large Appium community online, so you can always ask as many questions as you want and get answers from other professionals just like you.
  • In addition to automating web, native, and hybrid applications, this tool also supports various hardware actions.
  • Appium supports all Webdriver-compatible programming languages: Java, Objective-C, JavaScript with Node.js, PHP, Python, Ruby, C#, Clojure and Perl.

Cons:

 

  • Appium doesn’t support image recognition.
  • Such hardware actions as swipe and gestures work only in native applications.
  • Parallel iOS tests are not possible. If you wish to run tests on multiple devices simultaneously, you must do so on the corresponding number of Mac OS PCs, since Macs only allow running one instance per device. Continuous Integration can be severely hampered by this limitation. The SauceLabs mobile cloud allows you to run tests on multiple iOS simulators simultaneously, so you could easily fix it by using that service.
  • Installing and setting up Appium for iOS and Android takes a long time.
  • Appium’s got a very weak sort of documentation, which can be a pain for some engineers.

How Does It Work?

Appium is a web server that uses REST APIs and is built using Node.js. The web server has a client/server architecture that offers a wide range of features to users. Tests can be created using any programming language that is compatible with Webdriver, and they can be executed on any computer (not just the one that has the server). The server can either be installed using npm (a JavaScript package manager) or built from source code.

apium on suntech

Appium manages devices with the help of automation instruments that are native to the particular operating system – UIAutomator for Android and XCUITest for iOS (version 10 and higher).

Example of an Appium test – 

Now let’s look at an example of a simple Python Appium test. This tutorial shows how to automate mobile applications with common features and actions. First, let’s create a Python file. Despite the fact that Selenium/Appium Python language bindings already offermany features, we’re using some custom-made functions for this test, so we’ve included several additional librariess.

The next step is to create a test class and declare both the target device and the test’s desired capabilities. setUp and tearDown are the primary methods in a unit test modul Within the setUp method, you can find the desired capabilities and driver initialization, while tearDown is necessary for terminating all Appium processes after having finished the testing. Desired capabilities contain different keys and values for different cases.

Coding

After you’ve done all that, you can create a ‘test’ method, which performs an application login and navigates to a certain page of the application. In the code snippet below, we have already opened an app by using setUp. A few verification actions are included in the last part of our ‘test’ method. In the script, inner text is extracted from the element on the page, a GET request is sent to the API, and then its content is read. Afterwards, it compares the text it had previously extracted from the page and the response it received from the API.

Coding

Despite its limitations and the general complexity of configuration, Appium is a perfect tool for automating mobile tests. It has many common features, is easy to integrate with other systems and frameworks, and supports a lot more devices and programming languages than its competitors. As an added bonus, an Appium community with a wide range of active members saves users from having to spend time troubleshooting unnecessary problems, while continuous development and frequent updates help to eliminate countless bugs and other problems

 


Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © All rights reserved. | Newsphere by AF themes.