In Magento 2, All the core module uses PHPUnit test for verify code is working or not with an automated PHP unit test framework.
As a professional developer, You should write Unittest for each of your module’s logical file.
I will generate a Unit test for Factory Pattern where function return collection based on custom conditions on collection factory. Continue reading “Phpunit test for factory collection in Magento 2.”