Automation testing, including tools like Appium, is indispensable in modern software development for its ability to enhance efficiency, consistency, and scalability in mobile application testing.
Appium stands out as a favored choice due to its cross-platform compatibility, open-source nature, support for multiple programming languages, and seamless integration with testing frameworks, empowering organizations to ensure the quality and reliability of their mobile apps across diverse devices and platforms. This documentation provides a step-by-step guide on how to test Android App using Appium.
Before you begin setting up Appium, make sure you have the following prerequisites in place:
Appium is an open-source tool that enables automated testing of mobile applications on Android and iOS platforms.
You can install Appium using the GUI Appium Server or through the command line:
Using GUI Appium Server (Recommended for beginners)
Through Command Line
node -v
npm install -g appium
appium
This command will start the Appium Server, and it will display the server's IP address and port, which you will use to connect your automation scripts.
Download Eclipse IDE:
Direct Package Installation (Alternative):
Launch Eclipse IDE:
Select a Workspace:
Install TestNG Plugins (Optional):
Access the Eclipse Marketplace:
Click on the "Help" menu in the top menu bar of Eclipse, and then select "Eclipse Marketplace." This will open the Eclipse Marketplace window.
Search for TestNG:
In the Eclipse Marketplace window, you'll find a search bar at the top-right corner. Type "TestNG" into the search bar and press Enter.
Locate the TestNG Plugin:
The search results will display the TestNG plugin. Click on it to select it.
Install TestNG:
Click the "Install" button next to the TestNG plugin in the search results.
Review and Confirm:
Eclipse will present you with an installation summary, showing you the features and components that will be installed. Review this information and click the "Confirm" or "Next" button.
Accept the License Agreement:
You will be prompted to accept the terms of the TestNG license agreement. Check the box to accept the license agreement, and then click "Finish" to proceed.
Restart Eclipse:
After the installation is complete, Eclipse will prompt you to restart the IDE. Click the "Restart Now" button to restart Eclipse.
The APK Info app is a handy utility that allows users to retrieve detailed information about Android application packages (APKs). It provides essential insights into an APK's properties, permissions, version details, and more. For testing, we require information like Package name, version name, Minimum Android Version, etc. You can install this app from the Google Play Store and explore APK details.
In your newly created Maven project, locate the pom.xml file. Open the pom.xml file in Eclipse. Inside the <dependencies> section, add the necessary dependencies for Appium, Selenium, and TestNG. Here's an example:
<dependencies>
<!-- Appium -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.5.1</version> <!-- Use the latest version available -->
</dependency>
<!-- Selenium -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version> <!-- Use the latest version available -->
</dependency>
<!-- TestNG -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.4.0</version> <!-- Use the latest version available -->
</dependency>
</dependencies>
Save the pom.xml file, and Eclipse will automatically download the dependencies.
Ensure that your Android device is connected to your computer via USB, and USB debugging is enabled on your Android device.
If you haven't already, start the Appium Server using either the GUI Appium Server or the command-line approach, as explained in the previous sections.
Right-click on your test class (e.g., AndroidAppTest) in Eclipse. Select Run As > TestNG Test. Eclipse will execute your Appium test, and you'll see the test results in the TestNG output.
Setting up Appium for mobile application testing is a crucial step in ensuring the quality and reliability of your mobile apps. With the right prerequisites and steps, you can automate your testing process efficiently. Now that you have a step-by-step guide, you're ready to embark on your Appium testing journey.