This project automates mobile application testing for both Android and iOS platforms using Appium, TestNG, and Java. The framework is designed to handle multiple platforms by switching desired capabilities and driver configurations dynamically. By modifying the driver setup in the DriverManager
class, tests can be executed on Android devices using UiAutomator2 or on iOS devices using XCUITest.
- π Overview
- π§ Prerequisites
- βοΈ Setup
- π Project Structure
βΆοΈ Running the Tests- π Project Details
- π Logging
- π₯ Contributors
- π€ Contributing
- π License
- π Contact
- Java Development Kit (JDK) 11 or higher
- Apache Maven
- Node.js and npm
- Appium Server
- Appium Inspector
- Appium Doctor
- Android SDK
- Android Emulator or a Physical Android Device
- Download and install JDK from Oracle.
- Set
JAVA_HOME
environment variable. - Environment Variable Setup:
- Open the command prompt and run
where java
to find the Java installation path. - Add the Java installation path to the environment variables:
Path
:C:\Program Files\Java\jdk-11\bin
JAVA_HOME
:C:\Program Files\Java\jdk-11
- Add
%JAVA_HOME%\bin
to the systemPath
.
- Open the command prompt and run
- Download and install Maven from Maven.
- Set
MAVEN_HOME
environment variable.
- Install Node.js from Node.js.
- Run the following commands in the command prompt:
npm install -g appium npm install -g appium@next appium -v
- Run the following commands in the command prompt:
npm install @appium/doctor --location=global appium-doctor --android
- Download the Appium Desktop application from Appium and install it.
- Alternatively, you can start the Appium server from the command line:
appium
- Run the following commands in the command prompt:
appium driver install uiautomator2 appium driver list
If you are using MacOS and need to test iOS devices, you should install the XCUITest driver:
appium driver install xcuitest
-
Download and install the Android SDK from Android Studio.
-
Environment Variable Setup:
- Add the following to the system environment variables:
ANDROID_HOME
:C:\Users\YourUsername\AppData\Local\Android\Sdk
Path
:%ANDROID_HOME%\platform-tools
%ANDROID_HOME%\cmdline-tools
- Add the following to the system environment variables:
-
SDK Setup in Android Studio:
- Open Android Studio and go to
More actions
>SDK Manager
. - Under
SDK Platforms
, ensureAndroid API 34
is selected. - Under
SDK Tools
, ensure the following are installed:Android SDK Build-Tools 34
Android SDK Command Line Tools
Android SDK Tools (Obsolete)
(Uncheck "Hide Obsolete Packages" to see this)Android Emulator
Android Emulator hypervisor driver (for AMD processors)
Android SDK Platform-Tools
Intel x86 Emulator Accelerator (HAXM installer)
(Ensure virtualization is enabled in BIOS)
- Open Android Studio and go to
- For AMD processors, ensure
Android Emulator Hypervisor Driver for AMD Processors (installer)
is selected and applied.
- Open Windows Features and ensure the following are NOT selected:
Hyper-V
Virtual Machine Platform
Windows Hypervisor Platform
Appium Inspector is a tool for inspecting mobile applications. To install it, download the latest version from the Appium Inspector releases page and follow the installation instructions for your operating system.
appium-mobile-automation-framework
βββ .idea
βββ src
β βββ apk
β βββ main
β βββ test
β βββ java
β βββ com
β βββ webdriverio
β βββ base
β βββ pages
β βββ tests
β βββ utils
β βββ resources
β βββ logs
β βββ log4j2.xml
βββ target
βββ .gitignore
βββ appium-mobile-automation-framework.iml
βββ LICENSE
βββ pom.xml
βββ README.md
βββ testng.xml
- com.webdriverio.base: Contains base classes for the project.
- com.webdriverio.pages: Contains page object classes for the mobile application.
- com.webdriverio.tests: Contains TestNG test classes.
- com.webdriverio.utils: Contains utility classes for the project.
- resources.logs: Contains log configuration files.
Important: Ensure that your Android device or emulator is running and properly configured before executing the tests.
-
Clone the Repository:
git clone https://github.com/cihat-kose/appium-mobile-automation-framework.git cd appium-mobile-automation-framework
-
Start Android Emulator or Connect a Physical Device:
- Start your Android emulator from Android Studio or connect a physical device via USB and ensure it is in developer mode.
-
Run the Tests:
- Use Maven to run the tests:
mvn clean test
- Use Maven to run the tests:
-
Start Android Emulator or Connect a Physical Device:
- Start your Android emulator from Android Studio or connect a physical device via USB and ensure it is in developer mode.
-
Run the Tests from LoginTest Class:
- Open the
LoginTest
class in your IDE. - Right-click on the class or the test method and select
Run 'LoginTest'
orRun 'testLogin'
.
- Open the
- AppiumServer Class: Manages the Appium server lifecycle.
- DriverManager Class: Handles the initialization of the Android driver.
- LoginPage Class: Contains methods to interact with the login page.
- LoginTest Class: Contains TestNG test cases for verifying the login functionality.
The project uses Log4j2 for logging. Configuration is set in the log4j2.xml
file located in the src/test/resources/logs
directory. Logs provide detailed information about the test execution and any issues encountered.
Contributions are welcome! Please fork the repository and create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or suggestions, please open an issue or contact the repository owner.