3 ms·
Been in that "everything mocked" scenario too. I try to mock as little as possible too but ensure that as much as possible can be mocked, because very often tha
by teknopaul 4y ago
Been in that "everything mocked" scenario too. I try to mock as little as possible too but ensure that as much as possible can be mocked, because very often that is path of least resistance for a specific test.
I've seen code with so much mocked that many unit tests failed to test anything other than behaviour of mocks.
Not sure I'm comfortable with test code and switches being deployed as an alternative. I find supporting different types of test to be a benefit. Seems to me if you have test infrastructure in the code that will limit options. I have seen code that activly prevented mocks that was impossible to test.
- u801e 4y ago> I've seen code with so much mocked that many unit tests failed to test anything other than behaviour of mocks. One example of this was a test that passed because of the expected behavior as determined by a mock, but the code failed in the staging environment because the underlying library changed its method signature to take some parameters in a different order. To me, this basically was a signal that that particular test and tests like it were essentially useless in determining whether the code was really in a working state.
- flippinburgers 4y agoThis is the major achilles heal of mocking that I find to be most bothersome. If at all possible I try to have at least a happy path subset of real tests hitting real 3rd party apis if I possibly can.