Quantcast
Viewing latest article 13
Browse Latest Browse All 43

Answer by Alireza Rahmani Khalili for What's the difference between a mock & stub?

let see Test Doubles:

  • Fake: Fakes are objects that have working implementations, but not the same as production one. Such as: in-memory implementation of Data Access Object or Repository.
  • Stub: Stub is an object that holds predefined data and uses it to answer calls during tests. Such as: an object that needs to grab some data from the database to respond to a method call.

  • Mocks: Mocks are objects that register calls they receive.In test assertion, we can verify on Mocks that all expected actions were performed. Such as: a functionality that calls e-mail sending service.for more just check this.


Viewing latest article 13
Browse Latest Browse All 43

Trending Articles