So, in JavaScript where I originally come from, I used to do TDD using a variety of tools: Mocha, Sinon, Chai, supertest, etc.
These tools used to help me with spies, stubs and mocks, servers and you name it. Some people will tell you that they just use the Node.js assert
, and only use that function to test everything and anything, but I would respectfully disagree with them.
Regardless of that, I learn how to do dependency injection, inversion of control and a myriad of other techniques using such tools to test my applications. As a consequence, none of the apps I tested well ever had issues. In fact, they saved my skin.
Oh, so you are a fanatic!
Well, well, let’s calm down. I have actually seen GOTO 2015 • Agile is Dead • Pragmatic Dave Thomas before. I don’t agree with many of his opinions, but he also makes some pretty good points I agree with.
I don’t see myself as a fanatic. I am of the belief that having 100% coverage is ncie but I will definitely not fret if I don’t reach it. I rather have tests that make sense rather than tests that just bump up a random percentage.
However, given the projects I am in and how much I have benefit from TDD in the past, I am of the strong belief that applying it in my projects makes sense and fits.
I don’t say TDD is the holy grail of salvation. It won’t work for everyone. But for the things I work on, it’s actually pretty great.
Fl4m3 Snow, you know nothing!
I can pierce into some of your brains and see what you are thinking:
You only think you know TDD, but you don’t. In reality you have depended on a set of tools to do testing, while you needed only a basic assert, so without those tools you feel lost because you know nothing!
Well, I wouldn’t say I know nothing. The way I see it,I know some stuff, but I wouldn’t say I am a master either.
YEah, yeah, what do you want?
Well, I was looking for a resource that would present me with a similar set of tools to the one I used in the past. A library to fake spies and stubs and mocks, an assertion library, and explaining how to do tests with such tools and the conventions the Elixir community uses. I want to write Elixir tests after all, not JavaScript tests written in Elixir.
I hope this sheds some light on the kind of person I am and on what I am looking for!
@kokolegorille For now, I just want to learn how to do TDD in Elixir. No Phoenix or frameworks. That’s for another time
I do have to say that the ExUnit docs are rather … well for me, it is hard just by reading the docs to see how I can stitch up each function and make a coherent test suite. As for testing in FP… side effects are always present.
It is my challenge to isolate them and test them properly that led me to the magic world of Monads, which I am still considering ( but I take it most people here don’t really like Monads? ).
@tme_317
@kokolegorille
Also the book Mastering Elixir looks nice, but the testing chapter is mainly a warmup for how to test using Phoenix. Since we don’t use it in the project, I don’t believe it makes much sense.
Maybe I missed something from the online preview?