Testing is one of the most important tools in a software developer's arsenal; it's also one of the most underused, historically (although things seem to be getting a lot better on that front lately).
Today, we're going to cover:
- What is testing, and what is good for.
- ExUnit, Elixir's built-in Unit Testing framework.
- Building an example module via TDD.
- An awesome online tool and community called Exercism.io, which hails from the Ruby community originally.
- A great feature Elixir provides called doctests
People often see testing's value in avoiding regressions, and that's a fantastic feature it provides. Tests allow you to refactor your code without concern that you've accidentally changed behaviour in some subtle way.
I see an even greater value in testing as the way to plan the code you're going to write. Testing is how I think now, and I find it very difficult to build a system without doing it by writing and satisfying a series of unit tests. It...
To see the complete version of this and more awesome articles become a superuser or login