Creating Comprehensive Test Coverage
Explore how to create thorough test coverage in Elixir by leveraging ExUnit features and realistic JSON fixtures. Learn to organize tests using setup blocks to enhance maintainability while balancing readability and thoroughness.
We'll cover the following...
We’ve covered some of the very basics of testing and delved into a bit of test theory. To provide solid coverage of a file, we’ll need to build on that knowledge by pulling in some features of Elixir itself, as well as some optional features of ExUnit’s assertions. These skills will help us write maximum test coverage with minimal code and without trade-offs.
Using a setup block
Let’s jump back to where we left our Soggy Waffle test, SoggyWaffle.WeatherAPI.ResponseParserTest. The data we used in our test was hand-coded. That’s a great way to ...