Development Book Club: Building Microservices with ASP.NET Core (pt.1)

by

At KEYSYS we know software & technology are ever-evolving landscapes. That’s why we started the KEYSYS Development Book Club to help our team grow and improve in our core values of Knowledge, Constant Improvement, & Collaboration. 

Each Wednesday our development team meets together to discuss a chapter in the book they’re reading and work through examples together. These meetings have really helped our team and culture grow as everyone has the chance to improve together.

This is the first of two blog posts describing the first book featured in the KEYSYS Development Book Club: Building Microservices with ASP.NET Core by Kevin Hoffman. Hoffman’s book outlines some essential features of .NET Core, including request and response handling and third-party dependency management. Hoffman also provides more in-depth architectural guidance, such as how to isolate business code for unit testing. Most importantly, the book presents all these details in the context of cloud-native application design, explaining how to structure services for event sourcing, service discovery, telemetry, and more.

This book inspired us to run automated integration tests prior to deployment (i.e., on a local server) to catch integration bugs before they even enter the test environment.

Integration Tests Before Deployment

Integration tests validate the interactions between two or more components in a software application. For a microservice, one example would be validating interactions between an API and a database. These tests can be automated to reduce manual testing effort and provide quick feedback to the development team.

Traditionally, this type of test could be run only after the database and API were deployed to the test environment. This means that API/database integration bugs would make it past the first cycle of development, necessitating an extra cycle for reporting and fixing the bugs. Now, since databases can be hosted locally in Docker containers, we can run integration tests on build servers (and even on our local machines) to catch bugs earlier and faster. .NET Core makes this easy by providing the TestServer class, which can host a test version of your web application with any configuration you choose (such as a Docker-hosted database, for example).

 

After learning about this capability from Hoffman’s book, we implemented locally-run integration tests for the most critical API calls in a user authentication microservice. On many occasions, these tests successfully caught integration bugs before they could be deployed to a test environment, resulting in faster fix times.

AARON HALL

Software Engineer @ KEYSYS

SPECIALTIES

  • Automated Testing
  • Test-driven Development