Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Jump to content

Test fixture

From Wikipedia, the free encyclopedia

A test fixture is a device used to consistently test some item, device, or piece of software. Test fixtures are used in the testing of electronics, software and physical devices.

Electronics

[edit]

In testing electronic equipment such as circuit boards, electronic components, and chips, a test fixture is a device or setup designed to hold the device under test in place and allow it to be tested by being subjected to controlled electronic test signals.[1] Examples are a bed of nails tester or smart fixture.

Test fixtures can come in different shapes, sizes, and functions. There are several different types of test fixtures, including In-Circuit Test Fixtures, Functional Test Fixtures, and Wireless Test Fixtures. [2] In Circuit Test (ICT) fixtures individually test each component on a PCB, while functional test fixtures assess the entire board's functionality. Functional test fixtures simulate real-world conditions, whereas ICT is more focused on detecting assembly defects like short circuits or missing components.[3] An In-Circuit Test fixture can come in both Inline and Standard variations. An Inline Test Fixture is designed for fast, automated testing directly within a production line, ideal for high-volume manufacturing where continuous testing maximises efficiency. A Standard Test Fixture, on the other hand, usually requires manual loading, making it well-suited to smaller-scale or specialised testing. [4]

Software

[edit]

In the context of software, a test fixture (also called "test context") is used to set up the system state and input data needed for test execution.[5][6] For example, the Ruby on Rails web framework uses YAML to initialize a database with known parameters before running a test.[7] This allows for tests to be repeatable, which is one of the key features of an effective test framework.[5] In most cases, a custom test fixture will normally require custom test software. This software is created in order to ensure optimal testing performance and seamless integration. The custom software can be configured to carry out a number of different tests from BIST (Built-In Self Test) to advanced JTAG Implementation.[8]

Setup

[edit]

Test fixtures can be set up three different ways: in-line, delegate, and implicit.

  1. In-line setup creates the test fixture in the same method as the rest of the test. While in-line setup is the simplest test fixture to create, it leads to duplication when multiple tests require the same initial data.
  2. Delegate setup places the test fixture in a separate standalone helper method that is accessed by multiple test methods.
  3. Implicit setup places the test fixture in a setup method which is used to set up multiple test methods. This differs from delegate setup in that the overall setup of multiple tests is in a single setup method where the test fixture gets created rather than each test method having its own setup procedures and linking to an external test fixture.[9]

Advantages and disadvantages

[edit]

The main advantage of a test fixture is that it allows for tests to be repeatable since each test is always starting with the same setup. Test fixtures also ease test code design by allowing the developer to separate methods into different functions and reuse each function for other tests. Further, test fixtures preconfigure tests into a known initial state instead of working with whatever was left from a previous test run.

A disadvantage is that it could lead to duplication of test fixtures if using in-line setup.[5][9]

Practices to avoid

[edit]

It is considered bad practice when implicit test fixtures are too general, or when a test method sets up a test fixture and does not use it during the test. A more subtle issue is if the test methods ignore certain fields within the test fixture. Another bad practice is a test setup that contains more steps than needed for the test; this is a problem seen in in-line setup.[9]

A test case is considered "unsafe" when it modifies its fixture(s). An unsafe test case can render subsequent tests useless by leaving the fixture in an unexpected state. It also causes the order of tests to be important: a modified fixture must be reset if more tests are to be run after an unsafe test.[5]

Examples

[edit]

Examples of fixtures include 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, or the preparation of input data as well as set-up and creation of mock objects.

Software which is used to run reproducible tests systematically on a piece of software under test is known as a test harness; part of its job is to set up suitable test fixtures.

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.[10]

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:

  1. Set-up
  2. Exercise, interacting with the system under test
  3. Verify, determining whether the expected outcome has been obtained
  4. Tear down, to return to the original state

Physical testing

[edit]

In physical testing, a fixture is a device or apparatus to hold or support the test specimen during the test. The influence of test fixtures on test results is important and is an ongoing subject of research.[11]

Many test methods detail the requirements of test fixtures in the text of the document.[12][13]

Some fixtures employ clamps, wedge grips and pincer grips.

Further types of construction include eccentric roller fixtures, thread grips and button head grips and rope grips.

Mechanical holding apparatuses provide the clamping force via arms, wedges or eccentric wheel to the jaws. Additionally there are pneumatic and hydraulic fixtures for tensile testing that allow very fast clamping procedures and very high clamping forces.

See also

[edit]

References

[edit]
  1. ^ Tadic, Srdjan; Vukajlovic, Milan (2018). "Automated test Fixture For In-Production Functional Testing of Electronic Devices" (PDF). Retrieved September 10, 2023.
  2. ^ "In-Circuit and Functional Test Fixtures". Forwessun. Retrieved 2024-11-14.
  3. ^ "Functional Test Fixtures". Forwessun. Retrieved 2024-11-14.
  4. ^ "In Circuit Test Fixtures | ICT Fixtures". Forwessun. Retrieved 2024-11-14.
  5. ^ a b c d Pereira da Silva, Lucas (June 10, 2016). "Execution and code reuse between test classes". 2016 IEEE 14th International Conference on Software Engineering Research, Management and Applications (SERA). pp. 99–106. doi:10.1109/SERA.2016.7516134. ISBN 978-1-5090-0809-4. S2CID 17820790.
  6. ^ "Test Fixture - xUnit". xUnit Patterns. Retrieved September 10, 2023.
  7. ^ "A Guide to Testing Rails Applications".
  8. ^ "Test Software Solutions". Forwessun. Retrieved 2024-11-14.
  9. ^ a b c Greiler, Michaela; Zaidman, Andy; van Deursen, Arie; Storey, Margaret-Anne (2013). Strategies for Avoiding Text Fixture Smells during Software Evolution (PDF). 10th IEEE Working Conference on Mining Software Repositories (MSR). doi:10.1109/MSR.2013.6624053. Retrieved 24 January 2014.
  10. ^ Meszaros, Gerard (2007). xUnit Test Patterns: Refactoring Test Code (PDF). Addison-Wesley Professional. ISBN 978-0-13-149505-0. Archived from the original (PDF) on 23 September 2016.
  11. ^ Abadalah, MG; Gascoigne, HE (1989). The Influence of Test Fixture Design on the Shear Test for Fiber Composite Materials. ASTM STP.
  12. ^ ASTM B829 Test for Determining the Formability of copper Strip
  13. ^ ASTM D6641 Compressive Properties of Polymer Matrix Using a Combined Loading Compression Test Fixture