Test Framework¶
A test framework is a library or tool that provides the infrastructure for writing, organising, and running automated tests. It typically offers assertion helpers, double, test runners, fixtures, and reporting.
A test framework does not dictate what to test; it provides the mechanics to express and execute tests repeatably, integrate with CI pipelines, and produce machine-readable reports, such as JUnit XML, code coverage, etc.
<?php
// PHPUnit example
use PHPUnit\Framework\TestCase;
class MathTest extends TestCase {
public function testAdd(): void {
$this->assertSame(4, 2 + 2);
}
}
?>
See also PHPUnit, Pest, Codeception, Testo and Atoum.
Related : Test, PHPunit, Continuous Integration (CI), Double, Fixture, Code Coverage, Continuous Integration, Continuous Integration, Regression, Test-Driven Development