DocumentCode
750156
Title
Mock objects
Author
Thomas, Dave ; Hunt, Andy
Volume
19
Issue
3
fYear
2002
Firstpage
22
Lastpage
24
Abstract
One thing that makes unit-testing code so hard is the way the real world keeps intruding. If all we had to do was code up tests for methods that sort arrays or generate Fibonacci series, life would be easy. In the real world we have to test code that uses databases, communications devices, user interfaces, and external applications. We might have to interface to devices that are not yet available or simulate network errors that are impossible to generate locally. This all conspires to stop our unit tests from being neat, self-contained (and orthogonal) chunks of code. Fortunately there is a testing pattern that can help. The authors consider the use of mock objects. With mock objects you can test code in splendid isolation, simulating all those messy real-world things that would otherwise make automated testing impossible. As with many other testing practices, the discipline of using mock objects can improve your code´s structure
Keywords
object-oriented programming; program testing; automated testing; code structure; code unit-testing; mock objects; object oriented programming; software testing; testing pattern; Automatic testing; Containers; Java; Logic; Packaging; Programming profession; Temperature; User interfaces; Web server; Writing;
fLanguage
English
Journal_Title
Software, IEEE
Publisher
ieee
ISSN
0740-7459
Type
jour
DOI
10.1109/MS.2002.1003449
Filename
1003449
Link To Document