Unit Test Automation of a React-Redux Application with Jest and Enzyme
Moroz, Bogdan (2019)
Moroz, Bogdan
2019
All rights reserved. This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:amk-2019060615157
https://urn.fi/URN:NBN:fi:amk-2019060615157
Tiivistelmä
The goal of this bachelor’s thesis was to evaluate the benefits of test automation and determine an efficient unit testing strategy for React applications developed at the commissioner company Observis. The thesis aimed at providing examples of units tested according to the strategy and integrating the automated execution of the tests into the deployment pipeline for the case study application – a dashboard application for workforce management called MOWO. MOWO dashboard is written in TypeScript using React and Redux.
The proposed strategy was formulated based on the findings of the literature review on test automation, an overview of the technology stack of the application as well as a summary of four testing strategies used by development teams in other software development companies. The proposed testing strategy aims to improve the quality of React-Redux applications developed by Observis, help developers understand the software under test and reduce the risks of making changes to the existing code. The strategy identifies the four types of units that need to be tested: utility functions, action creators, Redux reducers and React components. The strategy provides instructions on how to structure the tests to make them expressive, readable and maintainable.
In the practical part of the study, detailed examples of tests for each of the four types of units are provided. The automatic execution of tests is achieved by configuring a Git hook for the project as well as creating a project on the Jenkins automation server that executes the tests every time a new merge request is created on GitLab and leaves a comment on GitLab notifying whether the tests passed or failed.
The proposed strategy was formulated based on the findings of the literature review on test automation, an overview of the technology stack of the application as well as a summary of four testing strategies used by development teams in other software development companies. The proposed testing strategy aims to improve the quality of React-Redux applications developed by Observis, help developers understand the software under test and reduce the risks of making changes to the existing code. The strategy identifies the four types of units that need to be tested: utility functions, action creators, Redux reducers and React components. The strategy provides instructions on how to structure the tests to make them expressive, readable and maintainable.
In the practical part of the study, detailed examples of tests for each of the four types of units are provided. The automatic execution of tests is achieved by configuring a Git hook for the project as well as creating a project on the Jenkins automation server that executes the tests every time a new merge request is created on GitLab and leaves a comment on GitLab notifying whether the tests passed or failed.