CloudServices/Sync/FxSync/Archived/Testing

From MozillaWiki
Jump to: navigation, search

Back to Labs/Weave.

Running Tests

Weave's code repository includes a variety of tests. Some of these are XPCShell-based unit tests, while others are Python-based. Some tests are "logtests", which compare the logfile output of test code with a canonical representation. There's also a set of compliance tests for Weave servers.

All tests can be automatically found and run by executing the following command at the root of the repository:

 python scripts/runtests.py

The above command also automatically runs the compliance tests against the reference server, so make sure that the reference server's default port is free before running the tests (there's no need to start the reference server, the testing suite does that part for you).

Writing Tests

For information about writing new xpcshell-based tests, see tests/readme.txt in the Weave HG repository.

Engine Sync Tests

One particularly useful type of test to write is a test for a particular data type engine. There's a number of fake/stub implementations of "real" services that can help developers create engine tests as easily as possible. For examples, check out tests/unit/test_password_syncing.js and tests/unit/test_bookmark_syncing.js.