Test - Fixture (Start State)

Testing Infrastructure

About

A test fixture represents the preparation needed to perform one or more tests, and any associate cleanup actions.

One of the most time-consuming parts of writing tests is writing the code to set the world up in a known state and then return it to its original state when the test is complete. This known state is called the fixture of the test.

A test fixture (also known as a test context) is the set of preconditions or state needed to run a test.

Example

  • Creating and filling database table,
  • Creating files / directories
  • Starting a server
  • Creating a HTML page before testing javascript

Implementation

The fixture implementation in the frameworks is done through methods that are called before and after each test or test suite. They have names such

  • SetUp and TearDown
  • BeforeClass, AfterClass

Documentation / Reference





Discover More
Eclipse Oepe Junit Library
Java - JUnit

Written by Erich Gamma (of Design Patterns fame) and Kent Beck (creator of XP methodology) A simple framework to write and run repeatable tests JUnit features include: Assertions for testing expected...
Javascript - Qunit Test Framework

Qunit is a unit test framework for Javascript. Qunit consists of: qunit.js, the test runner and testing framework, qunit.css, which styles the test suite page to display test results the mandatory...
Testing Infrastructure
Test - Given When Then

Structure of an unit test Then when phase is called setting a fixture.
Testing Infrastructure
Test - Setup

The setup function in a test framework is called before a test method and is sometimes called a fixture



Share this page:
Follow us:
Task Runner