Magento 2 integration tests
Unit tests in Magento 2
What is a Unit test?
Unit tests are one of the quality tests used for testing a single unit of PHP code in isolation. They are usually written during development using test-driven development (TDD). For more information, check Magento testing guide.
Unit test goals
Below there are some of the most important unit test goals:
- Test individual units to define what one or another part of code is responsible for;
- Create regression tests that help to demonstrate that the entire system still works (or not) after changes;
- Detection of problems in early stages.
Unit test value
The greatest value for a store owner is that the extension works as promised. For a developer the greatest value comes with assessing:
- Whether the extension/store is stable at any given moment;
- Environment-specific bugs;
- Simple module customization;
- Development quality;
- Minimum amount of setup;
- Code coupling and store component cross-dependencies.
Are all Magento 2 extensions come with unit tests?
Most Aheadworks Magento 2 extensions come with unit tests. Once the extension is installed the test can be run to prove and control that the most important business-logic-related parts of the specific module are functioning well.