One mock to far

Post on 28-Jun-2015

182 views 2 download

Tags:

Transcript of One mock to far

A MOCK TOO FAR ...

milipski

michal-lipski

Pragmatists.pl

UNIT TEST

test of small fragment of code that represents some functionality

Run in isolation from external dependencies and other system functionalities

REFACTORING

Changing structure of code without affecting its behavior

MOCK

STUB For replacing a method with code that returns a specified result.

For validating our expectation about methods calls that object should receive

MOCK

STUB For replacing a method with code that returns a specified result.

For validating our expectation about methods calls that object should receive

STATE TESTING

BEHAVIORAL TESTING

Command

Command Query

Command Query

Incoming

Command Query

Incoming

Outgoing

Incoming Command

Incoming Command

Command Query

Incoming assert on public state change

Outgoing

Incoming Query

Command Query

Incoming assert on public state change

assert on returned value

Outgoing

Outgoing Command

Command Query

Incoming assert on public state change

assert on returned value

Outgoing verify mock

Outgoing Query

Command Query

Incoming assert on public state change

assert on returned value

Outgoing verify mockstubor

avoid

Command Query

Incoming assert on public state change

assert on returned value

Outgoing verify mockstubor

avoid