Book Image

Magento PHP Developer????s Guide, 2nd Edition

By : Allan MacGregor
Book Image

Magento PHP Developer????s Guide, 2nd Edition

By: Allan MacGregor

Overview of this book

Table of Contents (16 chapters)
Magento PHP Developer's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Testing Magento


Before we start writing any test, it is important that we understand the concepts related to testing and, more particularly, to each of the available methodologies.

Unit testing

The idea behind unit testing is to write tests for certain areas (units) of our code, so that we can verify that the code works as expected and the function is returning expected values.

 

" In computer programming, unit testing is a method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine if they are fit for use."

 
 --Wikipedia

Another advantage of writing unit tests is that by doing this, we are more likely to write code that is easier to test.

This means that our code tends to be broken down into smaller but more specialized functions. As we continue to write more and more tests, we start building a test suite that can be run against our codebase every time we...