You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Current »

Overview:

The solution uses the AQ Test Framework - Mobile and allows us to write the test cases for SimplyE/Vanilla for Android and iOS. Each test is based on a user story written in the formally specified ubiquitous language based on English. To write the test as a tool of BDD we use Cucumber. As a test runner we use TestNG.


Repository:

https://github.com/NYPL-Simplified/integration-tests-android


Structure:

  • runners - Test runner of cucumber tests that allows run the tests using a class where built-in inner behaviors and dependencies.
  • features - Cucumber features written on Gherkin language.
  • steps - classes to store methods which are linked to exact sentences from Features. The methods performs the needed actions.
  • constants - constants that applied to the project classes. The main place of class data like labels names, timeouts, markup attributes, etc.
    • application - constants describing parts of the application
    • context - constants of the cucumber main context
  • factories - classes that implement any type of factory pattern
  • framework - support functionality to the AQ Framework
    • configuration - providers of the test data
    • utilities - utility files that extend the built-in functionality of the framework
      • keyboard - utility working with physical OS keyboard
      • swipe - utility for any type of the swipe actions 
  • hooks - hooks that executing before/after every test/feature
  • models - page objects models.
  • screens - all classes with the description of every screen in the application. Every screen description separated on ios/android package it is necessary for a specific platform screen description. Every screen realization must extend the abstract class where placed methods for this screen. On this abstract class pageFactory build class for the platform from the config
  • transformers - transformers allow to transform any specific word or table from Features to the java objects.


Test case creation example:

Let's imagine we want to create a following test case(Android):

  1. Open the SimplyE.
  2. Add LYRASIS account.
  3. Switch to LYRASIS account.
  4. Check that the selected account in the Header of the Main page is "LYRASIS".

Main Steps:

  1. Create a feature file.

  2. Create an empty class for a step definitions

  3. The test case covers 3 application screens. The Main Screen, Switch Account Screen, Add Account Screen. Let's create a classes for them. As we want to cover both OS we have to create abstract classes first.

    There will be 3 abstract classes:

    • MainScreen.java
    • SwitchAccountScreen.java
    • AddAccountScreen.java
  4. Each class should contain the needed methods and should extend the base Screen class from AQ Test Framework - Mobile. The classes should looks as the following.



  5. As the test case is for Android we have to create an implementation of the abstract classes for the Android which should contain the exact UI actions.

    There will be 3 classes with the exact implementations:

    • AndroidMainScreen.java
    • AndroidSwitchAccountScreen.java
    • AndroidAddAccountScreen.java
  6. Here is and example of AndroidSwitchAccountScreen.java. All the other classes would be pretty similar the main difference is UI element and actions under them.


  7. As you see we reuse all the needed UI element and actions from the AQ Test Framework - Mobile
  8. The only thing we need is to add the logic to the methods in the empty class for a step definitions. It should look like the following:



How to execute test cases:

Manual local run on emulator for Android:

  1. Checkout the source code (master) https://github.com/NYPL-Simplified/integration-tests-android
  2. Open the solution in IntelliJ IDEA and build
  3. Create a virtual device (e.g using AVD in android studio), run it and get its name (adb.exe devices)
  4. Go to Recourses→ Open settings.json → Set isRemote to False → Set platformName as android → Set the path to the SimplyE.apk to "app" in driverSettings section for android (e.g "./src/test/resources/simplye-5.0.10-50010-debug.apk") → Open devices.json and change the deviceName
  5. Open any *.feature file → Right click on any Scenario → Click "Run <scenario_name>"

Manual remote run on BrowserStack for iOS from IDE:

  1. Checkout the source code (master) https://github.com/NYPL-Simplified/integration-tests-android
  2. Open the solution in IntelliJ IDEA and build
  3. Go to Recourses→ Open settings.json → Set isRemote to True → Set platformName as ios → Set the remoteConnectionUrl to http://<username>:<AccessKey>@hub.browserstack.com/wd/hub → Set the BS path to the SimplyE.apk to "app" in driverSettings section for ios (e.g "bs://00a1cd05ebe4deaf3a84bccb6de216e6a100b645")
  4. Open any *.feature file → Right click on any Scenario → Click "Run <scenario_name>"
  5. Go to BS → App Automate → have a look how the test is executing

Manual run using GitHub Actions:

  1. Go to https://github.com/NYPL-Simplified/integration-tests-android/actions
  2. Select Test Run workflow
  3. Expand run workflow → Fill in the fields → Click Run Workflow

 

  • Use workflow from - git branch to launch (usually master)
  • Tags to run - tags (e.g. @tier1 @tier2 @tier3) if you wanna run specific tier
  • app_url - the app URL that can be gotten by this link when you will upload the app
  • build name - e.g simplye-5.0.10-50010-debug
  • Platform name - ios/android

Automatic run using GitHub Actions:

Workflow will be automatically started if there is a new commit into the following repositories:

https://github.com/NYPL-Simplified/iOS-binaries (master branch)

https://github.com/NYPL-Simplified/android-binaries (develop and SimplyE branches)

  • No labels