• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
 

TDD with BabyMock 2

on

  • 639 views

BabyMock is a visual mock object library for Pharo Smalltalk, that supports test-driven development.

BabyMock is a visual mock object library for Pharo Smalltalk, that supports test-driven development.

http://youtu.be/xChlI4j4Euc

Statistics

Views

Total Views
639
Views on SlideShare
637
Embed Views
2

Actions

Likes
2
Downloads
2
Comments
0

2 Embeds 2

https://twitter.com 1
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    TDD with BabyMock 2 TDD with BabyMock 2 Presentation Transcript

    • Test-driven development in with BabyMock 2 Attila Magyar FOSDEM 01/02/2014 Brussels
    • Who am I? Attila Magyar ● Java for living ● Smalltalk for joy, since 2012 ● ● Python, Groovy, Lisp, etc.. TDD for about 4 years Contact: http://twitter.com/zeroflag
    • Agenda ● ● ● About TDD and Mock objects in general About BabyMock 2 ● Differences between the new and the old version ● How does it work? ● Few words about the internals DEMO
    • Outside-in TDD with Mocks B 3 age ss Me Message 2 A Me ssa ge 4 R es po ns e Test Message 1 C
    • Expect Message 3 ● Exactly once ● With x argument ● Outside-in TDD with Mocks MOCK B 3 age ss Me Message 2 Allow Message 4 ● Any number of times ● With y argument ● Answer „Response” A ● Me ssa ge 4 R es po ns e Test Message 1 Inter-object protocol MOCK C
    • BabyMock is a visual mock object library http://smalltalkhub.com/#!/~zeroflag/BabyMock2/ Get a good mental picture of the objects relationships, and the inter-object protocol ● ● Identifying test failures is easier
    • The old syntax (BabyMock 1)
    • The new syntax (BabyMock 2)
    • Expectations Under the hood
    • How does it work? ● ● ● Mock object is a Proxy that intercepts all messages Using the doesNotUnderstand is easiest way to implement it (but limited). Nil methodDictionary + cannotInterpret More information: Efficient Proxies in Smalltalk by Mariano Martinez Peck et al.
    • BabyMock visualized with BabyMock
    • BabyMock visualized with BabyMock
    • BabyMock visualized with BabyMock
    • DEMO ShoppingCart ● Adding new item ids ● CreditCard ● Paying for its content ● PriceCatalog
    • Food for thought ● http://jmock.org/ (https://github.com/jmock-developers/jmock-library) ● Evolving an Embedded Domain-Specific Language in Java, Freeman, S. and Pryce, N. ● Mock Roles, Not Objects. OOPSLA 2004, Freeman, S., Mackinnon, T., Pryce, N., Walnes, J., ● Growing Object-Oriented Software, Guided by Tests, Freeman, S. and Pryce, N. ● Efficient Proxies in Smalltalk, Mariano Martinez Peck et al.