Mocking vs. Spying in mocking frameworks

后端 未结 7 1259
执念已碎
执念已碎 2020-11-28 20:24

In mocking frameworks, you can mock an object or spy on it. What\'s the difference between the two and when would/should I use one over the other?

相关标签:
7条回答
  • 2020-11-28 20:55

    Spies have two definitions. One, is where the real method is called, another where, no functionality is called and only null or null equivalent values are returned, but methods were called, and they're state was recorded, commonly like, method x was called y times.

    0 讨论(0)
提交回复
热议问题