Chapter 2. Getting Started with Appium

Today, a lot is going on in the field of mobile development, and we need to test these developments to meet the expectations of the end users. It is this progress that has contributed to the growth of mobile automation. Dan Cuellar came up with a brilliant idea that involved integrating the tool with Selenium, post which he created Appium. Appium is a good tool and is widely used to automate mobile apps. The best part is that it is open source.

In this chapter, we will learn the following:

  • The advantages of Appium
  • System requirements for Android/iOS
  • Installing different software
  • Creating emulators and simulators
  • Setting up an Eclipse Java project

Appium – pros and cons

Appium is an open source tool for automating mobile apps, such as native, web-based, and hybrid applications designed for the Android, iOS, and Firefox OS platforms.

Before diving into Appium's advantages, let's discuss its shortcomings, as follows:

  • No direct support for Android Alert Handling: Alert handling is not implemented yet for native apps via Alert API but, we have an alternative to handle it which we will see in Chapter 7, Advanced User Interactions. Hopefully, alert handling will be implemented soon.
  • Limited support for Android versions: Appium directly supports Android Version 17 or later, but if we want to work with versions older than version 17, then we can use the integrated tool Selendroid.
  • Lack of image recognition: We can't locate images; to work with images, we have to work with screen coordinates, which is not the best way but again it's in their road map to apply the locator strategy to find images.
  • Mobile gestures support: Some of the gesture supports are not implemented yet, such as double-clicking in the Java client library, but they are implemented in other client libraries. Hope fully the gesture support will be implemented soon in the Java client library as well.

Now, let's discuss Appium's advantages on the basis of its philosophy.

The Appium philosophy has a different appeal from other competitors. The official philosophy (http://appium.io/slate/en/master/?java#appium-philosophy) is as follows:

  • You shouldn't recompile your app or modify it in any way in order to automate it
  • You shouldn't be locked into a specific language or framework to write and run your tests
  • A mobile automation framework shouldn't reinvent the wheel when it comes to automation APIs
  • A mobile automation framework should be open source in spirit and practice as well as in name

Appium uses vendor-provided frameworks under the hood, which meets the first requirement, so we don't need third-party code to compile the app. We can test the same build of the app that we are going to submit in the marketplace. For our second requirement, Appium extends the WebDriver client libraries, which are already written in most popular programming languages. So, we are free to use any programming language in order to write the automation test scripts.

Appium extends the existing WebDriver JSONWP with additional API methods that are convenient for mobile automation. So, Appium has the same standard as WebDriver and no reinvention for the mobile automation framework, which meets the third requirement. Last but not least, it is open source.

It provides cross-platform solutions for native and hybrid mobile apps, which means that the same test cases will work on multiple platforms. If you are familiar with Selenium WebDriver, you will feel at home with Appium, otherwise you will first need to learn WebDriver for a better understanding. Appium uses the same scripting as WebDriver. Appium allows you to talk to other Android apps that are integrated with App Under Test (AUT). For example, you can hit another app from the AUT such as a camera app. It also supports cloud-based testing; you can run your test scripts in the cloud using services such as Sauce Labs and Testdroid. They provide services to run tests on real devices or simulators.

These advantages make it superior over other mobile automation tools. The following table shows Appium's advantages over other tools based on its philosophy:

Tools

R1

R2

R3

R4

Calabash

No

No

No

Yes

iOS driver

Yes

Yes

Yes

No

Robotium

No

No

Yes

No

Selendroid

No

Yes

Yes

No

Appium

Yes

Yes

Yes

Yes

Note

R1, R2, R3, and R4 are the Appium philosophy, which we discussed earlier in this section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
35.170.81.33