Contents don’t mention the subject of Elixir testing. Are you sure there’s nothing to add about the how, when, where, and what of Elixir testing?
Thanks for your question. I do think testing is important, so I’d like to address this.
I’ll tell you a secret. I started writing this book in a full-on TDD style. I quickly realized that the testing was taking over the focus of the book, and I had to re-write what I had already done without tests to get it back on track.
There will be an appendix pointing readers toward resources for testing. And to give you a forthright answer, I don’t think I would have anything groundbreaking to add to what is already available.
I finished chapter 3 and felt a need to understand the code I had written following the book so far. I started writing unit tests.
My tests are here: https://github.com/arvindhiman/islands_engine
I finished the first cut of Coordinate in chapter 2 and was feeling the need to get a handle on Elixir unit tests.
Thoroughly enjoying the non-ORM treatment in Ch.2.
But, I find the reliance on iex to illustrate return values as a missed opportunity to build a foundation of unit tests underneath the domain model. Reading code in an eBook is fine, but line after line of iex output dilutes the major points that are being presented.
Reminds me of this over-used proverb: “give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime”
xlated: “give a man an [iex result] and you feed him for a day; teach a man to [write a test] and you feed him for a lifetime”
Unit tests would have helped with some of the sample code. Especially the long iex sessions at the end of chapter 3. I had successfully entered all the code but had messed up some of the testing code until it went into unit tests.
For what is worth, I find your book to be the best resource for elixir out there. In my opinion, if you went on with the tdd style, it might take the focus at the beginning, but it would win big time later on, especially when you need to enter all these commands on iex. Also, we would have a full context (no pun intended) on how a professional elixir developer builds software from the ground up. I know this would be important to me, I guess I would not be alone. Have in mind that what is out there regarding tests and ExUnit, is not as good as it should be. Sure we can find information on ExUnit, but there is no good all in one guide out there.