Selenium WebDriver and Appium based Web, Mobile (Android, iOS) and Windows desktop Automation Framework with BDD & Non-BDD implementation support

Overview

iqa-automation-framework

Evaluted from cucumber-selenium-framework

Selenium WebDriver and Appium based Web, Mobile (Android, iOS) and Windows desktop Automation Framework with BDD implementation support

Features

  1. With few Configurations and adding dependencies, you are ready to use this framework
  2. Framework supports to test web application, Mobile application (Native, Web, Hybrid), Windows Native applications
  3. BDD based Framework:
    1. Tag based scenarios
    2. Tag based execution
  4. Parallel and Sequential execution support
  5. Selenium Grid Support: It helps in running multiple tests across different browsers, operating systems, and machines in parallel
  6. Database support- Do database Configuration and use it (MySQL, Oracle, etc.)
  7. Test Data management facility at run time, global, static, Test script level
  8. Logger and Reports Facility:
    1. Test method level - Using Extent Report
    2. Framework level - Using Log4j

How To Start/Use

  1. Create simple maven project in Eclipse
  2. Get framework project from git and add following dependency and sure-fire plug in information in POM file Dependency:
<dependencies>
		<dependency>
			<groupId>io.github.innovativeqalabgroupId>
			<artifactId>test-automation-frameworkartifactId>
			<version>0.0.2version>
		dependency>
	dependencies>
  1. Create page object classes src/test/java folder
  2. Create feature file/s in src/test/resources/feature folder and corresponding step definitions in src/test/java folder
  3. Create testNG.xml file in src/test/resources folder
  4. Create required configuration files in src/test/resources folder
    1. WebDriverConfig.properties
    2. Environment.properties

Please refer sample project "orange-hrm" for more details

Properties file configurations

  1. WebDriverConfig.properties is the important file which decides whether to run the tests locally or on remote machines. It contains following important items

    • Driver mode : Remote or Local. Specify DRIVER=REMOTE for facilitating remote execution using remote driver. RemoteWebDriver capabilities must set in respective property files in src/test/resources/capabilities folder. DRIVER=BROWSER for execution on local machine.
    • Platform : WINDOWS or LINUX or IOS or ANDROID ...
    • Browser Name : Specify the browser you want to use
    • Browser Version : Specify the browser version. If not specified, it will consider the default one.
    • Driver Executables : Specify the complete path to driver exe. If Driver Mode is 'Remote', this property is not required.
    • Driver Property Name : Specify property name of the driver e.g for chrome driver, 'web driver.chrome.driver'. If Driver Mode is 'Remote', this property is not required.
    • Hub Url : This is required if the Driver Mode is Remote. Specify the selenium grid hub url or appium url as applicable
  2. Environment.properties file will have name of the environment. Corresponding to each environment e.g QA, there needs be properties file in the user-defined folder like 'QAEnvironmentConfig.properties'. This file will have environment URL and other environment specific properties.

  3. Capabilities : This folder will contain Browser, iOS, Android etc specific properties in the separate files as per our need. Please refer to sample project 'orange-hrm' for more details.

XML file configurations

TestNG xml file gives facility to execute test scripts as per our requirement. We need to provide the parameters which is mandatory for the execution of scripts and also as per our need

  1. Parallel execution threads control:
">
<suite name="Selenium-Cucumber-Test" parallel="methods" data-provider-thread-count="10" >    
  1. Provide Feature File/Folder Path:
">
<parameter name="featureFilePath" value="src/test/resources/feature/"/>
  1. Provide Glue code package name where page object classes are created:
">
<parameter name="glueCodePackageName" value="com.orangehrm.pages.web"/>
  1. Tag based execution - Provide the tag which need to include in execution:
">
<parameter name="tagsToExecute" value="@High"/> 
  1. Select runner class Name to run test scripts parallel or sequential :

    1. Parallel Execution
">
 <class name="org.iqa.test.runner.ParallelTestRunner"/>
  1. Sequential Execution
">
 <class name="org.iqa.test.runner.SequentialTestRunner"/>

How to write feature file

Use one feature file for each page which covers all and any number of scenarios you want to cover for that respective page

  1. As we are using tag based execution provides tag for scenarios e.g. @Sanity, @High etc.
  2. Follow Given , When, Then format :
    1. Given - Pre-requisite of the test case
    2. When - Actions to be performed in that test script
    3. Then - Result Validation

Example:

 @High
  Scenario: Verify admin login successful
    Given user navigate to orange hrm URL
    When uses enters user name as "Admin" and password as "admin123" and click on login button
    Then user should be able to see "Welcome Admin" message

Test Data

  1. Static Data- Define static test data (Refer PersonData class)
  2. Dynamic test data generation- use RandonNumber class to generate dynamic test data at run time
  3. Provide test data to test scenario in following format
    Examples: 
      | name  | password | welcome_text  |
      | Admin | admin123 | Welcome Admin |

How to write Page Object Classes

  1. Provide all web element at the start of each page class
    1. @FindBy - tag used for web/windows application web element
    2. @AndroidFindBy tag used for Android application web element
  2. Create a method for all GIVEN keyword of feature file with tag Given in respective page
  3. Create a method for all WHEN keyword of feature file with tag When in respective page
  4. Create a method for all THEN keyword of feature file with tag Then in respective page
  5. Use Assertions for validation purpose to compare actual and expected results
Comments
  • Getting 'NullPointerException' while executing API test cases where test result is as expected.

    Getting 'NullPointerException' while executing API test cases where test result is as expected.

    TestNG Trace:

    java.lang.NullPointerException: Cannot invoke "org.testng.asserts.SoftAssert.assertAll()" because the return value of "org.iqa.suite.commons.AssertionFactory.getSoftAssert()" is null at org.iqa.test.runner.ParallelTestRunner.runScenarios(ParallelTestRunner.java:22) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134) at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:597) at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173) at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:77) at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:15) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) at java.base/java.lang.Thread.run(Thread.java:831)

    opened by jagrutim22 2
  • Getting

    Getting "java.lang.NoSuchMethodError" while performing applitools eyes check validation for Mobile app

    INFO TestNGMethodInvocationListener - ******** In before invocation INFO CustomProperties - Property 'platform' fetched from System environment variable Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 33.364 sec <<< FAILURE! runScenarios(org.iqa.test.runner.ParallelTestRunner) Time elapsed: 32.402 sec <<< FAILURE! java.lang.NoSuchMethodError: com.applitools.eyes.selenium.ClassicRunner.(Ljava/lang/String;Ljava/lang/String;)V at com.applitools.eyes.appium.AppiumRunner.(AppiumRunner.java:21) at com.applitools.eyes.appium.Eyes.(Eyes.java:32) at org.iqa.suite.commons.applitool.ApplitoolEyesMobile.createEyes(ApplitoolEyesMobile.java:74) at org.iqa.test.base.BaseTest.openApplitoolEye(BaseTest.java:142) at org.iqa.test.runner.ParallelTestRunner.runScenarios(ParallelTestRunner.java:29)

    opened by bhangeprashant 1
  • Add GitHub Wiki Page link for exception if WebDriverConfig.properties not present

    Add GitHub Wiki Page link for exception if WebDriverConfig.properties not present

    Title - Add GitHub wiki page link for how to use property file in log Error while loading property WebDriverConfig.properties file. Refer - http://........

    Description: If WebDriverConfig.properties file not present in test suite we provide error message in log, but develop might not understand how to do it. Add GitHub Wiki page URL

    Please check content of property file and try again. 11:02:52.587 [main] ERROR org.iqa.suite.commons.listeners.SeleniumMethodInvocationListener - Error while loading property WebDriverConfig.properties file. Please check content of property file and try again. java.io.FileNotFoundException: src/test/resources/properties/framework/WebDriverConfig.properties (No such file or directory) at java.io.FileInputStream.open0(Native Method)

    opened by zodgevaibhav 1
  • V 1.0.3 - Fix for Saucelabs screenResolution Issue #55

    V 1.0.3 - Fix for Saucelabs screenResolution Issue #55

    Issue Fixes : -This release contains fix for Issue #55 -There was an ambiguity between "platform" property in FrameworkConfig.properties and BrowserCapabilities.properties As a solution to this issue,

    • Remove property "platform" from FrameworkConfig.properties
    • Load all capabilities into testSuiteConfigurationProperties
    • Update browser capabilities
    • Add getOsFamilyName method to derive OS family name from platform

    Code re-factoring:

    • Remove redundant scenarios() method from BaseTest class
    • Skip applicationToolEyeWebGetAllTestResults method
    opened by bhangeprashant 0
  • [Core Framework V1.0.0 ] Upgrade libraries and Enhancements

    [Core Framework V1.0.0 ] Upgrade libraries and Enhancements

    V 1.0.0 Major Enhancements :

    1. Added support for Cucumber 7.2.3. Now we can pass all cucumber runtime options via TestNG xml parameters.
    2. Added support for "extentreports-cucumber7-adapter". This enables framework to log "Feature steps" in extent spark/html report. In addition we will also be able to save the extent report with customised name at customised location
    3. Added global framework level "AUT" property (Automation Under Test) to manage executions with different applications [WEB, MOBILE, API]
    4. Enhanced framework reporting to improve debugging

    Upgrade libraries :

    • io.cucumber:cucumber-java 7.2.3
    • io.cucumber:cucumber-testng 7.2.3
    • com.applitools:eyes-selenium-java5 5.26.0
    • com.applitools:eyes-appium-java5 5.26.0

    Added libraries:

    • tech.grasshopper: extentreports-cucumber7-adapter 1.7.0
    opened by bhangeprashant 0
  • Fix v 0.2.4 for applitoolx-eyes-check for mobile issue #44

    Fix v 0.2.4 for applitoolx-eyes-check for mobile issue #44

    Fixes :

    • eyes-appium-java3 version updated in sync with eyes-selenium
    • pom.xml version bump up to 0.2.4

    Enhancements:

    • Added changes to fetch AUT property value from System environment variable
    opened by bhangeprashant 0
  • Fix provided for Issue #39 - v 0.2.1

    Fix provided for Issue #39 - v 0.2.1

    -Fix provided for Issue #39 -Refactoring of Framework code -Removed test folder files from Framework code ( which are available in sample project) -Bump up pom version to 0.2.1 and same is updated in sample project pom

    opened by bhangeprashant 0
  • Framework feature enhancements refactoring

    Framework feature enhancements refactoring

    Feature Enhancements, Code Refactoring

    -Added Selenium reusable methods in BasePageBrowser class -Added Random data generation utility methods in RandomGenerator class -Added required dependencies for database connectivity -Bump up framework version

    opened by bhangeprashant 0
  • Framework feature enhancements refactoring

    Framework feature enhancements refactoring

    Feature Enhancements, Code Refactoring and Issue fixes

    1. rest-assured support added for API Automation
    2. HikariCP Support added to handle multiple databases
    3. New Property "AUT" added to toggle between UI and API Automation
    4. Fix provided for Issue #34, Issue #35 , Issue #36
    5. Updated Logger info
    6. Required dependencies added
    7. Bump up framework version
    opened by bhangeprashant 0
  • screenResolution in BrowserCapabilities.properties is not getting set as expected for Saucelabs remote execution

    screenResolution in BrowserCapabilities.properties is not getting set as expected for Saucelabs remote execution

    Screen resolution is getting set as Saucelabs default screen resolution.

    INFO BasePageBrowser - ******** Browser Window ScreenResolution :(1032, 776)

    opened by bhangeprashant 0
Owner
null
Test Automation of Energy Australia - Web application

Test Automation of Energy Australia - Web application Technology used - Kotlin, Java, Espresso, Android Run the test on local environment git clone ht

null 0 Feb 9, 2022
Selenium locators for Java/Kotlin that resemble the Testing Library (testing-library.com).

Selenium Testing Library Testing Library selectors available as Selenium locators for Kotlin/Java. Why? When I use Selenium, I don't want to depend on

Luís Soares 5 Dec 15, 2022
Toster - Small test dsl based on adb commands that allows you to test the mobile application close to user actions

toster Small test dsl based on adb commands that allows you to test the mobile a

Alexander Kulikovskiy 31 Sep 1, 2022
Linkester is an Android library that aims to help Android developers test their deep links implementation.

Linkester Linkester is an Android library that aims to help Android developers test their deep links implementation. The idea is to have a new launche

Ahmad Melegy 79 Dec 9, 2022
Powerful, elegant and flexible test framework for Kotlin with additional assertions, property testing and data driven testing

Kotest is a flexible and comprehensive testing tool for Kotlin with multiplatform support. To learn more about Kotest, visit kotest.io or see our quic

Kotest 3.8k Jan 3, 2023
Android Unit Testing Framework

Robolectric is the industry-standard unit testing framework for Android. With Robolectric, your tests run in a simulated Android environment inside a

Robolectric 5.6k Jan 3, 2023
A powerful test framework for Android

Cafe A powerful test framework for Android named Case Automated Framework for Everyone. Home Page http://baiduqa.github.com/Cafe/ How to make Cafe dow

Baidu 367 Nov 22, 2022
A powerful test framework for Android

Cafe A powerful test framework for Android named Case Automated Framework for Everyone. Home Page http://baiduqa.github.com/Cafe/ How to make Cafe dow

Baidu 367 Nov 22, 2022
Raccoon is a lightweight response mocking framework that can be easily integrated into the Android UI tests.

Raccoon Medium Articles Checkout these article to get more insights about this library: How to integrate this in your Android Test Why Raccoon? There

Joseph James 52 Aug 15, 2022
A programmer-oriented testing framework for Java.

JUnit 4 JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks. For more infor

JUnit 8.4k Jan 9, 2023
PowerMock is a Java framework that allows you to unit test code normally regarded as untestable.

Writing unit tests can be hard and sometimes good design has to be sacrificed for the sole purpose of testability. Often testability corresponds to go

PowerMock 3.9k Jan 5, 2023
A programmer-oriented testing framework for Java.

JUnit 4 JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks. For more infor

JUnit 8.4k Dec 28, 2022
PowerMock is a Java framework that allows you to unit test code normally regarded as untestable.

Writing unit tests can be hard and sometimes good design has to be sacrificed for the sole purpose of testability. Often testability corresponds to go

PowerMock 3.9k Jan 2, 2023
Most popular Mocking framework for unit tests written in Java

Most popular mocking framework for Java Current version is 3.x Still on Mockito 1.x? See what's new in Mockito 2! Mockito 3 does not introduce any bre

mockito 13.6k Jan 4, 2023
Morsa: Jetpack Compose UI Testing Framework

Morsa: Jetpack Compose UI Testing Framework Test library to ease UI testing with Jetpack Compose Purpose This library aims to add some useful wrappers

HyperDevs 10 Dec 3, 2022
A micro mocking framework for KMP

Micro-Mock A micro Kotlin/Multiplatform Kotlin Symbol Processor that generates Mocks & Fakes. Limitations: Mocking only applies to interfaces Faking o

null 101 Jan 3, 2023
Snapshot Testing framework for Kotlin.

KotlinSnapshot Snapshot Testing framework for Kotlin. What is this? Snapshot testing is an assertion strategy based on the comparision of the instance

Pedro Gómez 157 Nov 13, 2022
A collection of tests and easy to reuse pieces of code for bdk-jvm and bdk-android

Readme This repo is a collection of tests and easy to reuse pieces of code for bdk-jvm and bdk-android. Note that they don't aim to provide a full cov

thunderbiscuit 1 Jun 28, 2022
Android library that allows you to run your acceptance tests written in Gherkin in your Android instrumentation tests.

Green Coffee Green Coffee is a library that allows you to run your acceptance tests written in Gherkin in your Android instrumentation tests using the

Mauricio Togneri 227 Nov 21, 2022