You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
State: When updating an entity, the audit fields LastModifiedBy and LastModifiedOn are properly updated. When doing a calculation, assert that the result returned is as expected.
459
-
Behavior: Verify that a method was (not) called, or called with specific arguments. Example: verify that an email is (not) sent, or that Repository.Save() is called.
460
-
-->
461
433
462
434
---
463
435
layout: default-aside
@@ -468,7 +440,7 @@ h1:
468
440
position: start
469
441
---
470
442
471
-
# Mocking
443
+
# Test Doubles
472
444
473
445
<v-clicks>
474
446
@@ -521,18 +493,18 @@ layout: comparison
521
493
522
494
### Mockist / Solitary
523
495
524
-
-🧐 Mock everything
525
-
-✅ Test complicated BL in isolation
526
-
-⚠️ May be testing implementation instead of behavior
496
+
🧐 Mock everything
497
+
<br>✅ Test complicated BL in isolation
498
+
<br>⚠️ Danger of creating <b>tautological tests</b>, testing implementation instead of behavior
527
499
528
500
</div>
529
501
<divclass="col">
530
502
531
503
### Classicist / Sociable
532
504
533
-
-🧐 Mock I/O and/or "awkward" things
534
-
-✅ Tests survive refactorings more easily
535
-
-⚠️ Danger of testing the same thing multiple times
505
+
🧐 Mock I/O and/or "awkward" things
506
+
<br>✅ Tests survive refactorings more easily
507
+
<br>⚠️ Danger of testing the same thing multiple times
536
508
537
509
</div>
538
510
</div>
@@ -544,6 +516,32 @@ Also see: https://martinfowler.com/articles/mocksArentStubs.html
544
516
Solitary vs Sociable: https://martinfowler.com/bliki/UnitTest.html
State: When updating an entity, the audit fields LastModifiedBy and LastModifiedOn are properly updated. When doing a calculation, assert that the result returned is as expected.
623
+
Behavior: Verify that a method was (not) called, or called with specific arguments. Example: verify that an email is (not) sent, or that Repository.Save() is called.
624
+
-->
625
+
626
+
627
+
591
628
---
592
629
layout: section
593
630
---
@@ -669,21 +706,19 @@ There was also "Record-And-Replay" but no one seems to be using that anymore.
// ❌ Don't parameterize: different scenarios, different intent
781
+
// "user with expired token" vs "user with no token"
782
+
// → separate tests with descriptive names
783
+
```
784
+
785
+
<divclass="mt-4 text-center text-2xl grid">
786
+
<divv-click.hide="1"class="text-emerald-400 col-start-1 row-start-1">Boundaries & equivalence classes → <strong>parameterize</strong></div>
787
+
<divv-click="[1,2]"class="text-orange-400 col-start-1 row-start-1">Different scenarios or business rules → <strong>separate tests</strong></div>
788
+
</div>
789
+
790
+
<!--
791
+
Parameterized tests shine for boundary value analysis and equivalence partitioning — exactly the cases we discussed earlier.
792
+
But they obscure intent when scenarios are conceptually different. When a parameterized test fails, the failure message is often just "row 3 failed" — you lose the descriptive test name that tells you WHAT broke.
793
+
Rule of thumb: if you can describe all cases with "same function, different numbers" → parameterize. If each case has a different story → separate tests.
0 commit comments