ejabberd Test Suites
ejabberd comes with a comprehensive test suite to cover various part of the software platform.
XMPP end-to-end protocol test suite
Running ejabberd test suite
This test suite is a set of end-2-end integration tests that act like XMPP clients connecting with the server and is testing ejabberd at the protocol level. It also contains tests for the various backends that ejabberd supports.
The test suite is modular and can be run in parts (to focus on a group of features) or run for a specific backend.
The environment variable
CT_BACKENDS is used to specify which backend tests to
- mnesia. Typically, Mnesia is included in ejabberd and should always be available for testing.
- sqlite: SQLite is a library available on many systems. However, you must have enabled it in ejabberd at compile time for this to work.
Note: You must build ejabberd with proper backend support for the tests to
work. If the tests fail and you aren't sure why, check the
options to make sure you built ejabberd with adequate backend support.
Note: these tests are e2e tests that operate a full ejabberd instance. So the ports that ejabberd needs must be available for testing. So you can't run an ejabberd instance at the same time you test.
Other options you can use to limit the tests that will be run is to pass a list of groups to test. Some group examples:
- no_db: Runs subgroups
Usually, it is enough to just limit tests with
CT_BACKENDS and let the test
suite decide which relevant tests to run. Sometimes you may want to only focus
on a specific backend, skipping the generic
no_db tests. The "groups" can be
Some example commands for running the XMPP end-to-end test suite are:
CT_BACKENDS=mnesia rebar ct suites=ejabberd CT_BACKENDS=mnesia rebar ct suites=ejabberd groups=mnesia CT_BACKENDS=mnesia rebar ct suites=ejabberd groups=generic
If you have every backend configured, you can run all the tests with:
Test suite conventions
The records used in test suite are autogenerated and come from
tools/xmpp_codec.hrl. This is handy to match packets/results against expected
ejabberd depends on a lot of dependent modules. The dependencies can be tested independently by checking them out and running their test suites directly.
Build test status
We run tests for ejabberd and dependencies automatically via Github Actions. We have a Dashboard available on Github to check the overall test status for all projects: ProcessOne Github Dashboard