Run Tests
Testing Scaffolding
InvenioRDM uses pytest framework. Project fixtures are provided by flask-pytest and pytest-invenio modules. Ultraviolet mostly relies on the existing InvenioRDM scaffolding for testing but several Ultraviolet specific fixtures are added and can be found in /test
directory.
Layout
We use test layout recommended in pytest-invenio documentation, e.g. tests are splited into three folders:
tests/ui/
tests/api/
tests/e2e/
Each subfolder holds tests related to a specific application (UI or API). The e2e folder holds tests that need both UI and API application (which is typically the case for end-to-end tests) The E2E tests works by creating both the UI and API applications and using a special WSGI middleware to dispatch requests between both applications.
Prerequisites
Before running E2E make sure that Selenium Client is installed and Chrome Webdriver is installed and added to you path.
Instructions
- Install pipenv development dependencies
pipenv install --dev
- Make sure the application containers are running
invenio-cli services status
- OPTIONAL: Enable end-to-end tests (disabled by default)
export E2E=yes
- OPTIONAL: Chrome driver is used for E2E tests by default. You can switch to Firefox with the following command:
export E2E_WEBDRIVER_BROWSERS="Firefox"
- Run the tests!
pipenv run pytest -p no:cacheprovider
- OPTIONAL: You can (re)run specific tests by specifying the path, e.g.,
pipenv run pytest -p no:cacheprovider tests/ui