| ... |
... |
@@ -4,12 +4,14 @@ |
| 4 |
4 |
|
| 5 |
5 |
### Benefits of Mocking |
| 6 |
6 |
|
| 7 |
|
-* **Isolation of units** to test each unit separately, dramatically reducing complexity and increasing test execution speed by replacing loaded modules with mocks. |
| 8 |
|
-* **Simplifies the re-creation of specific scenarios** (use cases, boundary cases) in which a dependency behaves in a particular way. |
| 9 |
|
-* **Expose hidden internals** of production code without compromising encapsulation. |
| 10 |
|
-* **Injection of test-specific behaviors** not present in production code. |
| 11 |
|
-* **Enables the simulation of indirect dependencies** by letting mocks return other mocks. |
|
7 |
+* Isolation of units to test each unit separately, dramatically reducing complexity and increasing test execution speed by replacing loaded modules with mocks. |
|
8 |
+* Simplifies the re-creation of specific scenarios (use cases, boundary cases). |
|
9 |
+* Expose hidden internals of production code without compromising encapsulation. |
|
10 |
+* Injection of test-specific behaviors not present in production code. |
|
11 |
+* Enables the simulation of indirect dependencies by letting mocks return other mocks. |
| 12 |
12 |
|
|
13 |
+### |
|
14 |
+ |
| 13 |
13 |
### Types of Mocks |
| 14 |
14 |
|
| 15 |
15 |
Stubs are by far the most common type of mock. Keep your tests as simple as possible. Make them more complex only when necessary. |
| ... |
... |
@@ -19,7 +19,7 @@ |
| 19 |
19 |
* **Spy**: Records internal data of the unit being tested when such data is not directly accessible. |
| 20 |
20 |
* **Mock object**: Contains complex logic, simulates behaviors such as computation and exception handling, and can even run tests. |
| 21 |
21 |
|
| 22 |
|
-### |
|
24 |
+### |
| 23 |
23 |
|
| 24 |
24 |
### Tips |
| 25 |
25 |
|