Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Test

Tests are tools that monitor the behavior of a code. The code should produce the expected results that are provided in the tests.

There are many different types of tests:

  • Unit test: close to the class level of the code
  • Integration test: they check that components collaborate nicely
  • Functional tests: close to the specifications and the business level
  • Feature testing: close to the specifications and the business level
  • End-to-end tests: they run the software from beginning to the end
  • Performance tests: tests focusing on the behavior of the software under load
  • Property-based tests: tests focusing on the satisfaction of properties
  • Acceptance tests: the tests that the software must pass to be accepted by the end user
  • Smoke tests: tests that quickly detect a problem in the software. They are the most obvious.
  • Exploratory tests: when tests are used to check new behavior of the code
  • Regression tests: tests that ensures that previous behaviors are still behaving the same
  • Fuzzing: testing the software with random data
  • Mutation testing: testing the software robustness by altering the code

Tests may be manual, when they are executed manually. Those are not recorded. Test may be automated, when they are executed by another piece of software.

PHP offers several testing framework, such as PHPunit, pest, simpletest.

Tests are often further automated in a Continuous Integration Pipeline.

Documentation

See Also