Test stub

Last updated

A test stub is a test double that provides static values to the software under test.

Contents

A test stub provides canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test. [1]

A stub may be coded by hand or generated via a tool.

See also

Related Research Articles

Test-driven development (TDD) is a way of writing code that involves writing an automated unit-level test case that fails, then writing just enough code to make the test pass, then refactoring both the test code and the production code, then repeating with another new test case.

In computing, an interface is a shared boundary across which two or more separate components of a computer system exchange information. The exchange can be between software, computer hardware, peripheral devices, humans, and combinations of these. Some computer hardware devices, such as a touchscreen, can both send and receive data through the interface, while others such as a mouse or microphone may only provide an interface to send data to a given system.

A method stub is a short and simple placeholder for a method that is not yet written for production needs. Generally, a method stub contains just enough code to allow it to be used – a declaration with any parameters, and if applicable, a return value.

Stub or Stubb may refer to:

In software testing, a test harness is a collection of stubs and drivers configured to assist with the testing of an application or component. It acts as imitation infrastructure for test environments or containers where the full infrastructure is either not available or not desired.

A mock object is an object that imitates a production object in limited ways.

The Internet Communications Engine, or Ice, is an open-source RPC framework developed by ZeroC. It provides SDKs for C++, C#, Java, JavaScript, MATLAB, Objective-C, PHP, Python, Ruby and Swift, and can run on various operating systems, including Linux, Windows, macOS, iOS and Android.

<span class="mw-page-title-main">Mockup</span> Scale or full-size model of a design or device

In manufacturing and design, a mockup, or mock-up, is a scale or full-size model of a design or device, used for teaching, demonstration, design evaluation, promotion, and other purposes. A mockup may be a prototype if it provides at least part of the functionality of a system and enables testing of a design.

CWSDPMI is a 32-bit DPMI host written by Charles W. Sandmann from 1996 to 2010, currently at r7. It is loosely based upon prior GO32.EXE code used in DJGPP v1. It can provide DPMI 0.90+ 32-bit services for programs compiled with latest versions of DJGPP etc. compilers. Since r5, it can also be used for programs requiring a DPMI stub in lieu of PMODE/DJ. It supports up to 4 GB, virtual memory, and hardware interrupt reflection from real mode to protected mode. Programs compiled with DJGPP v2 require a DPMI host, which is usually CWSDPMI.EXE or CWSDPR0.EXE. In case of CWSDPMI.EXE, the default paging/virtual memory file is C:\CWSDPMI.SWP. It is capable of running on a 386 in under 512 KB of RAM.

In distributed computing, a stub is a program that acts as a temporary replacement for a remote service or object. It allows the client application to access a service as if it were local, while hiding the details of the underlying network communication. This can simplify the development process, as the client application does not need to be aware of the complexities of distributed computing. Instead, it can rely on the stub to handle the remote communication, while providing a familiar interface for the developer to work with.

Parasoft SOAtest is a testing and analysis tool suite for testing and validating APIs and API-driven applications. Basic testing functionality include functional unit testing, integration testing, regression testing, system testing, security testing, simulation and mocking, runtime error detection, web UI testing, interoperability testing, WS-* compliance testing, and load testing.

Mockito is an open source testing framework for Java released under the MIT License. The framework allows the creation of test double objects in automated unit tests for the purpose of test-driven development (TDD) or behavior-driven development (BDD).

A test double is software 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.

System under test (SUT) refers to a system that is being tested for correct operation. According to ISTQB it is the test object.

In software engineering, service virtualization or service virtualisation is a method to emulate the behavior of specific components in heterogeneous component-based applications such as API-driven applications, cloud-based applications and service-oriented architectures. It is used to provide software development and QA/testing teams access to dependent system components that are needed to exercise an application under test (AUT), but are unavailable or difficult-to-access for development and testing purposes. With the behavior of the dependent components "virtualized", testing and development can proceed without accessing the actual live components. Service virtualization is recognized by vendors, industry analysts, and industry publications as being different than mocking. See here for a Comparison of API simulation tools.

Parasoft Virtualize is a service virtualization product that can create, deploy, and manage simulated test environments for software development and software testing purposes. These environments simulate the behavior of dependent resources that are unavailable, difficult to access, or difficult to configure for development or testing. It simulates the behavior of dependent resources such as mainframes, ERP systems, databases, web services, third-party information systems, or other systems that are out of direct developer/tester control. The product is used in conjunction with hardware/OS virtualization to provide developers and testers with the resources they need to execute their development and testing tasks earlier, faster, or more completely. Its technologies for automating continuous testing are used as part of continuous delivery, continuous integration, and continuous release.

EasyMock is an open-source testing framework for Java released under the Apache License. The framework allows the creation of test double objects for the purpose of Test-driven Development (TDD) or Behavior Driven Development (BDD).

Factory Bot, originally known as Factory Girl, is a software library for the Ruby programming language that provides factory methods to create test fixtures for automated software testing. The fixture objects can be created on the fly; they may be plain Ruby objects with a predefined state, ORM objects with existing database records or mock objects.

Bogus is a Ruby API library used for minimizing risks involved in isolated unit testing. It was initially released in July 2012 by rubygems.org. Through Bogus, a piece of code can be tested in a fast and safe manner, without any actual integration with external programs. Bogus cannot mock or stub methods not present in the required external environment.

The tools listed here support emulating or simulating APIs and software systems. They are also called API mocking tools, service virtualization tools, over the wire test doubles and tools for stubbing and mocking HTTP(S) and other protocols. They enable component testing in isolation.

References

  1. Fowler, Martin (2007), Mocks Aren't Stubs (Online)