DEV Community

M Bellucci
M Bellucci

Posted on

Do you use isolated tests?

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??

Top comments (3)

Collapse
 
jessekphillips profile image
Jesse Phillips

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.

Collapse
 
delbetu profile image
M Bellucci

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?

Collapse
 
jessekphillips profile image
Jesse Phillips

"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.