|
| 1 | +# Testing Testo |
| 2 | + |
| 3 | +Testo is a modular framework. |
| 4 | +Each module will eventually become a separate Composer package. Until that happens, |
| 5 | +the test folder structure should be maintained in a way that allows for easy migration |
| 6 | +of tests to separate module repositories in the future. |
| 7 | + |
| 8 | +For example, the `tests/Assert` folder contains tests for the Assert module. |
| 9 | +The `tests/Assert/suites.php` file lists the test suite configurations for this module. |
| 10 | +Currently, these configurations are merged into the main testing config `testo.php`, |
| 11 | +integrating the Assert module tests into the overall Testo testing process. |
| 12 | + |
| 13 | +Tests must be isolated from other tests, meaning each module should have |
| 14 | +its own fixtures, mock objects, etc. |
| 15 | + |
| 16 | +## Self Tests |
| 17 | + |
| 18 | +In addition to the commonly known types of tests (unit tests, integration tests, etc.), |
| 19 | +Testo has another type of test - Self Tests. |
| 20 | + |
| 21 | +Example of a test that tests itself: |
| 22 | + |
| 23 | +```php |
| 24 | +#[Test] |
| 25 | +public function numbers(): void |
| 26 | +{ |
| 27 | + Assert::equals(1, 1); |
| 28 | + Assert::equals(1, 1.0); |
| 29 | + Assert::equals(1.0, 1); |
| 30 | + Assert::equals("2", 2); |
| 31 | +} |
| 32 | +``` |
| 33 | + |
| 34 | +If the test completes with Passed status, we have verified that: |
| 35 | +- `Assert::equals` registers a successful assertion in the Test State, otherwise the test would be marked as Risky. |
| 36 | +- `Assert::equals` doesn't fail on the provided values. |
| 37 | + |
| 38 | +Special attributes will soon be added for Self Tests to simplify their creation, |
| 39 | +for example `#[Testing\ExpectStatus(Status::Failed)]` and others. |
0 commit comments