Skip to content

Xunit Theorie, Fact

Jana Hehr edited this page Sep 25, 2016 · 1 revision

"Facts are tests which are always true. They test invariant conditions."

"Theories are tests which are only true for a particular set of data."

Fakes, Mocks, Stubs

from http://stackoverflow.com/questions/346372/whats-the-difference-between-faking-mocking-and-stubbing

Fake

Fake is just the name used for both stubs and mocks. For example when you don't care about the distinction between stubs and mocks.

Stub

A stub is a controllable replacement for an existing dependency (or collaborator) in the system. By using a stub, you can test your code without dealing with the dependency directly.

Mock

The main thing to remember about mocks versus stubs is that mocks are just like stubs, but you assert against the mock object, whereas you do not assert against a stub.

Mocks

  • Commands
  • Haben Seiteneffekte
  • gefährlich, da brüchig

Stubs

  • Queries
  • Haben keine Seiteneffekte

Clone this wiki locally