BolEnglishLearn · Play · Win
Login

🧪 Software Design & Architecture · Architecture Evaluation Factors

🧪

Testability

Quality AttributeCoreModule 1

How easily behavior can be verified independently.

Good design lets developers test a small piece without running the entire application.

💡 In practice

A tax calculation service can be unit tested with different amounts without opening the UI.

🖼️ CONCEPT PICTURE
A picture to help remember Testability
A tax calculation service can be unit tested with different amounts without opening the UI.

💡 Like tasting one ingredient before cooking the whole dish — check a small part without running everything.

💡 Learn🛠️ Apply🎯 Check

💡 Why it matters

If you can test small pieces quickly and independently, you catch bugs early, change code with confidence, and ship faster. Hard-to-test code usually signals a tangled design.

🛠️ How to achieve it

1
Separate logic from I/O
Keep business rules away from UI, database and network so they can be tested alone.
2
Inject dependencies
Pass in collaborators so tests can swap them for fakes.
3
Keep units small and clear
Small functions with clear inputs and outputs are easy to assert on.

⚠️ Signs of trouble

  • •You must run the whole app (or click the UI) to check one rule.
  • •Tests need a real database or network to pass.
  • •Hidden global state makes results unpredictable.
⚠️ Common mistake: Treating testability as 'write tests later' instead of a design property — untestable code can't be rescued by tests bolted on afterwards.

🎯 Quick check

Score: 0/2

Three questions to test the idea.

  1. 1. Testable design mainly lets you…

    Answer: Verify a small piece without running the whole app

    Good testability means small parts can be checked independently and quickly.

  2. 2. A tax calculation is tangled inside the UI. To make it testable you should…

    Answer: Move it into a separate service you can unit test

    Separating logic from the UI lets you test it alone with many inputs.

🔑 Key terms

Unit test
Tests one small piece in isolation.
Dependency injection
Passing collaborators in, so they can be faked.
Mock / stub
A stand-in for a real dependency during tests.
Coverage
How much of the code the tests exercise.

✅ Review checklist

📊 Your progress

0%
Mark this topic learned to track it.
Saved in this browser.
🚀 Got it?
Mark it learned and move to the next topic.
Next topic →