Chapter 13. Unit Testing Your Code

In Chapter 10, you built out the basic functionality for interacting with your Mongo database. You implemented a basic CRUD interface and wrote a handful of helper functions. Your MongoModel class now has multiple ways to modify the database based on which type of data transfer object you are working with.

To maintain confidence that the code in your MongoModel class is working correctly, you need to write unit tests to ensure that when changes are made, no regressions are introduced.

What Is Unit Testing?

Unit testing is a best practice for creating maintainable software. In short, it’s a set of functions that represent different scenarios to test the results of other code.

Unit testing frameworks provide ...

Get Write Web Apps with Dart: Develop and Design 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.