The Loosely Coupled Show cover image

The Loosely Coupled Show

Testing Controllers, Messages & Systems with Andrew Lock

Sep 25, 2020
Andrew Lock joins us to talk about testing. They discuss testing API/MVC controllers, messaging, databases, and more. The chapter explores challenges in testing controllers, messages, and systems, including the difficulties of testing long-running processes and the need to ensure appropriate handlers are present.
34:48

Episode guests

Podcast summary created with Snipd AI

Quick takeaways

  • Unit testing controllers may have limited value due to many of their aspects being provided by the framework and external to the controller itself.
  • A combination of unit tests and integration tests should be employed based on the specific context and value that each test brings.

Deep dives

The Value of Testing Controller Logic

The episode discusses the value of testing controller logic in a .NET context. While some argue that integration tests are more valuable than unit tests, the hosts question the necessity of unit testing controllers. They recognize that many aspects of controllers, such as model binding, validation, and routing, are provided by the framework and can be considered external to the controller itself. They also highlight the limitations of testing thick controllers that directly manipulate databases and recommend a thin controller approach using mediators or dispatchers. They emphasize the importance of segmenting testing, with unit tests focusing on isolated units of code and integration tests handling the end-to-end scenarios.

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode