From 3e2a2e8a6560150c9b9d7d2b8dadc50a330a12a7 Mon Sep 17 00:00:00 2001 From: Quarto GHA Workflow Runner Date: Fri, 3 Nov 2023 22:26:51 +0000 Subject: [PATCH] Built site for gh-pages --- .nojekyll | 2 +- index.html | 51 +++++++++++++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/.nojekyll b/.nojekyll index 54185f5..1875c41 100644 --- a/.nojekyll +++ b/.nojekyll @@ -1 +1 @@ -bf9852f6 \ No newline at end of file +e57d0ad8 \ No newline at end of file diff --git a/index.html b/index.html index 700270f..a5e0545 100644 --- a/index.html +++ b/index.html @@ -803,38 +803,45 @@

Session 4: Outside-In with test doubles -

What’s the item under test? 🧐

+
+

Separation of concerns


Motivation: often the tested unit relies on other units (collaborators) to fulfill its behaviour

    -
  • state verification and behavior verification
  • -
  • avoid non-determinism
  • -
  • speed
  • +
  • What’s the unit under test? 🧐
  • +
  • Keep code simple (fast, minimal, deterministic, …)
  • +
  • Test non-pure interfaces (indirect input / indirect output)
-
-

Imagine… 🌤️

-


-

Solution: test doubles 🪢

+
+

Test doubles 🪢

A pattern where you replace a production object for testing purposes 123


-
-

Test double patterns1 🪢

-
+
+

Test double patterns 🪢

    -
  • Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
  • -
  • Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production.
  • -
  • Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what’s programmed in for the test.
  • -
  • Spies are stubs that also record some information based on how they were called. One form of this might be an email service that records how many messages it was sent.
  • -
  • Mocks objects pre-programmed with expectations which form a specification of the calls they are expected to receive.
  • +
  • State verification: Fake Object, Stubs
  • +
  • Behavior verification: Spy, Mock (the Sherlock Holmes of unit testing)
-
+ +


-
+

martinfowler.com/bliki/TestDouble.html

+
-

Test doubles goes Tetris 🧬

+

Test doubles goes Tetris 🗼

interface Bottom {
 
@@ -849,7 +856,7 @@ 

Test doubles goes Tetris 🧬

* empty when no full lines there * count from bottom, 0 is lowest. */ - removeFullLines(): void + removeFullLines(): number[] /** Return max height of the different columns of bottom. */ maximumHeight(): number @@ -868,7 +875,7 @@

Retrospective 🏟️

  • What went well?
  • What was your first test?
  • -
  • Which role do you prefer, and why?
  • +
  • What advantages could you identify when using test doubles?