View on GitHub

cookbook

🍲 A library for all your recipes

Automated testing

There are automated test frameworks in place in order to make regressions during development less likely. This section should describe the related tools and also provide an in-depth view for future enhancements.

Backend testing

The backend has an automated testing environment prepared. It is located under .github/actions/run-tests. The same code can be used for both automated testing on the development machines as well as on the GitHub actions in place.

In the folder .github/actions/run-test there is the python script run-locally.py present. This script serves as a user interface to allow the tests to be carried out on demand. For a detailed description of the options, please see ./run-locally.py --help. This will provide you with a list of options the script understands.

So allow any future enhancements and bug tracking, there is some sort of documentation in place. The overview of the backend testing framework should give a general idea of the involved steps.

Quick start

These instructions will help you quickly get set up for testing using the default options. If you would like to learn more or use non-default options, you may read Overview over the backend testing implementation.

  1. Install Docker (e.g. sudo apt install docker). Nextcloud will be installed in Docker for testing.
  2. Install PHP and some extensions: sudo apt install php php-zip php-xml
  3. Install Composer, the PHP package manager (e.g. sudo apt install composer)
  4. Although this app is written in PHP and JavaScript, the test helpers are written in Python. Please install Python 3.
  5. Install PHP dependencies: composer install
  6. Open testing directory: cd .github/actions/run-tests/.
  7. Create a Python virtual environment: python -m venv venv.
  8. Activate the virtual environment: source venv/bin/activate.
  9. Install Python dependencies: pip install -r ./requirements.txt.
  10. Pull required Docker images: ./run-locally.py --pull.
  11. (optinal) If you are running different instances (NC server versions) of the framework, give them a unique name in the file .env. Do not commit this.
  12. Build the docker containers finally: ./run-locally.py --create-images.
  13. Create and activate a testing fixture: ./run-locally.py --create-fixture stable25 stable25 --activate-fixture stable25. The default uses MariaDB and you might consider adding --use-db-dump.
  14. Start the helper containers (like DB) of the environment via ./run-locally.py --start-helpers.
  15. Run the tests: ./run-locally.py --run-default-tests.

Frontend testing

There is not yet any automated tests for the frontend in place.