E2E Automated Tests for the OpenMRS 3.0 RefApp

Google Summer of Code 2020 Project — Final Report

Jayasanka Weerasinghe
4 min readAug 20, 2021

Project Title: E2E Automated Tests for the OpenMRS 3.0 RefApp
Primary mentor: Kaweesi Joseph
Backup mentor: Brandon Istenes
Student: Jayasanka Weerasinghe
Project Link: GSoC 2021: E2E Automated Tests for the OpenMRS 3.0 RefApp

Overview

As a result of the Microfrontend Team’s tireless efforts, OpenMRS will soon have its new edition “OpenMRS 3.0”. Most of the MFE applications have unit tests and integration tests. Those tests will take a small part of the application and assess that part in isolation. However, even the small parts of the application work fine, It does not guarantee that they will work together as a group. This is where the E2E tests (End-to-End Tests) additional test layer comes into play. The goal of the project is to set up E2E tests that automate realistic User Workflows to ensure that they work as they should.

Objectives

  1. Evidence that the squad/dev team regularly references the automated tests during PRs (i.e. they use them to catch if their PR will break something, and so they fix their code quickly rather than waiting for manual tests to catch something weeks or even months later)
  2. Evidence that the squad/dev team regularly references the tests during releases every 1–4 weeks (e.g. “ok the tests are all green, we can release without doing painful manual QA) (though for 2. to be possible we need an actual production environment setup; discussion about that happening here: https://talk.openmrs.org/t/creating-a-build-pipeline-for-openmrs-3-0/33719
  3. Business-type stakeholders (e.g. Grace, JJ, Dimitri, Eric) feel confident in releasing / they trust the tests
  4. The qaframework README should have,
  • Badges showing test statuses
  • Clear instructions for local dev setup
  • Explanation of the testing architecture

Demo:

Contributions

Repository:

Pull requests:

Issues:

Weekly Blog Posts

Resources

Summary

Here’s a summary of what I have done during the project:

  • Initiating a cypress project with cucumber
  • Write E2E tests for the following workflows,
    - Login
    - Search and Registration
    - User settings
    - Clinical visit
    - Create GitHub workflows for the tests
  • Update the dashboard with workflow badges
  • Identify and report bugs of the RefApp 3.x frontend
  • Create the developer documentation
  • Conducted research on creating a dockerized environment to run the tests in GitHub Actions.

Future Work

  1. Create a GitHub workflow to run RefApp 3.x E2E rests in a dockerized environment
    We need to make the tests repeatable despite data mutations. Ideally, the tests would run against a dockerized server and dockerized database where the data is in the image/container itself, such that any changes are lost each time a new container is spun up. Read More.
  2. Implement the rest of the workflows listed here.
  3. Enhance the developer experience in creating new workflows.
    The current setup takes a lot of time to run tests because cypress clears the cache and it needs to download the resources (~30MB) every time it runs a test. The loading time can be decreased by either finding a way to cache the files or running the test instance locally.

Final Words

This is my second time being chosen for Google Summer of Code. While working on my project, I was able to unofficially mentor two other GSoC projects at OpenMRS. Working at OpenMRS was always been a pleasure for me. Not only have my programming skills improved but so have my soft skills, such as communication and presentation.

I’d like to thank my primary mentor, Kawesi Joseph, who passed away from us during the project. He was always a pleasant person and an excellent mentor to me. I am also grateful to Brandon Istenes, my secondary mentor, who assisted me greatly in completing this project successfully. I am also grateful to Grace Potma, Ian Bacher, Daud Kakumirizi, and Sharif Magembe for their assistance throughout the project. I’d also like to thank Herbert Yiga for always encouraging us to post our updates on time. A special thanks to Akshika Wijesundara for introducing me to OpenMRS. Finally, I’d like to express my gratitude to Google and OpenMRS for providing me with this fantastic opportunity!

--

--

Jayasanka Weerasinghe

A professional key presser who turns characters into interesting web things 🙂