one mock to far

26
A MOCK TOO FAR ... milipski michal-lipski Pragmatists.pl

Upload: michal-lipski

Post on 28-Jun-2015

182 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: One mock to far

A MOCK TOO FAR ...

milipski

michal-lipski

Pragmatists.pl

Page 2: One mock to far

UNIT TEST

test of small fragment of code that represents some functionality

Run in isolation from external dependencies and other system functionalities

Page 3: One mock to far

REFACTORING

Changing structure of code without affecting its behavior

Page 4: One mock to far

MOCK

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

For validating our expectation about methods calls that object should receive

Page 5: One mock to far

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

Page 6: One mock to far
Page 7: One mock to far
Page 8: One mock to far
Page 9: One mock to far

Command

Page 10: One mock to far

Command Query

Page 11: One mock to far

Command Query

Incoming

Page 12: One mock to far

Command Query

Incoming

Outgoing

Page 13: One mock to far

Incoming Command

Page 14: One mock to far

Incoming Command

Page 16: One mock to far

Command Query

Incoming assert on public state change

Outgoing

Page 17: One mock to far

Incoming Query

Page 19: One mock to far

Command Query

Incoming assert on public state change

assert on returned value

Outgoing

Page 20: One mock to far

Outgoing Command

Page 22: One mock to far

Command Query

Incoming assert on public state change

assert on returned value

Outgoing verify mock

Page 23: One mock to far

Outgoing Query

Page 25: One mock to far

Command Query

Incoming assert on public state change

assert on returned value

Outgoing verify mockstubor

avoid

Page 26: One mock to far

Command Query

Incoming assert on public state change

assert on returned value

Outgoing verify mockstubor

avoid