Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Artifact: Test Stub

A specialized implementation element used for testing purposes, which simulates a real component.
Other Relationships:Part Of Implementation Model Extends: Testability Element
Role:Implementer
Optionality/Occurrence:Optional. Used if the real components are not available or are too expensive to use for testing.
Templates and Reports:
Examples:
UML Representation:Element in the implementation model, stereotyped as <<test stub>>.
More Information:- Concept: Stubs
Input to Activities: - Implement Developer TestOutput from Activities: - Implement Testability Elements

Purpose

The purpose of the Test Stub is to simulate a real component which is not available for testing.

Brief Outline

There are two aspects regarding the Test Stub: the degree of emulation and the lifecycle. Given the tests’ scope and goals, a stub’s implemenation could range from just an almost empty class which complies with a set of interfaces to a full-blown emulator which will perform very close to the real component in terms of functionality. Except for the simple throwaway tests, the stubs will have the same lifecycle as the components under test, therefore in most of the cases they need to be treated the same as product code.

Properties

Property NameBrief DescriptionUML Representation
namethe name of the classattribute
descriptiona brief description of the role of the class in the systemattribute
responsibilitiesa listing of the responsibilities of the classattribute
attributesthe attributes of the classattribute

Timing

The stubs follow the development cycle of the components under test.

Responsibility

See Responsibility in Artifact: Implementation Element.

Tailoring

See Tailoring in Artifact: Implementation Element.