Appium TutorialAppium tutorial provides basic and advanced concepts of the Appium Automation testing tool. Our Appium tutorial is designed for beginners and professionals. In this tutorial, we are going to discuss the following topic:
What is Appium?Appium is an open-source automation mobile testing tool, which is used to test the application. It is developed and supported by Sauce Labs to automate native and hybrid mobile apps. It is a cross-platform mobile automation tool, which means that it allows the same test to be run on multiple platforms. Multiple devices can be easily tested by Appium in parallel. In today's development area, the demand for mobile applications is high. Currently, people are converting their websites into mobile apps. Therefore, it is very important to know about mobile software automation testing technology and also stay connected with new technology. Appium is a mobile application testing tool that is currently trending in Mobile Automation Testing Technology. Appium is used for automated testing of native, hybrid, and web applications. It supports automation test on the simulators (iOS) and emulators (Android) as well as physical devices (Android and iOS both). Previously, this tool mainly focused on IOS and Android applications that were limited to mobile application testing only. Few updates back, Appium declared that it would now support desktop application testing for windows as well. Appium is very much similar to the Selenium Webdriver testing tool. So, if you already know Selenium Webdriver, Appium becomes very easy to learn. Appium has NO dependency on mobile device OS because it has a framework that converts the Selenium Webdriver commands to UIAutomator and UIAutomation commands for Android and iOS respectively, that depends on the device type rather than the OS type. It supports several languages such as Java, PHP, Objective C, C#, Python, JavaScript with node.js, and Ruby, and many more that have Selenium client libraries. Selenium is the backend of Appium that provides control over the functionality of Selenium for testing needs. Features of Appium
Advantages of Appium
Disadvantages of AppiumAlong with some features and advantages, Appium has some drawbacks too, which are as follows-
Solution: This problem can be resolved if you will run your script in the mobile cloud of Sauce Lab. Currently, it allows scripts to run on multiple iOS simulators at the same time. Appium ArchitectureAppium is an HTTP server that is written in node.js. It starts a "test case" on the device that gives rise to a server and listens for proxied commands from the main Appium server. Tester writes the Test scripts to execute on device or Emulator. Several webdriver sessions for different platforms like Android and IOS are created and handled by the Appium. Test Scripts written by the tester executes on the Emulator or device by sending them as requests to the Appium server. Each vendor, such as IOS or Android, has a different method and mechanism to execute test cases on the device. So, the test case executes after listening commands from the Appium server. Appium uses JSON wire protocols to send command requests to Appium server. How Appium work?
Remember that Appium uses another open-source library Selendroid to support older APIs because UIAutomator only supports API 16 or higher.Now we will discuss how Appium works on different platforms - Appium in AndroidOn Android, Appium proxies the command to a UIAutomator script running on the device. UIAutomator is a native UI automation framework of Android that allows you to run Junit test cases directly into the device using command line. Although it uses Java programming language, but Appium allows to run it from any WebDriver supported language. Android uses bootstrap.jar, which works as a TCP server. It is used to send the test commands to perform the actions on Android device using UIAutomator. In the below figure, see the Appium architecture in respect to Android automation - Appium in iOSAs Android uses UIAutomator, iOS uses UIAutomation. Similar to the Android, Appium proxies the command to a UIAutomation test case running on the Mac instruments environment. Apple provides this application "instrument" that performs various activities like building, profiling, and controlling iOS apps. On the other hand, it also has an automation component where you can write commands in JavaScript. It uses UIAutomation API to interact with Application UI. Appium uses same libraries to automate iOS Apps. In the below figure, see the Appium architecture in respect to iOS automation - Note in the above diagram that bootstrap.js is used in place of bootstrap.jar. It performs the actions on our AUT (Application Under Test).Types of Mobile ApplicationsAs we discussed earlier, Appium has the ability to deal with all sorts of applications, i.e., native, hybrid, and web. Let's understand them in details - Native ApplicationsNative applications are software programs that are developed by keeping a certain platform in mind. These applications are developed using a specific software development kit. Native apps are developed for use on a specific device and can be installed from the App Store, such as Google Play Store or Apple's App Store. They can work offline and can also use the device notification system. Some native application examples are - Pinterest, Skype, Snapchat, etc. Web ApplicationsWeb applications are not real applications, they are websites that run on browsers. These applications are developed using HTML, CSS, and JavaScript at a very low price. Unlike Android and iOS apps, they do not require a Software Development Kit (SDK) for developers to work with. Web applications are not developed for a particular platform. Since the web applications run on web browsers, they don't require any installation. Some web application examples are - Flipkart, Ali Express, twitter, etc. Hybrid ApplicationsHybrid application is a combination of native and web applications. Like native applications, these applications can be downloaded from the App Store and also can take advantage of device features, but actually they are web applications inside. They are developed using web development languages - HTML, CSS, and JavaScript like the hybrid app, which allows them to run on any platform. Some hybrid application examples are - OLA, Instagram, Basecamp, etc. Prerequisites to use Appium
Appium Installation on windowsSetting up Appium is not only the installation of a single tool or setting up a few variables. A complete setup of Appium requires the installation of many other tools. Then Appium starts testing of an application. This tutorial mainly focuses on Appium setup for Android on Windows Operating system. Install and setup JavaWith Appium, you need to write automation test scripts that can interact with your mobile screen and control fields (such as text boxes, buttons, etc.) in your mobile application, and also can perform actions on them. Java is used to write these automation test scripts. So, download the latest version of JDK and setup the environment variable.
Install and setup Android StudioThis is one of the most time taking step to download and install the Android Studio. It may cause of errors in Appium if not done properly. With downloading the Android Studio, there are many other changes need to be setup. Here, we would recommend you to download the latest version of Android Studio.
Step by step installation of Appium Desktop ClientNow after installing Java and Android Studio and setting up environment variables for both, install Appium Desktop Client. Appium Studio is a GUI app to install Appium server. It comes with all pre-requirements for installing and using Appium server. It has an inspector, which is used to get basic information on your mobile app. Steps for installing Appium Desktop Client on windows are as follow: Step 1: Go to the following link http://appium.io/ and click on the Download Appium button. Step 2: For Windows OS, download the exe file of Appium desktop setup. So, click on the file as shown in below screenshot. Step 3: After downloading the exe file, double click on the downloaded file to run. Note: On window OS, you don't need to install Appium. It runs from .exe file directly, whereas you need to install the dmg for Mac machine.Step 4: Here, you need to choose the installation options. You can select all users, if you have multiple users on your system, otherwise select only me for the administrator of the system. After choosing the installation option, click on the install button. This will start the installation, which may take time to install. Step 5: Appium has been successfully installed on your system. For completing Appium setup, click on the Finish button. Note that Run Appium is checked. This will start the Appium Desktop. Step 6: Now, Appium Desktop UI will appear on the screen containing the default Host and Port, which can be changed. Default Host - 0.0.0.0 Default Port - 4723 Click on the Start Server button and start Appium Server. Step 7: A new server will launch on the Host and Port specified in previous step. You can see the message on the top of the screen that Server is running. Step 8: Go to File and click on the New Session Window. Step 9: Provide all desired capabilities here and Click on the Start Session button to start a new session.
Note that Microsoft window does not support to run Appium Inspector.Appium DoctorTo check the Appium installation and dependencies, you can install appium-doctor from here. Appium-doctor is an application tool to verify Appium installation. It shows all the missing things that you need to do. So, this will be very useful to run appium-doctor whenever you get any issue. It will install through npm. Limitation of Appium
Competitors of AppiumThere are several tools available for automated testing mobile applications, such as Robotium, Appium, Experitest, Selendroid, Kobiton, and Testdroid, etc. They all are tough contestants for Appium. But Selendroid and Robotium are one of the top competitors of Appium. Let us know some differences and see how they differ from each other. Appium vs Robotium
Appium vs Selendroid
|