Intro to Unit Tests and CI/CD


Unit Tests

Essential for verifying that individual parts of your application work as expected. By testing small, isolated pieces of code, you can catch bugs early in the development cycle, making it easier to fix issues before they become larger, more complex problems.

Key Concepts in Unit Testing:

large_testing_pyramid_detailed_explanation_01793071ba.png

CI/CD

Continuous Integration (CI) and Continuous Deployment (CD) are practices that automate the process of integrating code changes, running tests, and deploying applications. CI/CD ensures that code changes are reliable and can be deployed to production quickly and safely.

<aside> 💡 Why do we need this? Assume you are working on a small project alone. You can fix bugs and add features on your own without any major issues (nevertheless, it’s still good practice to apply unit test and CI/CD to your project). But now, imagine you are working on a big project with multiple people involved (contributors on GitHub). Many people are posing issues, fixing bugs, and adding features. This can result in an overwhelming number of pull requests and a complex test/deployment process. Managing this manually can become chaotic and error-prone. This is where CI/CD tools like GitHub Actions comes into play to manage and automate these processes.

</aside>

What is GitHub Actions?


A CI/CD platform that help automate tasks. It allows you to set up workflows that automatically build, test, and deploy your code when defined events are triggered in your repo. Additionally, it is compatible for Ubuntu Linux, Windows and macOS.

Benefits of using GitHub Actions for CI/CD