World Library  
Flag as Inappropriate
Email this Article

Test stub

Article Id: WHEBN0017515602
Reproduction Date:

Title: Test stub  
Author: World Heritage Encyclopedia
Language: English
Subject: Method stub, Stub
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Test stub

In computer science, test stubs are programs which simulate the behaviors of software components (or modules) that are depended-upon modules of the module being tested.

Test stubs are mainly used in incremental testing's Top-Down approach. Stubs are computer programs which act as temporary replacement for a called module and give the same output as the actual product/software.

Example

Consider a computer program which queries a database to obtain the sum price total of all products stored in the database. However, the query is slow and consumes a large number of system resources. This reduces the number of test runs per day. Secondly, the tests may need to be conducted on values outside those which are currently in the database.

The method (or call) used to perform this is get_total(). For testing purposes, the source code in get_total() could be temporarily replaced with a simple statement which returned a specific value. This would be a test stub.

There are several testing frameworks available and there is software that can generate test stubs based on existing source code and testing requirements.

External links

  • http://xunitpatterns.com/Test%20Stub.html

See also

References


This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.