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.
|© Razs Originals! | Appium Software Automation Tool|
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.
Table of Contents
Before you begin setting up Appium, make sure you have the following prerequisites in place:
- Node.js and npm: Appium is built on Node.js, so you need to have Node.js installed.
- Java Development Kit (JDK): Install the latest version from Oracle's website if you plan to automate Android apps.
- Android Studio: Required for the Android Virtual Device (AVD) emulator if you plan to automate Android apps.
- Eclipse IDE: You can use Eclipse for your automation projects.
- TestNG Plugin for Eclipse: Install the TestNG plugin for Eclipse to facilitate test case management.
- APK Info app: Install the APK Info app from the Google Play Store for Android automation.
- ADB (Android Debug Bridge): ADB is a command-line tool that comes with Android Studio. Make sure it's installed and added to your system's PATH.
How to Install Appium Server
Appium is an open-source tool that enables automated testing of mobile applications on Android and iOS platforms.
2. Install Appium Server
You can install Appium using the GUI Appium Server or through the command line:
a) Using GUI Appium Server (Recommended for beginners)
- Download the GUI Appium Server from the official releases page.
- Choose the appropriate version for your operating system (Windows, macOS, or Linux) and download it.
- Install Appium by following the installation instructions for your specific operating system.
- Launch the Appium GUI. You will use this interface to configure and run your Appium tests.
b) Through Command Line
- Install Node.js and npm from the official website.
- To verify that Node.js and npm are installed correctly, open your command line or terminal and run the following commands:
- Install Appium globally by running the following command:
npm install -g appium
- Start the Appium Server by running:
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.
Steps to Download, Install, and Set Up Eclipse IDE:
Download Eclipse IDE:
- Visit the official Eclipse download page at https://www.eclipse.org/downloads/.
- Choose the Eclipse IDE flavor that matches your development requirements.
- Click on the download link corresponding to your operating system (Windows, macOS, or Linux).
Direct Package Installation (Alternative):
- If you downloaded a package directly (e.g., a .zip or .tar.gz file), extract it to your desired installation directory.
Launch Eclipse IDE:
- After installation, navigate to the Eclipse installation directory and launch Eclipse by executing the appropriate executable file for your operating system.
Select a Workspace:
- The first time you launch Eclipse, it will prompt you to select a workspace directory. This is where your projects and configuration settings will be stored. You can choose the default workspace or specify a custom location.
Install TestNG Plugins (Optional):
a) 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.
b) 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.
c) Locate the TestNG Plugin:
The search results will display the TestNG plugin. Click on it to select it.
d) Install TestNG:
Click the "Install" button next to the TestNG plugin in the search results.
e) 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.
f) 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.
g) Restart Eclipse:
After the installation is complete, Eclipse will prompt you to restart the IDE. Click the "Restart Now" button to restart Eclipse.
APK Info App
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.
9. Create a Simple Maven Java Project:
- Open Eclipse IDE and make sure it's configured properly.
- Go to File > New > Other and select Maven > Maven Project.
- Click "Next" and choose the option "Create a simple project (skip archetype selection)."
- Click "Next" and enter your project details (Group Id and Artifact Id).
- Click "Finish" to create the Maven project.
10. Add Dependencies to pom.xml (Appium, Selenium, TestNG)
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.
11. Connect ADB and Mobile Device via USB
Ensure that your Android device is connected to your computer via USB, and USB debugging is enabled on your Android device.
12. Start the Appium Server
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.
13. Run Your Java TestNG Test
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.