mudasobwa

mudasobwa

Creator of Cure

Mocks Are Your Friends, Not Your Servants

Łukasz wrote a great article, 'guiding not ruling’ the way of writing tests. I agree with everything, short of his attitude to mocks. The furter discussion revealed that we treat mocks in an absolutely different manner.

I :heart: mocks, and here is why.

Most Liked

felix-starman

felix-starman

I need to restart my work on DoubleAgent. I was discouraged by all the mock libraries that came out and I never had time to come back and finish it, but maybe this will give me the kick in the pants to do it.

I generally agree with all of the things you said here. My only addition to the conversation is to not call it a mock anymore since there’s too much baggage around it or people misunderstand it.

I like the framing of it as something that collaboratively works with you to validate the contract from the inside.

I have thought similarly for a long time and that was part of why after using double and working with its creator/mantainer in the past I thought a better name would be double agent, because it’s running in the implementation but it’s working for you.

I also have a whole lot of plans for how it can be iteratively employed and guide you from a very simple non-ideal approach to a fully speced out behaviour where all of the best features come about and become easy from following the best practices.

It’s a great article. Thank you for writing it

code-shoily

code-shoily

Just shared this with colleagues. Loved this article.

Where Next?

Popular in Blog Posts Top

paulanthonywilson
Following up on the previous post on using UDP multicasting to broadcast and detect peers on a network, I create a registry of those peer...
New
blackode
https://medium.com/blackode This article comprises of two biggest changes of ExUnit. Arguments in the failure report Running mix tes...
New
mssantosdev
Our take on how to build a frontend style guide with Phoenix Components, Atomic Design and plain CSS, with focus on reusability and code ...
New
rlopzc
Learn how to leverage Erlang + Elixir’s GenServer to build a robust FTP Client. https://rlopzc.com/posts/elixir-ftp-client-genserver-par...
New
lawik
We all have varying degrees of exposure to Big Tech. Some of it seems fine, stable and can be relied on. Some of it feels like shifting s...
New
ErlangSolutions
Hey all, it’s Erlang Solutions. We released loads of Elixir content from our senior developers last week in celebration of ElixirConf US...
New
rms.mrcs
https://medium.com/the-realreal-product-tech-blog/monitoring-hackney-connection-pools-with-telemetry-3aaeafa8eeb8 Hi, everyone! In this ...
New
rrrene
In this series, we take a look at the different ways to organize, structure and execute a good “flow” in our Elixir programs. The latest...
New
brainlid
Phoenix 1.7.0 brings a lot of new things when we run mix phx.gen my_app. These new and cool ways of doing things aren’t automatically bro...
New
brainlid
Jason Stiebs shows a couple ways for a LiveView to make it easy for users to click and copy an important value to their clipboard. He sho...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement