8000 GitHub - 3sidedcube/mobile-test-automation-base
[go: up one dir, main page]

Skip to content

3sidedcube/mobile-test-automation-base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧪 ARC Blood Appium Test Automation Framework

A cross-platform TestNG + Appium mobile test automation project for the ARC Blood application, supporting both Android and iOS on real devices.


📁 Project Structure

src/
├── main/java/com/cube/qa/arcblood/
│   ├── config         # TestConfig, ConfigLoader
│   ├── pages          # Page Object Model (POM)
│   └── utils          # DriverManager, BasePage
├── test/java/tests    # Test classes (TestNG)
└── test/resources/
    └── apps/          # APK & IPA binaries (not committed)
        ├── android/
        └── ios/

testng.xml             # Combined test suite (parallel)
testng-android.xml     # Android-only suite
testng-ios.xml         # iOS-only suite
pom.xml                # Maven configuration
.gitignore             # Excludes platform-specific & large files

🚀 Getting Started

✅ Prerequisites

  • Java 17+
  • Maven
  • Appium Server running (appium or Appium Desktop)
  • Real Android or iOS device connected
  • build, udid, and platform set via testng or CLI

⚙️ Configuration

testng.xml Example

<parameter name="platform" value="android"/>
<parameter name="build" value="src/test/resources/apps/android/app.apk"/>
<parameter name="udid" value="YOUR_DEVICE_UDID"/>
<parameter name="fullReset" value="true"/>

Set fullReset to "true" to install a fresh app each time, or "false" to retain app data.


🧠 Locator Strategy & Fallbacks

Each page defines element locators using a primary + fallback approach. For example:

welcomeTitleLocators = List.of(
        By.id("com.cube.arc.blood:id/title")
            );

Only the first working and visible locator will be used. This increases resilience across versions/platforms.


🧪 Running Tests

1. Cross-Platform

Runs both Android & iOS tests:

mvn test

2. Platform-Specific

Android:

mvn test -DsuiteXmlFile=testng-android.xml

iOS:

mvn test -DsuiteXmlFile=testng-ios.xml

3. Custom CLI Overrides

mvn test -Dplatform=android -Dbuild=path/to.apk -Dudid=your_device_udid -DfullReset=true

🔀 Parallel Execution

Defined in testng.xml with:

<suite name="Cross Platform Suite" parallel="tests" thread-count="2">

This allows Android and iOS tests to run simultaneously, each on a dedicated thread/device.


🧹 .gitignore Highlights

  • App binaries:
    • *.apk, *.ipa, *.app
  • Build output:
    • /target/, /build/, /out/
  • IDEs: .idea/, .vscode/
  • Logs: *.log, appium.log
  • Test reports: /surefire-reports/, /failsafe-reports/

Ensure binaries are placed locally at: src/test/resources/apps/android/ and src/test/resources/apps/ios/


📦 Logging

The framework includes safe, thread-aware logging like:

[ANDROID | Thread-1] ▶ STARTING TEST: testWelcomeLoginButtonAppears

This helps distinguish test output during parallel runs.


💡 Main files and directories

  • Pages Directory: Add locators and functions in here
  • testData Directory: Model data and store within here
  • BaseTest.java: Initialise pages within here. Also add helper functions for repeated flows
  • HelperFunctions.java: Helper functions that are likely to repeat across projects
  • Tests Directory: Tests written within here
  • testng-platform.xml: Configure the environments for running the tests
  • deviceHelpers Directory: Contains platform specific helpers that can work on multiple projects

💡 Tips

  • ✅ You do not need to keep Xcode open to test on iOS
  • ✅ Real devices must be connected and authorized via adb devices (Android) or xcrun xctrace list devices (iOS)
  • ❌ APK and IPA files are not committed to version control
  • 🧠 The framework automatically logs which locator fails or succeeds

📞 Troubleshooting

  • App path incorrect? Double check the full path exists locally
  • Device not connected? Run:
    • adb devices for Android
    • xcrun xctrace list devices for iOS
  • Tests not running on iOS?
    • Verify that the device is provisioned in App Developer Portal and then run a new build
  • App fails to start? Confirm Appium logs for errors and package/activity names

Happy Testing! 🧪💥

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0