Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Uses  





2 Types  



2.1  General  





2.2  Service  





2.3  Verified fake  







3 See also  





4 References  





5 External links  














Test double






Eesti
Italiano

Українська
 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


Atest doubleissoftware used in software test automation that satisfies a dependency so that the test need not depend on production code. A test double provides functionality via an interface that the software under test cannot distinguish from production code.

Aprogrammer generally uses a test double to isolate the behavior of the consuming code from the rest of the codebase.

A test double is usually a simplified version of the production code and may include capabilities specific to testing.

Test doubles are used to build test harnesses.

Uses[edit]

A test double may be used to simplify and speed test execution.

For example, a program that uses a database server is relatively slow and consumes significant system resources – which impedes testing productivity. Also, a test case might require values outside those stored in the database. A test double might provide a static value instead of accessing a database.

A test double may be used to test part of the system that is ready for testing even if its dependencies are not.

For example, in a system with modules Login, Home and User, suppose Login is ready for test, but the other two are not. The consumed functions of Home and User can be implemented as test doubles so that Login can be tested.

Types[edit]

Test doubles are categorization many ways.

General[edit]

Although not universally accepted, Gerard Meszaros[1] categorizes test doubles as:

While there is no open standard for categories, Martin Fowler used these terms in his article, Mocks Aren't Stubs[2] referring to Meszaros' book. Microsoft also used the same terms and definitions in an article titled, Exploring The Continuum Of Test Doubles.[3]

Service[edit]

For service oriented architecture (SOA) systems and microservices, testers use test doubles that communicate with the system under test over a network protocol.[4][5] These test doubles are called by different names by the tool vendors. A commonly used term is service virtualization. Other names used include API simulation, API mock,[6] HTTP stub, HTTP mock, over the wire test double[7] .[8]

Verified fake[edit]

Averified fake is a fake object whose behavior has been verified to match that of the real object using a set of tests that run against both the verified fake and the real implementation.[9]

See also[edit]

References[edit]

  1. ^ Meszaros, Gerard (2007). xUnit Test Patterns: Refactoring Test Code. Addison-Wesley. ISBN 978-0-13-149505-0.
  • ^ Fowler, Martin (2007). "Mocks Aren't Stubs". Retrieved 2010-12-29.
  • ^ Seemann, Mark (2007). "Exploring The Continuum Of Test Doubles". Retrieved 2010-12-29.
  • ^ Clemson, Toby "Testing Strategies in a Microservice Architecture", martinfowler.com, 18 November 2014. Retrieved on 07 December 2017.
  • ^ Byars, Brandon. "Testing Microservices with Mountebank", Manning Publications, MEAP began March 2017. ISBN 9781617294778. Retrieved on 07 December 2017.
  • ^ Bryant, Daniel "API Mocking Tool WireMock v2 Released with Improved Request Matching and Stub Management", InfoQ, 16 August 2016. Retrieved on 07 December 2017.
  • ^ ThoughtWorks "Technology Radar, Tools: Mountebank", ThoughtWorks, November 2015. Retrieved on 07 December 2017.
  • ^ Bulaty, Wojciech "Stubbing, Mocking and Service Virtualization Differences for Test and Development Teams", InfoQ, 19 February 2016. Retrieved on 07 December 2017.
  • ^ Turner-Trauring, Itamar (2019). "Fast tests for slow services: why you should use verified fakes". Retrieved 2019-01-21.
  • External links[edit]

    Gerard Meszaros:

    Martin Fowler:

    Open source:


    Retrieved from "https://en.wikipedia.org/w/index.php?title=Test_double&oldid=1223066898"

    Categories: 
    Software testing
    Software design patterns
    Software development process
     



    This page was last edited on 9 May 2024, at 17:36 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki