Skip to content
Mutesasira Moses edited this page Jan 20, 2022 · 26 revisions

OpenELIS-Global-2 Automated Testing Framework

Overview

openelis-qaframework is the OpenELIS-Global2 behaviour driven development (BDD) quality assurance framework.

BDD brings technical(developers, QA) together with business(non-technical, Business analysts) people to foster collaboration and ease problem-solving.

The Framework uses cucumber for its BDD test case descriptions and Selenium for Functional Testing

  1. E2E Test Process

proces

  1. Setup

    • Intall Java

    • Install Maven

    • Install git

    • Clone the openelis-qaframework and install the dependencies

          git clone https://github.com/I-TECH-UW/openelis-qaframework.git
          mvn clean install -DskipTests=true
      
    • In order to test within a real desktop browser, you will need a webdriver to connect to your browser (either firefox or chrome).

      To run with a remote Webdriver in a docker container ,set webdriver.type=remote, the default, in the peroperties file
      run docker-compose up to start the selenium remote webdriver in docker before running the tests. Access the remote web browser at http:https://localhost:7900 , click 'connect' and enter password 'secret' to view the tests executing

      To run with a local Webdriver on the local machine ,set webdriver.type=local,in the peroperties file

      Download the webdriver version that matches your system and browser version.

      Chrome
      Firefox
      Others

      Note: The framework comes with the version of ChromeDriver that only supports Chrome version 96 which is supported by the CI server . Incase your local machine runs with Chrome version 92 , you dont need to download another driver ,skip the next step below

    • Move your downloaded browser webdriver into the right locations as follows

           Chrome:  
                   Linux   : src/test/resources/chromedriver/linux/chromedriver 
                   Mac     : src/test/resources/chromedriver/mac/chromedriver 
                   Windows : src/test/resources/chromedriver/windows/chromedriver.exe
           Firefox: 
                   Linux   : src/test/resources/firefoxdriver/linux/geckodriver  
                   Mac     : src/test/resources/firefoxdriver/mac/geckodriver 
                   Windows : src/test/resources/firefoxdriver/windows/geckodriver.exe
      
    • Edit src/test/resources/test.properties

          Set  webdriver=chrome or  webdriver=firefox
          Set headless=false to allow the web browser UI to appear during the test
      
    • Properties explanation:

       webapp.url=https://testing.openelisci.org:8443/OpenELIS-Global [OpenELIS instance URL]
       login.username=itect [Above OpenELIS instance username]
       login.password=adminADMIN! [Above OpenELIS instance password]
       webdriver.type=remote [Type of WenDRiver to execute the tests ; remote/local ] 
       webdriver=chrome [Browser instance; chrome/firefox]
       headless=true [Launch browser in the background without UI; true/false]
      
    • Running the Tests
      The tests are organised in different Features and can be ran all at once or run individual Feature
      To run all tests

                mvn test
      

      To run a specific test Feature, you need to filter it by the feature Filter tag ie

                mvn test -Dcucumber.filter.tags='<@tag>'
      

      see all the test Features with their corresponding filter tags

  2. OpenELIS Automated Testing Infrastructure

qa-labed

  • Collaboratively, business analysts translate requirements into test cases and define from them features, scenarios, steps written in a Behavior Driven Development (BDD) approach through a human readable language, Gherkin.

  • The feature files are added to the Automation framework and an automation layer (with step descriptions) is written by a test engineer using Selenium automation framework .

  • Running the QA framework locally or in GitHub Actions CI ,runs the automated test suite;

    • This reads the test.properties and launch RunTest.java(junit with cucumber runner) with the loaded configurations which reads all feature files and locates each respective step description from mapped automation package,
    • The Automation steps launch the Selenium automation framework by scenario and each scenarios by step order, steps loads the pages and return results to the build through its web driver
    • The build posts test results to reports.cucumber.io
    • The build aslo posts results into Cucumber studio and a result green/red label (build status) is displayed on qaframework basing on CI build result.