Test - Fixture (Start State)

> Code - (Programming|Computer) Language > Code - Testing (Software Quality Assurance|SQA|Validator|Checker)

1 - 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.

Advertising

3 - Example

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

4 - 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

5 - Documentation / Reference

code/test/fixture.txt · Last modified: 2019/01/20 22:27 by gerardnico