CI/CD Integration testing, Gulp Automation, and Jest/Puppeteer testing
Hello everyone, here in this blog I will be describing about some of the important functionalities and unit testing maintained in the AOSSIE Scholar project which I have done during my GSoC Journey.
In this project, workflow automation has been done using Gulp. Gulp is a build system that can improve how you develop websites by automating common tasks, such as compiling preprocessed CSS, minifying JavaScript, and reloading the browser. It has a server that takes into account the file changes in development and automatically compiles and compresses them into a production folder. Gulp uses node-glob to get the files from the glob or globs you specify. Gulp has the ability to watch files for changes and then run a task or tasks when changes are detected. Thus using this, the directory structure of the extension has been refactored into different folders. Also, the instructions to use the automated server during development have been added. Then Gulp is used to reload or update the browser when you do a Gulp task — changes a file. There are two ways to do this. The first is to use the LiveReload plugin, and the second is to use BrowserSync which has been used in the project.
In this project, unit testing has been done using JEST and PUPPETEER. JEST is one of the newest and most popular JavaScript testing libraries and Puppeteer is used for End-to-End(e2e) testing. This has used the Dockerfile present in the project, which install Google Chrome and xvfb in the test environment. Jest supports code coverage out of the box — this is a very useful metric for all CI-based delivery pipelines and the overall test effectiveness of a project. Then the pipeline has been added to automatically run the tests on pushing code to the repository. The pipeline has three stages- format, build, and test in gitlab-ci.yml file. The metrics calculation uses Jest Testing to check the numerical index accuracy. Jest and Puppeteer tests support all types of mocking — be it functional mocking, timer mocking, or mocking individual API calls.
Lastly, I will talk about CI/CD Integration testing which has been done in the project. CI/CD is a method to frequently deliver apps to customers by introducing automation into the stages of app development. The main concepts attributed to CI/CD are continuous integration, continuous delivery, and continuous deployment. CI/CD is a solution to the problems integrating new code can cause for development and operations teams. Continuous Integration has been added to the project, which helps in keeping the code secure and maintaining the code quality. It does code linting and formatting using Prettier and Eslint. The pipeline thus passes or fails according to tests run in the backend and checks the code formatting.
Thank you for reading the blog!