8 Comments
User's avatar
alpsavas's avatar

It not only points out the wrong but also shows the right approach in each example. Very well structured newsletter.

I only do not understand fully the 4th example, though. Should I change the existing or add a new implementation to construct an object with less parameters just for test clarity, in this example?

Daniel Moka's avatar

Thanks for the feedback.

As for the 4th example: You don't need a new constructor. You just create an CreateEmployeeWithId method with only one parameter the ID. Then inside the method you construct the object with the non-relevant data (+ the ID), so they are not visible in the test, so dont add noise.

Hope it clarifies it.

Raul Junco's avatar

Well explained, @danielmoka. I loved the examples!

Petar Ivanov's avatar

Arrange-Act-Assert -> the pattern for writing clean and readable tests.

Great article, Daniel! 🙌

Tiger Abrodi's avatar

Love it!

Good letter as always.

Testing implementation details is such a lie. Decreases confidence too.

Hùng Trần's avatar

Your post is very helpful, thanks.

Maximiliano Contieri's avatar

Great as usual!

Looking forward to watching your course!

Tom's avatar

Can you provide more details on the first case ?

It seems like we want to wrap the logic in a Fake class, but what if this logic change ? The Fake class won’t compile without change or am I wrong ?

Thanks !