Recall & Review
beginner
What is the main goal of unit testing in microservices?
To verify that each individual service component works correctly in isolation, ensuring its logic is correct before integration.
Click to reveal answer
beginner
Why should unit tests avoid calling external services or databases?
Because unit tests should be fast, reliable, and isolated. Calling external services makes tests slower and less predictable.
Click to reveal answer
intermediate
What technique is commonly used to isolate dependencies in unit testing microservices?
Mocking or stubbing dependencies to simulate their behavior without invoking real implementations.
Click to reveal answer
intermediate
How does unit testing contribute to the scalability of microservices?
By catching bugs early in small components, unit testing reduces errors in production and supports easier scaling of individual services.
Click to reveal answer
beginner
What is a good practice for naming unit tests in microservices?
Use descriptive names that clearly state the condition and expected outcome, like 'shouldReturnErrorWhenInputIsInvalid'.
Click to reveal answer
What is the primary focus of unit testing in microservices?
✗ Incorrect
Unit testing focuses on verifying small parts of the system independently, not the whole system or network.
Which of the following is NOT a reason to mock dependencies in unit tests?
✗ Incorrect
Unit tests should not test real database performance; that is for integration or performance tests.
What is a sign of a well-written unit test?
✗ Incorrect
Good unit tests are fast, reliable, and clearly describe what they test.
Which tool or technique is commonly used to simulate dependencies in unit tests?
✗ Incorrect
Mocking replaces real dependencies with fake ones to isolate the unit under test.
Why is unit testing important before integration testing in microservices?
✗ Incorrect
Unit testing verifies components individually, making integration smoother and less error-prone.
Explain how mocking helps in unit testing microservices and why it is important.
Think about how you can test a part without involving others.
You got /3 concepts.
Describe best practices for writing effective unit tests for microservices.
Imagine explaining to a friend how to write a good test.
You got /4 concepts.