Giter Club home page Giter Club logo

krishanmishra / appium-cucumber-junit5-mobile-automation-framework Goto Github PK

View Code? Open in Web Editor NEW

This project forked from the-sdet/appium-cucumber-junit5-mobile-automation-framework

0.0 0.0 0.0 91.38 MB

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.

Home Page: https://github.com/the-sdet/cucumber-junit5-mobile-automation-framework

Java 95.32% Gherkin 4.68%

appium-cucumber-junit5-mobile-automation-framework's Introduction

Comprehensive Mobile Automation Framework

Appium   Selenium   Java   Cucumber   JUnit5   JUnit5

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...

Tech Stack & Libraries Used

  • 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

Features:

  1. Cross-Platform Support: Seamlessly automate tests on both Android and iOS devices.
  2. Rich Reporting: Generate comprehensive reports to gain insights into test results and performance metrics.
  3. Detailed Logging: Capture detailed logs for each test run, aiding in debugging and troubleshooting.
  4. Local and Remote Execution: Execute tests locally for quick iterations or leverage remote execution capabilities with platforms like Sauce Labs for broader device coverage.
  5. Scalable Architecture: Built with scalability in mind to accommodate growing test suites and evolving project requirements.
  6. Modular Design: Modular components ensure easy maintenance and extensibility of the framework.
  7. Integration-Friendly: Easily integrate with Continuous Integration (CI) pipelines for seamless automation workflows.

Setup:

Install the below items for an easy setup

Clone the repository:

git clone https://github.com/the-sdet/cucumber-junit5-mobile-automation-framework.git

Configuration:

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

Tagging The Features and Scenarios

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

Execution:

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.

Examples of some configs that can be altered from CMD for the specific run

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

Executing on local or remote (sauce labs)

mvn clean install -Dexecution.type=local
mvn clean install -Dexecution.type=remote

Screenshot Options

mvn clean install -Dscreenshot=only.pass
mvn clean install -Dscreenshot=only.fail
mvn clean install -Dscreenshot=all

Platform Options

mvn clean install -Dplatform=android
mvn clean install -Dplatform=ios

Sauce Options

mvn clean install -Dsauce.url=sauce-url -Dsauce.username=username -Dsauce.password=pasword

Environment

mvn clean install -Denv=stg

Report Name

mvn clean install -Dreport.name="Automation Test Summary - The SDET"

Executing all the tests

All the features & it's scenarios can be executed by using below command.

mvn clean install

Executing selected tests

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.

JUnit5 Tag Expressions

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

Executing selected tests (filter using tags/tag expression)

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"

Reporting

Various Reports are generated in testReports directory after the execution

  1. Cucumber HTML Report -> testReports/CucumberReport.html
  2. Extent HTML Report -> testReports/ExtentReport.html
  3. Extent PDF Report -> testReports/ExtentReport.pdf
  4. Master thought Cucumber Report -> testReports/cucumber-html-reports/overview-features.html
  5. Timeline Report -> testReports/timelineReport/index.html

Logs

Logs are written to console and as well as to log file. Log file can be found at z_logs directory

Authors

pabitra-qa @the-sdet

pabitra-qa @pabitra-qa

About Me

I'm a dedicated and passionate Software Development Engineer in Test (SDET) trying to help the community.

Connect With Me

Connect with me over LinkedIn or visit my Website...

pabitra-qa  

Feedback

If you have any feedback, please reach out to us at [email protected].

appium-cucumber-junit5-mobile-automation-framework's People

Contributors

pabitra-qa avatar the-sdet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.