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

Compare with Current View Page History

« Previous Version 3 Next »

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:

  • No labels