How anhtester/automation_android_appium2 works
Project Type and Purpose
• The project is a mobile test automation framework focused on “End To End Test Order Scenario on Android App called ‘Sauce labs’”.
• It uses Appium 2.x.x with Java and TestNG to run tests, employing a Page Object Model (POM) design pattern along with data-driven and fluent design principles.
• Its purpose is to automate UI testing on the Sauce Labs mobile app running on an Android emulator.
Analyzing the File Structure
• Top-level Files: You have Maven configuration (pom.xml), README, and various setup text files for Appium.
• src/main: Contains the core utility classes and framework components:
• keywords (e.g., MobileUI.java) which likely encapsulate mobile commands.
• listeners (e.g., ExtentManager.java and ExtentTestNGListener.java) for reporting and event handling.
• utils (e.g., JsonReader.java) for handling configuration/test data.
• resources/config with configuration properties.
• src/test: Contains test cases and related components:
• common/BaseTest.java sets up the testing framework.
• screens/ directory holds Page Object Model classes representing different screens like HomeScreen, LoginScreen, etc.
• testcases (e.g., DemoAppTest.java) that drive the test flows.
• resources includes the app APK and test data JSON files for data-driven testing.
• testng.xml: Orchestrates the execution of tests.
a. Main Components:
• Test Runner & Execution: Represent the TestNG layer, which uses testng.xml to trigger the tests.
• Keywords/Action Layer: Include a component for MobileUI (located in src/main/java/com/anhtester/keywords) which encapsulates common mobile actions.
• Configuration & Data Management: Represent config properties (from src/main/resources/config) and JSON test data (from src/test/resources/testdata). Also include the JsonReader utility.
• Reporting & Listeners: Identify Extent Manager and TestNG listeners that integrate with Extent and Allure Report systems.
• External Components: Include the Appium Server component (which communicates with the mobile emulator) and the Android Emulator itself.
• Build & Dependency Management: Represent Maven (pom.xml) which handles dependencies like Appium, java-client, TestNG, etc.
b. Relationships and Data Flow:
• The Test Runner (TestNG) initiates test cases (DemoAppTest and others in testcases).
• Test cases call methods on Page Object classes (screens) that represent different app screens.
• Page Objects interact with MobileUI keywords to send commands to the Appium server.
• The Appium server communicates with the Android studio emulator (with the Sauce Labs mobile app installed).
• Configuration and test data are loaded via the JsonReader (from properties and JSON files) and used within test cases.
• Throughout execution, listeners (e.g., ExtentTestNGListener) capture test events which are then logged and passed to reporting components (Allure/Extent Reports).
c. Architectural Patterns & Design:
• Use of the Page Object Model (POM) pattern to encapsulate UI element interactions.
• Data-driven design (usage of JSON test data).
• That the Fluent design approach likely leads to fluid method chaining for interactions.
• This separation (tests, POM, keywords, configuration, and utilities) is a best practice that isolates different concerns.
d. Relevant Technologies & Frameworks:
• Appium 2.x.x (for mobile automation)
• Java with Maven (for project build and dependency management)
• TestNG (as the test execution framework)
• Allure and Extent Reports (for reporting)
• Android Studio Emulator (as the test environment)
• Additionally, the java-client library and any underlying dependencies are significant.