This Mobile Automation Framework, A project ready Test Automation Framework, provides a robust solution for automating tests on both Android and iOS devices. With seamless integration for great reporting and logging features, it ensures efficient tracking and debugging of test executions. The framework supports local execution as well as remote testing via platforms like Sauce Labs, offering flexibility and scalability to your automation workflow.
For Instance, this framework contains the Home Page, Menu Drawer, Flight Page, Flight Search, Filter Validations for Search, etc. for MakeMyTrip Android App...
- appium v9.1.0
- selenium v1.18.1
- java v11
- cucumber v7.15.0
- junit 5
- test-automation-toolkit v1.0.1
- maven v3.9.5
- surefire v3.1.2
- gherkin v26.0.1
- lombok v1.18.20
- log4j v2.20.0
- extent v1.14.0
- masterthought-reporting v5.8.0
- apache-poi v5.2.5
- common-io v2.7
- guava.version v33.0.0-jre
- Cross-Platform Support: Seamlessly automate tests on both Android and iOS devices.
- Rich Reporting: Generate comprehensive reports to gain insights into test results and performance metrics.
- Detailed Logging: Capture detailed logs for each test run, aiding in debugging and troubleshooting.
- Local and Remote Execution: Execute tests locally for quick iterations or leverage remote execution capabilities with platforms like Sauce Labs for broader device coverage.
- Scalable Architecture: Built with scalability in mind to accommodate growing test suites and evolving project requirements.
- Modular Design: Modular components ensure easy maintenance and extensibility of the framework.
- Integration-Friendly: Easily integrate with Continuous Integration (CI) pipelines for seamless automation workflows.
- Java 11
- Maven
- Any IDE (IntelliJ)
- Node.js (Needed to Manage Appium)
- Install Appium
npm i --location=global appium
appium --version
- Install Driver
- Android Driver:
appium driver install uiautomator2
- iOS Driver:
appium driver install xcuitest
- Android Driver:
git clone https://github.com/the-sdet/cucumber-junit5-mobile-automation-framework.git
All the configs can be found in test/resources. Those can be modified as per project requirement.
- config.properties
- android-config.properties
- ios-config.properties
- junit-platform.properties
- extent.properties
When we talk in Cucumber context, tags are one of the most vital components. We need to tag our features and scenarios well to group them and run them as we need.
Tags are mentioned with @ as prefix above the feature or scenario. A feature/scenario can have multiple tags as well. A tag on feature level is auto inherited to the scenarios in that feature. So, no need to repeat same tag on each scenario, it can be simply added to the feature.
@myFeature
Feature: Sample Feature
@Smoke @Regression
Scenario: Scenario One
Given I tag a scenario
When I select tests with that tag for execution
Then my tagged scenario is executed
@Sanity
Scenario: Scenario Two
Given I tag a scenario
When I select tests with that tag for execution
Then my tagged scenario is executed
There are multiple ways to execute the tests.
- Run feature/scenario directly from feature file.
- Run the TestRunner inside src/test/java/runner/TestRunner.java
- Run using Maven CLI
Executing tests using Maven CLI is the preferred option as it's configured in a such a way that, you can almost provide most of the configs from maven command itself at the runtime rather than actually modifying them in code.
All the below configs are optional. if NOT provided from CMD, already defined values will be picked.
- execution.type
- platform
- env
- sauce.url
- sauce.username
- sauce.password
- screenshot
- report.name
mvn clean install -Dexecution.type=local
mvn clean install -Dexecution.type=remote
mvn clean install -Dscreenshot=only.pass
mvn clean install -Dscreenshot=only.fail
mvn clean install -Dscreenshot=all
mvn clean install -Dplatform=android
mvn clean install -Dplatform=ios
mvn clean install -Dsauce.url=sauce-url -Dsauce.username=username -Dsauce.password=pasword
mvn clean install -Denv=stg
mvn clean install -Dreport.name="Automation Test Summary - The SDET"
All the features & it's scenarios can be executed by using below command.
mvn clean install
Cucumber tags are mapped to JUnit tags. Note that the @ symbol is not part of the JUnit tag.
When using Maven, tags can be provided from the CLI using the groups
and excludedGroups
parameters.
Cucumber Tag Expression uses cucumber.filter.tags
for filtering
mvn clean install -Dcucumber.filter.tags="@Regression"
JUnit Tag Expression groups
and excludedGroups
for filtering
mvn clean install -Dgroups="Regression"
*** While using JUnit5, JUnit5 tag expressions are preferred over Cucumber Tag Expression and Cucumber Tag Expression can be avoided for better results.
Tag expressions are boolean expressions with the operators !, & and |. In addition, ( and ) can be used to adjust for operator precedence.
Operator | Meaning | Associativity |
---|---|---|
! |
not | right |
& |
and | left |
| |
or | left |
If you are tagging your tests across multiple dimensions, tag expressions help you to select which tests to execute. When tagging by test type (e.g., micro, integration, end-to-end) and feature (e.g., product, catalog, shipping), the following tag expressions can be useful.
Tag Expression | Selection |
---|---|
product |
all tests for product |
catalog | shipping |
all tests for catalog plus all tests for shipping |
catalog & shipping |
all tests for the intersection between catalog and shipping |
product & !end-to-end |
all tests for product, but not the end-to-end tests |
(micro | integration) & (product | shipping) |
all micro or integration tests for product or shipping |
Run only Regression Tests
mvn clean install -Dgroups="Regression"
Run Regression Tests but exclude Profile Tests
mvn clean install -Dgroups="Regression" -DexcludedGroups="Profile"
or
mvn clean install -Dgroups="Regression & !Profile"
Run Home Page Tests but only Section One of Home Page not Section Two and Three
mvn clean install -Dgroups="HomePage & SectionOne"
By default, @ignore tag has been set to skip those tests. This can be changed by removing the below line from TestRunner.
@ExcludeTags("ignore")
It's equivalent to
mvn clean install -DexcludedGroups="ignore"
Various Reports are generated in testReports directory after the execution
- Cucumber HTML Report -> testReports/CucumberReport.html
- Extent HTML Report -> testReports/ExtentReport.html
- Extent PDF Report -> testReports/ExtentReport.pdf
- Master thought Cucumber Report -> testReports/cucumber-html-reports/overview-features.html
- Timeline Report -> testReports/timelineReport/index.html
Logs are written to console and as well as to log file. Log file can be found at z_logs
directory
I'm a dedicated and passionate Software Development Engineer in Test (SDET) trying to help the community.
Connect with me over LinkedIn or visit my Website...
If you have any feedback, please reach out to us at contact.the.sdet@gmail.com.