- Mockito
-
Mockito is an open source testing framework for Java released under the MIT License. The framework allows the creation of Test Double objects called, "Mock Objects" in automated unit tests for the purpose of Test-driven Development (TDD) or Behavior Driven Development (BDD).
Contents
Distinguishing Features
Mockito distinguishes itself from other mocking frameworks by allowing developers to verify the behavior of the system under test (SUT) without establishing expectations beforehand[1]. One of the criticisms of Mock objects is that there is a tighter coupling of the test code to the SUT object code[2]. Since Mockito attempts to eliminate the expect-run-verify pattern[3] by removing the specification of expectations, the coupling is reduced or minimized. The result of this distinguishing feature is simpler test code that should be easier to read and modify.
Origins
Szczepan Faber started the Mockito project after finding existing mocking frameworks too complex and difficult to work with. Szczepan began by expanding on the syntax and functionality of Easy Mock, but eventually rewriting most of Mockito[4]. Szczepan's goal was to create a new framework that was easier to work with and provided better results. Early versions of Mockito project found use by the Guardian project in London in early 2008[5].
Usage
Mockito has a growing user-base[6] as well as finding use in other open source projects[7]. In the Stack Overflow discussion on What's the best mock framework for Java?, Mockito is the highest recommended answer[8].
See Also
- List of mock object frameworks
- Behavior driven development
- Mock object
- List of unit testing frameworks
- Software testing
- Unit testing
References
- ^ "Features and Motivations". http://code.google.com/p/mockito/wiki/FeaturesAndMotivations. Retrieved 2010-12-29.
- ^ Fowler, Martin (2007). "Mocks Aren't Stubs". http://martinfowler.com/articles/mocksArentStubs.html#CouplingTestsToImplementations. Retrieved 2010-12-29.
- ^ Faber, Szczepan. "Death Wish". http://monkeyisland.pl/2008/02/01/deathwish/. Retrieved 2010-12-29.
- ^ Faber, Szczepan. "Mockito". http://monkeyisland.pl/2008/01/14/mockito/. Retrieved 2010-12-29.
- ^ "Mockito Home Page". http://code.google.com/p/mockito/. Retrieved 2010-12-29.
- ^ "Mockito User Base". http://code.google.com/p/mockito/wiki/UserBase. Retrieved 2010-12-29.
- ^ "Mockito in Use". http://code.google.com/p/mockito/wiki/MockitoInUse. Retrieved 2010-12-29.
- ^ "What's the best mock framework for Java?". http://stackoverflow.com/questions/22697/whats-the-best-mock-framework-for-java. Retrieved 2010-12-29.
External links
Categories:- Software stubs
- Software testing
- Test-driven development
- Object-oriented programming
Wikimedia Foundation. 2010.