A set of Splinter-based tests of Rocket.Chat and some Hubot scripts.
The set of tests includes:
- the general tests for Rocket.Chat;
- the tests for the following Hubot scripts:
Some of the general Rocket.Chat tests are related to the clipboard, so install xclip. On Debian or Ubuntu:
$ sudo apt-get install xclip
On Fedora:
$ sudo dnf install xclip
Clone the git repository and build the Docker image:
git clone https://github.com/tolstoyevsky/rocketchat-tests-based-on-splinter.git
cd rocketchat-tests-based-on-splinter/docker
make
Clone the git repository and install the dependencies:
git clone https://github.com/tolstoyevsky/rocketchat-tests-based-on-splinter.git
cd rocketchat-tests-based-on-splinter
pip3 install -r requirements.txt
You have the following options:
- run only the general Rocket.Chat tests;
- run the general Rocket.Chat tests with either all the available Hubot scripts tests (see Features) or only with specified ones.
To run only the general Rocket.Chat tests, go to the root of the project and execute
./run_tests.sh -s rc
To run the general Rocket.Chat tests with all the available Hubot scripts, execute
./run_tests.sh -s all
To specify a particular Hubot script test, play with the -s
option. In the following example the general Rocket.Chat tests will be run only with the hubot-happy-birthder tests.
./run_tests.sh -s happy_birthder_script
Note, that the name of the target test is the name of its Python module without the _tests.py
prefix.
To run all the available tests in the Docker container, execute
./run_tests_in_container.sh
To see only the logs related to the tests, execute
./run_tests_in_container.sh logs
In comparison with run_tests.sh
all the magic in run_tests_in_container.sh
is done not via the command line, but via the docker/docker-compose.yml
file. So, in order to specify a particular Hubot script test and run it in the Docker container, edit the command
parameter. Under the hood the value of the parameter will be passed to run_tests.sh
, so have a look at the examples above.
When the tests are done or you simply want them to be interrupted, execute
./run_tests_in_container.sh down
The tests can be configured via the following environment variables (called parameters) which can be passed via either the env
program or the .env
file.
All the parameters mentioned below are mandatory, so don't forget to provide the values for the parameters which don't have default values.
Parameter | Description | Default |
Rocket.Chat | ||
ADDR | Domain or IP of the Rocket.Chat host. | 127.0.0.1 |
BOT_NAME | Name that will be used as a bot name (for Docker container only). | meeseeks |
PORT | Port the Rocket.Chat server listens on. | 8006 |
USERNAME | Username of an administrator on the server. | |
PASSWORD | Password of an administrator on the server. | |
PYTHON | Python interpreter which will be used for running the tests. | python3 |
RUNNING_WAIT | Number of seconds that tests will be waiting for the bot running (for Docker container only). | 120 |
hubot-pugme | ||
PUGS_LIMIT | Maximum number of pugs. | 5 |
hubot-happy-birthder | ||
WAIT | Amount in second which test script is waiting for hubot reaction. | 100 |
Note that the tests are very sensible to:
- the condition of the database. It's recommended to have as compact database as possible to run the Hubot scripts.
- the local configuration of the Hubot scripts you want to test and especially to the timers. We provide some recommended configuration of them to make the tests run:
Parameter | Recommended value | |
---|---|---|
hubot-happy-birthder | ||
Ensure that the most of the hubot-happy-birthder parameters are set to default values. See the description for all the parameters related to the script in its original README. | ||
HAPPY_REMINDER_SCHEDULER | /1 * * * * * | |
CREATE_BIRTHDAY_CHANNELS | true | |
hubot-viva-las-vegas | ||
Ensure that the most of the hubot-viva-las-vegas parameters are set to default values. See the description for all the parameters related to the script in its original README. | ||
VIVA_REMINDER_SCHEDULER | /1 * * * * * |
See AUTHORS.
rocketchat-tests-based-on-splinter is available under the Apache License, Version 2.0.