Week 2: CST438

 A mock is a an object in testing that's meant to act like a more complex service/dependency. A lot of times it can be impractical to make calls to an outside service/object/dependency like a database or a slow/expensive library just to run tests. Also, sometimes these external services might be out of our control and they may not behave the way our tests expect them to act every time, making our tests less useful and less isolated. With a mock, it's much easier to control it's simulated behavior instead of the actual object's behavior, which is often controlled by someone else or depends on other variables. Also for performance, mocks usually run a lot faster making our tests more lightweight.

Comments

Popular posts from this blog

Journal Week 4

Week 5: CST438 Journal

This week