This multi-module Java framework for test automation has been built with Maven and utilizes Selenium and Appium for browser and mobile automation, providing fast and reliable execution of web & mobile tests with detailed reporting and integration capabilities.
- Programming Language: Java
- Build Tool: Maven
- UI Automation Frameworks: Selenium, Appium
- Testing Framework: TestNG
- Reporting: Allure Report
- IDE for iOS development: Xcode
Requires Java 17, Maven 3.9.x, Allure Report 2.33.x, and Xcode 16.x to be installed and properly configured on your local machine.
- (Mac) OS X
- Xcode (>= v.16.4)
- Update Components (Xcode -> Settings -> Components) to the latest versions.
- Update Components (Xcode -> Settings -> Components) to the latest versions.
- Appium2 with appium-xcuitest-driver
- Appium-Doctor (a tool for checking Appium installation). It checks if Node.js, JDK, Android SDK, and Xcode are installed.
brew install node
node -v
npm -v
npm install -g appium
appium -v
Basic commands for working with Appium Drivers:
appium driver list
appium driver install <driver name>
appium driver update <driver name>
appium driver uninstall <driver name>- Parameter:
<driver name>- XCUITest driver
Basic commands for working with Appium Plugins:
appium plugin list
appium plugin install <plugin name>
appium plugin update <plugin name>
appium plugin uninstall <plugin name>appium
npm install -g appium-doctor
appium-doctor --ios
1.2. Build WebDriverAgent (WDA) in Xcode:
Building WebDriverAgent (WDA) in Xcode is crucial for using Appium to automate iOS applications. WDA is a server that allows Appium to interact with iOS devices and simulators.
Here’s a step-by-step guide on how to build and configure WebDriverAgent in Xcode:
Path typically:
/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
Or:
~/.npm-global/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
- Open Xcode
- Select File -> Open
- Navigate to the WebDriverAgent folder you found in the previous step
- Open WebDriverAgent.xcodeproj
Ensure the project is set to use automatic signing:
- Click on the WebDriverAgentRunner in the project navigator
- Select the target (on the right side in the project settings)
- Under the Signing & Capabilities tab:
- Select your development team from the Team drop-down
- Make sure the Automatically manage signing option is enabled
- Select your development team from the Team drop-down
- Connect your physical iOS device via USB or choose a simulator
- In the top left corner, select your device or simulator from the device drop-down list
- With the correct scheme selected and device input, click on Product in the Xcode menu
- Select Build or press Command + B
- Monitor the Issue Navigator (the triangle icon) for any errors
- Open a new terminal window
- Run the following commands to start the Appium server:
appium --log-level debug- WebDriverAgent will launch automatically
http://<device-ip>:8100/statusReplace <device-ip> with the IP address of your iOS device while ensuring that the device’s WDA server is running.
- Clone (or use option 'Open with Xcode') the project (iOS app for testing) from this GitHub repository. This is a simple 'Hello World!' application for iOS devices using Swift 6.1.2, created for testing purposes with Appium.
- Select a iOS simulator (e.g.,
iPad (A16)) in Xcode and build application. After a successful build, the.appfile will appear inDerivedData:
~/Library/Developer/Xcode/DerivedData/YourProject-XXXXXX/Build/Products/Debug-iphonesimulator/TestApp.app
This template provides a UI test automation solution suitable for both web and mobile (iOS). It is structured as a Maven multi-module project, with the following relationships between the modules:
|———core-frmk
|—-pom.xml
|—-config
|—-.env
|—-module-app
|—-pom.xml
|—-src
|—-main
|—-java
|—-module-tests
|—-pom.xml
|—-src
|—-test
|—-java
|—-resources
|—-testng.xml
|—-allure.properties
|—-module-tools
|—-pom.xml
|—-src
|—-main
|—-java
- Root Module (
core-frmk). The parent project that defines shared dependencies, plugin configurations, and manages overall builds. Contains theconfigdirectory, where environment variables (.envfiles of various extensions) are stored for easy configuration management. - Modules:
module-app. The main module containing page object classes, UI components, and core application logic. It depends on module-tools for shared utilities and design pattern implementations.module-tools. A utility module providing shared helpers, including support for browser configuration and Selenium integration, scalable Page Object pattern implementations, report generation, logging, and other common functions used across modules.module-tests. This module contains test classes and test configurations (testng.xml). It depends on module-app to access page objects and perform web UI testing in a controlled environment.
Run this command from the start to ensure that you don't have anything corrupted.
cd core-frmk
mvn clean install -U -DskipTests=true
Maven is used as the build and test management tool, with additional options for test configuration:
-Denv={String} specifies the environment for test execution (default: test)
-Dbrowser={String} - defines the browser to run web tests on (default: chrome)
-DiOS={int} - defines the iOS version to run mobile tests on (default: the version set in Xcode)
-Ddevice={String} - defines the name of device for run mobile tests on (default: the name set in Xcode)
-Dthreads={int} - specifies the number of threads for parallel test execution
-Dtest={String} - the specific test class to run
- Removes the
targetdirectory before running tests. Ensures that previous results do not affect the Allure report.
mvn clean- Runs tests defined in your
testng.xml, using default system property settings (e.g., env, browser). By default, it executes with Chrome.
mvn testFor example:
cd core-frmk
mvn clean testCreate a hidden .env file containing the BASE_URL parameter to configure the web URL for testing. This will allow you to easily manage the base URL used during your web tests.
BASE_URL = https://demoqa.com- Google Chrome
- Mozilla Firefox
- Safari [Mac OS X]
To execute a specific test with default settings the next command line should be used:
mvn clean test -Dtest=HomeWebTestTo execute a test with custom options the next command line should be used:
mvn clean test -Dtest=HomeWebTest -Dbrowser=firefox -Denv=devTo execute tests in parallel with testng.xml the next command line should be used:
mvn clean test -DsuiteFile=src/test/resources/suites/web.xml -Dthreads=3Create a hidden .env file containing the parameters APPIUM_URL, APP_NAME, and APP_BUNDLE_ID to configure the testing environment for mobile tests.
Place your builded iOS application (e.g., TestApp.app) from DerivedData folder into the local app directory.
The APP_BUNDLE_ID is a unique bundle identifier for a mobile application on the iOS or Android platform. This identifier is used to differentiate apps in systems and services such as the App Store or Google Play.
APPIUM_UR = http://0.0.0.0:4723/
APP_NAME = "TestApp.app"
APP_BUNDLE_ID = com.kmartitaTo execute the mobile test itself the next command line should be used:
cd core-frmk
mvn clean test -Denv=dev -Dtest=HomeMobileTest -DiOS=18.6 -Ddevice="iPad Pro 13-inch (M4)"- iPad (A16) - iOS 18.6
To generate a report by Allure after tests have finished, use the following command:
mvn allure:reportThe report can be found in the root folder of a project. The folder named allure-report contains the generated report. Just open the index.html file in a browser.
Alternatively, Allure provides a command to serve the report directly:
mvn allure:serve This command starts a local web server and automatically opens the generated report in your default browser.
An example of the generated Allure TestNG report looks like this:
mvn clean test -Denv=devBrowser: Chrome
iOS-version: 18.6
Deevice: iPad (A16)
mvn clean test -DiOS=18.6 -Ddevice="iPad Air 11-inch (M3)" -Denv=dev -DsuiteFile=src/test/resources/suites/mobile.xml
mvn clean test -Dbrowser=firefox -DsuiteFile=src/test/resources/suites/web.xmlEnv: test