The risk of using mock in Unit testing is that if you mock some behavior of an object, that assumption could easily break as the codebase keep evolving. If you forget to update those mocked setups when things change(this is always happening), you'll find your tests in a situation that it doesn't reflect production usage anymore.
Then what is the value of a test which doesn't reflect real production scenario?
Then what is the value of a test which doesn't reflect real production scenario?
当你mock的行为变了,不正就是原来的需求变了么?
回复删除