Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Unit test API

From MoodleDocs
Revision as of 11:28, 19 June 2006 by Tim Hunt (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The purpose of unit testing is to test the individual parts of the program (functions, and methods of classes) to make sure that each individually does the right thing. Once unit testing has given you the confidence that each part works, then you should use other forms of testing to ensure that the different parts work together properly.

Running the unit tests in Moodle

  1. Log in with an admin account.
  2. Go to the admin screen.
  3. Near the bottom of the menu, there is a link to run the unit tests.

Writing new tests

Changes to your existing code to make it work with unit testing

More about unit testing in general

The best book I know about unit testing is 'Pragmatic Unit Testing in Java with JUnit by Andrew Hunt and David Thomas. I know, this book is not called Pragmatic Unit Testing in PHP with SimpleTest. However, it is an excellent book. Short, to the point, and very practical. And most of what it says is not specific to Java and JUnit. It is obvious how to apply it all to our situation.