© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
D. IrvineBuild Your Own Test Frameworkhttps://doi.org/10.1007/978-1-4842-9247-1_11

11. Shared Examples

Daniel Irvine1  
(1)
London, UK
 

With our test runner in an extremely functional state, it’s time to look at some more interesting features.

In this chapter we’ll implement a pair of functions: the describe.shared function and the it.behavesLike function. They can be used to apply a test suite to multiple different objects, each of which is expected to implement the same behavior.

By the end of the chapter, you’ll have discovered
  • The various methods of reuse that are available to test suites

  • How to build variants of describe and it on top of the existing test runner ...

Get Build Your Own Test Framework: A Practical Guide to Writing Better Automated Tests now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.