Unit, integration and regression testing
≈ 45 minUnit, integration and regression testing
Unit testing isolates a small method or class so a failure points to one local behaviour. Integration testing checks that components exchange data correctly, such as a form, service and database working together. Regression testing keeps earlier checks after a change, because a fix in one area can reintroduce a defect elsewhere.
A test suite should be readable evidence. Name the behaviour, arrange the input, act by calling the code, and assert the observable result. Stubs or fake dependencies can make a unit test independent of a real network or database. Integration tests are still needed later because real component boundaries can fail even when each unit passes alone.
Worked reasoning. A calculateFine method can be unit-tested with known overdue days. A borrowing workflow needs an integration test to check that returning a book updates both the Loan and Book state. When a bug made zero-day loans incur a fine, retain that exact case as a regression test after the fix.
Exam lens. Distinguish the scope of a test and the evidence it gives. Passing unit tests does not prove that an entire workflow works.
Which statement is the most defensible principle for Unit, integration and regression testing?
Enter the key term for Unit, integration and regression testing. What test is retained so a repaired feature does not break again later?
A method passed tests, but a real checkout screen sends a date in the wrong format. Which kind of test most directly exposes the fault?
Name the concise safeguard or principle that completes this lesson’s scenario: A method passed tests, but a real checkout screen sends a date in the wrong format. Which kind of test most directly exposes the fault?

