Test Doubles

  • Dummy (Dummy Object)
    • doesn't have any data inside
    • can be empty object {}
    • just exists
    • that's the purpose of the Dummy Object
  • Fake
    • has simple data
      • contains simplified data of the object that is replaced by this fake object
      • example: using in-memory db or some "light" db (SQLite?) instead of real db on the project (like PostgreSQL, Oracle)
  • Stub
  • Spy (in testing)
  • Mock
    • it contains expectations about what parameters should be when the function will be called
      • if function was called with different parameters than expected parameters then test will be failed
  • Fixtures


  • For writing all this stuff you can use:
    • Functionality of the framework like Jest
    • Independent library like Sinon.js


My name is Max, also known as @mxkvl.

I am a software developer, currently working mostly with TypeScript, React and Node ecosystems.

I write a blog about topics that interest me most: programming languages in general, TypeScript, testing, writing and other great stuff.

Join the Mailing List