Do you use isolated tests?

twitter logo github logo ・1 min read

During my professional career, I've worked on projects where most of the tests are integration tests.
After watching this video --> Integrated Tests Are A Scam it seems that we've been doing all wrong.

Are you using isolated tests in your projects?
How does it feel to program with these kinds of tests?
Thoughts??

twitter logo DISCUSS (3)
markdown guide
 

At the beginning of this I classified the testing I'm doing as integration tests, after getting past the first couple segments I think I'm not doing integration testing in the way he described addressing integration issues.

I'll use web UI as an example. These tests are covering the functionality of the UI. The backend system is mocked in these tests, but the UI is fully integrated together. This avoids end to end problems and allows for targeted tests.

So yes I target isolated tests and avoid larger system interactions. It also provides great benefits to reproducibility when issues are seen in production.

 

Seems like you are mocking an external system which is out of your system.

Mocking the external world it is mandatory because you cannot create database values in order to provide data for your test.

If you create two internal classes who call each other then do you test them separated?

 

"Seems like you are mocking an external system which is out of your system."

It seems to me that is what his design arrangement is. You should build a system that interacts with a different system through a contract.

I'm not a web developer so I'm not familiar with making classes with divs and css to define these contracts between them. I can say that with my own coding I aim for a more functional style of programming, but do not have a emphasis on TDD and leave gaping holes in coverage.

Classic DEV Post from Oct 30 '18

Say something nice about another DEV member

You've probably learned something or benefited from someone's contributions to ...

M Bellucci profile image
Computer Engineer and Ruby Developer since 2014.