Milan Jovanović
Read post

How to Test Vertical Slice Architecture

Testing vertical slice architecture (VSA) requires a mindset shift away from mocking layers. The right unit to test is the slice itself: send a real HTTP request in, verify the database state out, using WebApplicationFactory and Testcontainers with a real Postgres instance. Fakes are reserved only for third-party services you don't own. Unit tests still apply for extracted domain logic with complex rules, while architecture tests enforce that slices don't reference each other. This approach catches routing, validation, mapping, and persistence bugs in one pass and survives internal refactoring because tests are coupled to behavior, not implementation.

    #testing#.net
Jul 11•7m read time•From milanjovanovic.tech
Post cover image
Table of contents
The Slice Is the UnitThe Setup That Makes It PracticalWhere Unit Tests Still Earn Their KeepKeep the Slices From Growing Into Each OtherSummary
9.9K Impressions
Milan Jovanović's image
Milan Jovanović

MilanJovanovic's platform covers topics related to software development, technology trends, and cod...

722 Followers

•

2.9K Upvotes

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard