Autoplay



Transcripted Summary

In this chapter, we will cover:

  • What is Appium
  • Appium philosophy
  • Appium Client/Server architecture
  • Appium desktop
  • Appium roadmap, or what's next in Appium version 2

# What is Appium?

As we mentioned in the course overview, Appium is an open-source tool for automating native mobile web and hybrid applications for iOS, Android, and Windows desktop platforms.

The native applications are those written using iOS, Android, or Windows SDKs.

Mobile web apps are web applications that can be accessed using mobile browsers.

Appium supports Safari on iOS devices and Chrome or the built-in browser application on Android devices.

Appium is cross-platform, which allows you to write tests against multiple platforms, such as iOS, Android, and Windows, using the same API, same classes, and the same structure.

You can write your Appium tests with different programming languages.

There is no need to learn a specific programming language to write Appium scripts, so you can use whatever you want - Java, Python, JavaScript, C#, and Ruby.


# Appium Philosophy

Appium philosophy contains four rules:

  1. You shouldn't have to recompile your application or modify it in any way in order to automate it.

    We don't need to change anything in the application, in the settings, or in building the application to be able to write Appium scripts. We are writing the app that will be deployed and published to the clients, so there is no need to do anything customized for Appium.


  1. You shouldn't be locked into a specific language or framework to write and run your tests.

    As we mentioned, Appium supports multiple programming languages and multiple test runs, so you can use whatever you want or prefer to write your Appium scripts.


  1. A mobile automation framework shouldn't reinvent the wheel when it comes to automation APIs.

    We are using the same APIs for all the platforms to write our test scripts, so there is no need to create custom things with Appium.

    We can use Appium for running and writing tests for different platforms and different applications.


  1. A mobile automation framework should be open source, in spirit and practice, as well as in name.

    As we mentioned, Appium is a cross-platform framework and it's open-source, so it's free and includes contributions from different engineers all over the world.


There are different releases from Appium and different features also, including the framework or the tool.

Appium is the best solution for you if you are thinking about writing test scripts for your mobile devices - for both Android and iOS applications.

Appium is based on the following frameworks:

  • For iOS version 9.3 and above, Appium uses the XCUITest as a framework to be able to automate iOS applications.

  • For iOS 9.3 and lower, Appium uses Apple UIAutomation.

  • For Android 4.3+, Appium uses Google UiAutomator or UiAutomator2.

  • For Windows, Appium uses Microsoft WinAppDriver.


# What are the Appium concepts?

The first Appium concept is client/server architecture.

Appium contains a client and a server, and by connecting between the client and server, we should have a session to open a connection between the client and the server.

Then, we should have desired capabilities, or the configuration, to be able to send it with the session to the server.

So mainly, we are using the client from our test script and connecting it to the Appium server, to be able to open the session between the client and the server, and then using the desired capabilities, or specific configuration, to start our session with Appium.

In the client/server architecture, Appium is a web server that exposes a REST API.



It receives the connection from the client, listens for the commands, executes the commands on mobile devices, and responds with the HTTP response representing the result of the command execution.

The fact that we have a client/server architecture opens up a lot of possibilities.

We can write our test code in any language that has an HTTP Client API, but it's easier to use one of the Appium client libraries, such as for Java or C# or Python, or any programming languages.

The session is always performed in the context of a conversation.

Clients initiate a session with a server in ways specific to each library, but they all end up sending a POST session request to the server with a JSON object called desired_capabilities.

At this point, the server will start the automation session and respond with a session ID, which is used for sending further commands to the mobile device.


# Desired Capabilities

Desired capabilities are keys and values encoded in a JSON object like a map or hash, sent by Appium clients to the server when a new automation session is required.

They tell the Appium driver all kinds of important things about how you can test your application or how the test will work.

Each Appium client builds capabilities in a way specific to the client's language, but in the end, they are sent over to Appium as JSON objects.

Desired capabilities can be scripted in a WebDriver test or set within the Appium server GUI or via an inspector session.

For example, here is the JSON object or this is the desired_capabilities that is sent to the Appium server.



We are sending the platform name - In this case, we will use iOS - the platform version, the device name, the automation name, and the application path.

In the end, this will be a JSON object sent from the client to the server, then to the mobile device to be able to run the test with this specific configuration.


# Appium Desktop

Appium Desktop is a suite of apps for Mac, Windows, and Linux which gives you the power of automation for Appium Server in a beautiful and flexible UI.

It's a combination of Appium-related tools:

  • A graphical user interface for Appium server - you can set options, start, and stop the server and see the Appium logs

  • An inspector that you can use to look at your app's elements - like Safari, Chrome browser, or native or hybrid application - get basic information about them and perform a basic interaction with them, like click and tap.

This is useful as a way to learn about Appium or a way to learn about your app so you can write your tests in your client, which in our case is Java with Appium.

So this is the screenshot for Appium Desktop - when we install it in the next chapter we will check it in detail.



This is the starter screen for Appium Desktop.

This is usually linked to the default port for Appium, and here we can click "Start Server" or "Edit Configurations".

If you want anything advanced or anything customized, we can click on tabs.

After we start, we will have this Appium server log screen and we can check all the sessions or all the connections between the client and server.

So for example, here is the welcome message from Appium.

After that, we will find something like this if we send desired capabilities with one application or one iOS application.

Here, you can find the JSON object of desired capabilities - for example, a bundleId, which is a package name, if we are talking about Android.

In iOS, it's a bundleId, the deviceName, the platformName, the platformVersion, a udid or the ID of the device, and all the things that are related to the session.

Here, we are creating a session using the desired capabilities.

After that, the session is created, so the server responds to us with the session id.

After that, this is the current user, and you can find "XCUITest" as the framework that Appium used for iOS.

This is a simple example for the Appium Server and the Appium desktop GUI.


# Appium Roadmap

From this link, you can open the URL and you can check the roadmap for Appium and for upcoming projects - for example, updates to the library, Appium 2 is coming also and starting to roll out to clients.

You can check this document for status for everything that's related to Appium - any problem or any issue you can find is also in this tab.

This is the official GitHub repository for Appium, and here you can find everything related to the PR, the release versions, and the issues or the pull requests that are open for this one.

For example, this is the current version for Appium, and also with the tags, you can check the beta versions or anything related to Appium.

Now it's time to go to the next chapter and start with Appium installation for Windows and macOS operating systems.



Resources



© 2024 Applitools. All rights reserved. Terms and Conditions Privacy Policy GDPR