Creating StandAlone Executable Tests

From MozillaWiki
Jump to: navigation, search

There are many tests in the source that are written in C or in C++. Some of these are fairly recent and some are very old. Picking a random test and modifying it will probably not help create a test that will integrate well into the testing architecture that Mozilla is trying to create.

Please consider following some guidelines for your test so that it can be run in an automated manner and so that it will not be a source of concern or worry to others in the community.

First, make sure that your executable returns a non-zero value if any tests fail. Please do not just log errors and return 0 if "most tests" pass. If the tests pass, then that should mean that all tests pass. If there are tests that may be optionally ignored, there are better ways to do that than ignoring a failure.

Second, use logging that can be quiet or verbose, based on the needs of the person running the test. Consider using NSPR logging, which allows you to create a namespace for your log entries and allows people to filter by message priority.

Examples will be available soon....