Nerd For Tech
Published in

Nerd For Tech

Running E2E tests in a Dockerized Environment

Hi everyone. In this article, I will be sharing a new experience that I got while contributing to OpenMRS.

End-to-End (E2E) Testing

End-to-end testing is a technique that tests an entire software from beginning to end to ensure the application flow behaves as expected. It defines the product’s system dependencies and ensures all integrated features work together as expected. The main purpose of End-to-end (E2E) testing is to test from the end user’s experience by simulating the real user scenario and validating the system. E2E testing can be done manually or by an automated method.

OpenMRS 3.x uses Cypress and Cucumber to automate their tests.

In OpenMRS 3. x E2E tests were tested against a production server. The 3.x QA team was struggling with various kinds of issues when fixing and improving E2E test workflows. The main reason was the production server takes a lot of time to load. Therefore sometimes the preview doesn't show up or the test cannot find some components. Because of those reasons, some of the test workflows fails.

Testing against the production server

As a solution for this problem, they thought of running the tests against an OpenMRS application hosted in a docker container. This has been implemented before but it failed due to some issues in the docker image. However recently the issues in the docker image have been solved and I got an opportunity to implement it.

To implement this feature first I got the 3.x image file and build it in a docker container in the local machine. Next, to test this I used the patient search test. When running the patient search test against the docker image the test should create a patient in the system at first because there are no patients recorded in the database initially. So once those changes are done, next I change the structure of the patient search Github action workflow in order to run against the docker image. This was done by Jayasanka Weerasinghe previously, so it helped me a lot.

Then I pushed the changes to my origin (forked repo) in Github and trigger the workflow manually to test. And a few minutes later Bingo!! the workflow passes.

Build result in Github actions

Github action build link.

This solved many issues that occurred in E2E tests of OpenMRS 3.x.

Here’s a screen recording of the patient search test running with docker.

Testing against the docker image

That brings us to the end of the article. Don't forget to read my other articles too. Interested in contributing to OpenMRS? Go to this link and see how you can start contributing.
Thank you for reading, Stay Safe…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store