0
0
Testing Fundamentalstesting~6 mins

Continuous testing in CI/CD in Testing Fundamentals - Full Explanation

Choose your learning style9 modes available
Introduction
Imagine building a large puzzle where each piece must fit perfectly before adding the next. Continuous testing in CI/CD helps catch problems early by checking software automatically as it is built, so errors don't pile up and cause bigger issues later.
Explanation
Continuous Integration (CI)
Continuous Integration means developers frequently add their code changes to a shared project. Each addition triggers automated tests to check if the new code works well with the existing code. This helps find problems quickly before they grow.
CI ensures code changes are tested often to catch errors early.
Continuous Delivery/Deployment (CD)
Continuous Delivery means the software is always ready to be released after passing tests. Continuous Deployment goes further by automatically releasing the software to users once tests pass. Both rely on testing to keep software reliable and up-to-date.
CD uses testing to keep software ready or automatically release it safely.
Automated Testing
Automated tests run by computers check the software without needing people to do it manually. These tests can include checking if features work, if the software is fast, or if it handles errors well. Automation makes testing faster and more consistent.
Automated testing speeds up and standardizes checking software quality.
Feedback Loop
When tests find problems, the system quickly tells developers so they can fix issues right away. This fast feedback helps keep the project healthy and avoids delays caused by late bug discovery.
Fast feedback from tests helps developers fix problems quickly.
Real World Analogy

Think of a bakery where each cake layer is checked for quality before adding the next. If a layer is uneven, the baker fixes it immediately instead of waiting until the whole cake is done. This way, the final cake is perfect and ready to serve without surprises.

Continuous Integration (CI) → Adding each cake layer carefully and checking it before continuing
Continuous Delivery/Deployment (CD) → Having the cake ready to serve anytime or automatically sending it to customers
Automated Testing → Using tools like a level or thermometer to check cake layers quickly and reliably
Feedback Loop → The baker immediately knowing if a layer is bad and fixing it right away
Diagram
Diagram
┌───────────────┐      ┌───────────────┐      ┌───────────────┐
│ Code Changes  │─────▶│ Automated     │─────▶│ Feedback to   │
│ by Developer │      │ Tests Run     │      │ Developer     │
└───────────────┘      └───────────────┘      └───────────────┘
                                   │
                                   ▼
                         ┌───────────────────┐
                         │ Continuous Delivery│
                         │ or Deployment     │
                         └───────────────────┘
This diagram shows how code changes trigger automated tests, which provide feedback and lead to delivery or deployment.
Key Facts
Continuous IntegrationA practice where developers frequently merge code changes into a shared repository.
Continuous DeliveryKeeping software in a deployable state after passing automated tests.
Continuous DeploymentAutomatically releasing software to users after successful tests.
Automated TestingUsing software tools to run tests without manual effort.
Feedback LoopThe process of quickly informing developers about test results.
Code Example
Testing Fundamentals
import unittest

def add(a, b):
    return a + b

class TestAddFunction(unittest.TestCase):
    def test_add_positive(self):
        self.assertEqual(add(2, 3), 5)
    def test_add_negative(self):
        self.assertEqual(add(-1, -1), -2)

if __name__ == '__main__':
    unittest.main()
OutputSuccess
Common Confusions
Believing continuous testing means only running tests once at the end of development.
Believing continuous testing means only running tests once at the end of development. Continuous testing means running automated tests frequently throughout development, not just once at the end.
Thinking continuous delivery and continuous deployment are the same.
Thinking continuous delivery and continuous deployment are the same. Continuous delivery means software is ready to release; continuous deployment means software is released automatically after tests pass.
Summary
Continuous testing in CI/CD helps catch software problems early by running automated tests frequently.
It supports continuous integration by testing code changes and continuous delivery/deployment by ensuring software is always ready or automatically released.
Fast feedback from automated tests keeps developers informed and helps maintain software quality.