vendredi 31 mars 2017

How does one write a good unit test without mocking everything?

I have read that mocking everything is bad.
Test Smell: Everything is mocked
Mock Everything Is a Good Way to Sink

I have also read that unit tests look at a single component whilst Integration tests test an entire system working together.
Writing Great Unit Tests: Best and Worst Practices

This confuses me. As I understand it, to write a proper unit test one needs to isolate a single component by mocking everything but the S.U.T. If one uses real objects throughout the test, doesn't that test become an integration test?

How does one write a good (isolated) unit test without mocking everything?

Aucun commentaire:

Enregistrer un commentaire