In this century mobile is a household need and the applications in them are widely increasing, which makes our lifestyle smarter. This software supports us in doing many activities like messaging, making payments, shopping and many other things that end up solving our different real-life problems.
But we almost overlook what happens before these applications arrive in the market to the end-users. Once these applications are developed, they are tested before being launched for the customers and later as well with the help of mobile testing tools! One such tool that helps accomplish this is Appium. It is an open-source test automation framework. With the automated Appium test you not just save a lot of your time but also increase the testing efficiency.
In this article, we are going to share with you how you can automate Appium Test in 10 Minutes or even less for running app test automation. First, let us see why is testing important?
Why Is Testing Important?
Testing is the most prominent way to get aware of the defects or issues in an application or any software which you have developed. It is important to do the testing before the final end-to-end launch of the application so that the customers don’t suffer from bugs. To make a smooth and happy customer experience, testing plays a very crucial role as it checks the application on the five most important grounds which are- usability, security, functionality, quality, and performance.
So, if you want that the user give high ratings on the play store or app store to your application and none of your customers uninstalls, then testing is the most essential process for your application’s survival in the marketplace.
Introduction to Appium
Appium is a mobile automation testing tool that is used for validating the applications of mobile and its browsers as well. It is supported on the Android platform as well as on the iOS and Firefox OS. This tool works on checking up the three important factors of an application or mobile browser which are validating them based on response time, compatibility, and usability.
The tool helps a tester to create a script that can be used for Android, iOS, and Windows. It is flexible as it allows the tester to use the same code in iOS which was used in android. It uses the same API in all the platforms which makes it effortless and consumes the least time. Languages supported by Appium are Perl, Java, Python, and PHP.
Simulators and Emulators are the two important concepts of Appium as the whole automation testing runs on the mobile device. An emulator is a kind of software that helps you (which means your host computer) run the application which is not meant for the host but for some other system. A simulator is an exact copy of an application but it does not take hardware into consideration.
One interesting fact about Appium is that it can translate the driver command in the iOS command or in the android command, which means it does not depend on the operating system which you are using, rather it will depend on the kind of device in your hand.
Appium can integrate itself with tools like Jenkins (CI tool). The CI tools like Jenkins, Bamboo, etc help in triggering the tests automatically for every cycle.
So before using Appium make sure you have the following to proceed with the tool:
- Appium Client Library
- Eclipse IDE
- Selenium Jar
- Appium Server
- Android Studio
Appium does the automation for three types of mobile applications: Native mobile applications, Hybrid Mobile Applications, and Mobile web applications.
Native Mobile applications are the ones that are built using the Windows SDKs, or Android and iOS. They are available from the app stores.
Mobile Web applications are the browsers that you have in your mobile like chrome, safari, and many more built-in applications.
Hybrid mobile applications are those applications that will use your mobile capabilities with the help of a browser that is already present in the application. They use cross-platform and web development technology together to create a rich experience. It has a reach to a wider audience and is comparatively lower in price.
Sneak Peek to the Appium Testing in minutes
STEP 1: So first of all you must have installed an android studio and Appium on your systems. This will require you to have a few drivers that will help you in integrating and running well.
STEP 2: Now install a calculator(we are doing testing over a calculator apk as an example) available on the google play store(you can download this from apkpure.com).
STEP 3: Now install this 2MB APK on your local device which can be your android mobile (if you don’t have a mobile then you can set up an emulator from an android studio)
Fig1: Showing that calculator is downloaded
STEP 4: As the next step, install ADB from google, this will check the android devices and help to install applications.
Fig 2: ADB installer platform
STEP 5: Open Appium (this is installed from the official website of Appium – appium.io). Appium has a command-line interface version but it is recommended to use the desktop version.
Fig 3: Appium desktop version download
STEP 6: Appium is the server that will help you with testing and nothing more, so you need more things to test an application.
Fig 4: Opening screen of Appium
STEP 7: Now quickly start the server, and click on the search image which reads “start inspector session”.
Fig 5: Appium Server (start inspector session button)
STEP 8: The Inspector session is the place where your test script is generated which later is used on different devices.
STEP 9: You have a screen to set up the capabilities of your application.
STEP 10: The first capability will be your “app” go to the value section and paste the address of the application you want to test (which in our case is a calculator) and after pasting the address put a “\ and paste the name” (the name for our app is calculator apk).
STEP 11: On the right-hand side, it will create a JSON representation, so it is like mapping up key-value pairs and later sending them to the server.
STEP 12: Now we will set up a second capability which is our “device name”, for its value open your command prompt and go to ADB devices from the command prompt.
STEP 13: This will show the devices when it comes to android which is connected to your system at this point(in our case it is an emulator so this will show the emulator’s name). Copy this “device name” and paste it into the value.
STEP 14: The third capability is the “platform name” here in the value write down “android”.
STEP 15: Click on start session.
Fig 6: Here are all the three capabilities with values and JSON script of it
STEP 16: Here you get a page that has all the logs of things happening in the background(this will show you errors if any)
Fig 7: Log screen (will show errors in case of any issue)
STEP 17: If everything goes great without errors then you get a screen where your testing process starts and you will finally see a screen that has the interface for your testing and the calculator is launched without invoking it because Appium has directly started it.
STEP 18: Your screen has the self-invoked calculator with “element selector” (on top tab), “App source” in the middle, and “selected element” on the rightmost. Element selector has lots of buttons. The first button is your select element. When you click on this it will allow you to select an element (like you can choose any number like 9 on the calculator). The selected element tab has three options: tap, send keys, and clear.
Fig 8: Testing screen with different segments
STEP 19: “Tap” means to tap on it and it will test out for all the interactions that it has and you can send the values that are sent keys.
Fig 9: Input screen for testing (9) and below the recorder you have the code for testing
STEP 20: Appium also has a recording option which is the sixth option in the element selector.
STEP 21: Now you click on 9 on the self-invoked calculator and click on tap you will have a testing script and this is how you can test out your applications.
Now, if you wish to perform Appium testing of web, native, and hybrid applications and want to accelerate your release cycles, you can use cloud-based testing platform like LambdaTest. It will help you to test your hybrid, native, and web applications on over 3000+ different real devices.
Let us look at the top features of LambdaTest for Appium automation testing.
LambdaTest platform for Appium testing
- You can test on a reliable and secure automation cloud of real iOS and Android devices.
- You can perform parallel testing that will reduce your execution time by multiple folds.
- Creating and handling an in-house device lab is tough. Now sap those things and move on to this platform where you can run tests on devices from any time anywhere.
- Perform hybrid, native, and web application tests on over 3000 real devices.
- You can debug your test runs with the end-to-end test execution logs.
So here it was a quick testing way of a mobile application using the Appium testing platform. Appium is one of the most used testing tools as it comes for free as an open-source (there is no complex installation that is required). Its reusability feature on cross platforms makes it a renowned tool as it doesn’t suffer from the compatibility factor. Like every other testing tool, it also ends up recording the application (the one being tested) by inspecting the Document Object Model (DOM).
Thank you for reading the article, please comment down below if you have any suggestions. We will be thrilled to hear from you.