DEV Community

Discussion on: How to convince my colleagues about the importance of automated testing

kayis profile image
K (he/him) • Edited on

I don't like that unit testing requires to restructor code or even mocking.

It's like testing stuff that wouldn't be there to test in the first place. :/

namirsab profile image
Namir Author

In our case, mocking the network makes sense IMO. You are writing a service that connects with other services, but you don't want to run the whole infrastructure while developing that service. We stub the responses coming from other services using nock.

I agree with you that mocking a lot of stuff for unit testing is a code smell. But in our case, this is an integration test for the whole service itself.