Test Your Code
One of the benefits of structuring your project into core and boundary layers is that our coding organization will simplify testing. With a basic API layer that does most of the business logic, you’ll be able to write tests to thoroughly exercise your business code should you choose to do so. You’ll be able to represent your testing concepts in any way you choose, and we’ll discuss a few strategies as the book evolves.
We will focus on unit testing here with ExUnit, but the same principles apply to property-based testing, a philosophy that allows you to specify properties about your code so that the computer can generate many different tests. For now, let’s write a simple test for our counter. We’ll start with the business logic. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access