Magento How-to: Testing Magento Modules

I’m sure a lot of Magento developers would agree that testing your models when creating a Magento module can be a bit difficult.

During the development of Meanbee’s Royalmail and Shipwire modules I have found the following script handy:

I simply make a file, Test.php, in my module folder, app/code/community/Meanbee/Shipwire, for example, and then navigate to the file with my web browser, remembering to allow it through the .htaccess (and switch it back again). I then have access to the entire Magento class hierarchy along with any site specific settings to which I can perform arbitrary commands.

(EDIT: Remember that you could enable the profiler, set the development environment and enable the error reporting by placing those lines in your /index.php and feel the effects site wide.)