docs.ejabberd.im

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 CT_BACKENDS environment variable specifies which backend tests to run. Current CT_BACKENDS values:

  • extauth
  • ldap
  • mnesia
  • mssql
  • mysql
  • odbc
  • pgsql
  • redis
  • sqlite

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 configure build options to make sure ejabberd is compiled 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 groups examples:

  • no_db: Runs subgroups generic and test_proxy65.
  • component
  • extauth
  • ldap
  • mnesia
  • mssql
  • mysql
  • pgsql
  • redis
  • s2s
  • sqlite

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.

Some example commands for running the XMPP end-to-end test suite using rebar and rebar3 ct:

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
CT_BACKENDS=mnesia rebar3 ct --suite=test/ejabberd_SUITE --group=offline_flex,offline_send_all
CT_BACKENDS=redis  rebar3 ct --suite=test/ejabberd_SUITE --group=offline_flex,offline_send_all

If you have every backend configured, you can run all the tests with:

make test

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 values.

Dependency tests

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