nus-cs3281 / 2024

1 stars 2 forks source link

Book: SE@Google Ch: 18 - Test Doubles #1

Open NicolasCwy opened 6 months ago

NicolasCwy commented 6 months ago

Book: SE@Google Chapter: 18 - Test Doubles

Summary:

Main Takeaway If possible, classical testing is the ideal testing strategy. Testing doubles simplify and allow systems to be tested in isolation when classical testing is slow, unpredictable or complex. Though unit tests using test doubles can be easy to write, the inappropriate use of testing strategies will reduce developer productivity and not be efficient at catching bugs.

Overview

Testing Principles Testability: Ease of writing unit tests for code e.g ease of using test doubles (Should be considered when writing code - else refactors have to be made later)

Applicability: Inappropriate use of test doubles may reduce engineering productivity, using the real implementation is sometimes the best option

Fidelity: The closeness which the test double mimics the real implementation. No value if the test double has low fidelity. Larger scope tests need to supplement unit tests which use test doubles.

Testing Double Techniques

Patterns that enable the use of testing doubles

Good Testing Practices

Pros of using testing doubles

Cons of using testing doubles