Test fixture

Test fixture

Test fixture refers to the fixed state used as a baseline for running tests in software testing. The purpose of a test fixture is to ensure that there is a well known and fixed environment in which tests are run so that results are repeatable. Some people call this the "test context".

Examples of fixtures:
* loading a database with a specific, known set of data
* erasing a hard disk and installing a known clean operating system installation
* copying a specific known set of files
* preparation of input data and setup/creation of fake or mock objects

Test fixture in xUnit

In generic xUnit, a "test fixture" is all the things that must be in place in order to run a test and expect a particular outcome.

Frequently fixtures are created by handling "setUp()" and "tearDown()" events of the unit testing framework. In "setUp()" one would create the expected state for the test, and in "tearDown()" it would clean up what had been set up.

Four phases of a test:
# Set up -- Setting up the "test fixture".
# Exercise -- Interact with the "system under test".
# Verify -- Determine whether the expected outcome has been obtained.
# Tear down -- Tear down the "test fixture" to return to the original state.

Use of fixtures

Some advantages of "fixtures" include separation of the test initialization (and destruction) from the testing, reusing a known state for more than one test, and special assumption by the testing framework that the fixture set up works.

See also

* Unit testing


* [http://www.cs.utep.edu/~cheon/cs3331/notes/unit-testing.ppt http://www.cs.utep.edu/~cheon/cs3331/notes/unit-testing.ppt]
* http://manuals.rubyonrails.com/read/chapter/26

Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Test engineer — A (hardware) test engineer (TE) is a professional who determines how to create a process that would test a particular product in manufacturing, or related area like RMA department, in order to guarantee that the product will be shipped out with… …   Wikipedia

  • Fixture — A fixture can refer to: * a testing fixture when talking about ATEs * a light fixture * a plumbing fixture * Fixture (tool), a tool used in manufacturing * Fixture (property law), in property law, a chattel which has become permanently attached… …   Wikipedia

  • Test Match Special — (known as TMS ) is a radio programme broadcast on BBC Radio 4 (long wave), Five Live Sports Extra (digital) and the internet to the United Kingdom and (where broadcasting rights permit) the rest of the world, including England s winter tours to… …   Wikipedia

  • Test cricket — A Test match between South Africa and England in January 2005. The men wearing black trousers on the far right are the umpires. Test cricket is played in traditional white clothes and with a red ball. Test cricket is the longest form of the sport …   Wikipedia

  • In-circuit test — (ICT) is an example of white box testing where an electrical probe tests a populated printed circuit board (PCB), checking for shorts, opens, resistance, capacitance, and other basic quantities which will show whether the assembly was correctly… …   Wikipedia

  • Framework for Integrated Test — Framework for Integrated Test, or Fit , is an open source tool for automated customer tests. It integrates the work of customers, analysts, testers, and developers.Customers provide examples of how their software should work. Those examples are… …   Wikipedia

  • Fixtureless in-circuit test — (FICT) is a cost effective alternative to a bed of nails tester for in circuit testing of low to medium volumes of printed circuit board assemblies. It relies on a computerized optical inspection of the circuit assembly and positionable test… …   Wikipedia

  • FCT (test) — FCT refers to functional test. The functional test is typically performed in the last phase of the production line of a product, as a final quality control. FCT are performed to ensure that the device under test (DUT) fulfills its functional… …   Wikipedia

  • free bend test — Bending the specimen without using a fixture or guide …   Dictionary of automotive terms

  • guided send test — Bending a specimen in a definite way by using a fixture …   Dictionary of automotive terms

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”