ABSTRACT
Mock Objects is an extension to Test-Driven Development that supports good Object-Oriented design by guiding the discovery of a coherent system of types within a code base. It turns out to be less interesting as a technique for isolating tests from third-party libraries than is widely thought. This paper describes the process of using Mock Objects with an extended example and reports best and worst practices gained from experience of applying the process. It also introduces jMock, a Java framework that embodies our collective experience.
- Astels, D. Test-Driven Development: A Practical Guide, Prentice-Hall, 2003. Google ScholarDigital Library
- Beck, K. and Cunningham, W. A Laboratory For Teaching Object-Oriented Thinking. In SIGPLAN Notices (OOPLSA'89), 24, 10, October 1989. Google ScholarDigital Library
- Fowler, M. et al. Refactoring: Improving the Design of Existing Code, Addison-Wesley, Reading, MA, 1999. Google ScholarDigital Library
- Freese, T. EasyMock 2003. Available at: http://www.easymock.orgGoogle Scholar
- Hudak, P. Building domain-specific embedded languages. ACM Computing Surveys, 28(4es), December 1996. Google ScholarDigital Library
- Hunt, A. and Thomas, D. Tell, Don't Ask, May 1998. Available at: http://www.pragmaticprogrammer.com/ppllc/papers/1998_05.htmlGoogle Scholar
- Kiczales, G., et al. Aspect-Oriented Programming, In proceedings of the European Conference on Object-Oriented Programming (ECOOP), Finland. Springer-Verlag LNCS 1241. June 1997.Google ScholarCross Ref
- JUnit. 2004. Available at http://www.junit.orgGoogle Scholar
- Mackinnon, T., Freeman, S., Craig, P. Endo-testing: unit testing with mock objects. In Extreme Programming Examined, Addison-Wesley, Boston, MA. 2001. 287--301. Also available from http://www.mockobjects.com Google ScholarDigital Library
- Marx, K. Critique of the Gotha Program, 1874.Google Scholar
- Mikhajlov, L. and Sekerinski, E. A Study of the Fragile Base Class Problem. In E. Jul (Ed.), ECOOP'98 - Object-Oriented Programming 12th European Conference, Brussels, Belgium, July 1998, pp 355--382, Lecture Notes in Computer Science 1445, Springer-Verlag,1998. Google ScholarDigital Library
- Massol, V. and Husted, T. JUnit in Action, Manning, 2003. Google ScholarDigital Library
- Moore, I. and Cooke, M. MockMaker, 2004. Available at: http://www.mockmaker.orgGoogle Scholar
- Lieberherr, K. and Holland, I. Assuring Good Style for Object-Oriented Programs IEEE Software, September 1989, 38-48. Google ScholarDigital Library
- Poppendieck, M. Principles of Lean Thinking, In OOPSLA Onward!, November 2002.Google Scholar
- Sun Microsystems, Java Messaging Service, Available at: http://java.sun.com/products/jmsGoogle Scholar
- Williams, L. and Kessler, R. Pair Programming Illuminated. Addison-Wesley, Reading, MA, 2002. ISBN 0201745763. Google ScholarDigital Library
- Wirfs-Brock, R. and McKean, A. Object Design: Roles, Responsibilities, and Collaborations, Addison-Wesley, Reading, MA, 2002. Google ScholarDigital Library
Index Terms
- Mock roles, not objects
Recommendations
jMock: supporting responsibility-based design with mock objects
OOPSLA '04: Companion to the 19th annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applicationsIn this demonstration we will show the flow of the Mock Object development process by pair-programming to develop a code example. During the session, we will introduce the declarative jMock API and show how we use it to describe relationships between ...
Mock object creation for test factoring
PASTE '04: Proceedings of the 5th ACM SIGPLAN-SIGSOFT workshop on Program analysis for software tools and engineeringTest factoring creates fast, focused unit tests from slow system-wide tests; each new unit test exercises only a subset of the functionality exercised by the system tests. Augmenting a test suite with factored unit tests, and prioritizing the tests, ...
Test-Driven GUI Development with TestNG and Abbot
Regardless of test-driven development's well-known benefits, it has suffered slow adoption in GUI development. Because GUIs are one of applications' most important components, testing them is essential for improving the entire system's safety and ...
Comments