Running API and UI tests
Yoda uses pytest for API and UI tests.
Running tests on the allinone VM
In order to run the tests on the Vagrant-based development environment, the allinone (default) Vagrant configuration automatically mounts the /etc/irods/yoda-ruleset
directory in the VM on the ./test directory.
- To run the UI tests you need Firefox 102 ESR or later.
- Ensure that you have geckodriver 0.32.0 installed for running the UI tests.
- Create the development VM using Vagrant:
vagrant box update && vagrant up
- Deploy the VM. In order to be able to complete the vault publication tests, you will need to pass Datacite test credentials when deploying the playbook. For example:
ansible-playbook -i environments/development/allinone playbook.yml --extra-vars 'datacite_username=MYUSERNAME datacite_password=MYPASSWORD' -D
If no Datacite test credentials are available, it is also possible to deploy the allinone VM without providing values for the Datacite parameters. In that case, the vault publication tests will fail. For example:
ansible-playbook -i environments/development/allinone playbook.yml -D
On a Windows host first SSH into the Ansible controller virtual machine (skip this step on GNU/Linux or macOS):
vagrant ssh controller cd ~/yoda
- Deploy the test data on the VM:
ansible-playbook -i environments/development/allinone test.yml -D
- Clone the yoda-ruleset repository and install the test dependencies
git clone https://github.com/UtrechtUniversity/yoda-ruleset.git cd yoda-ruleset/tests python3 -m pip install -r requirements.txt
- Run the tests (in the
yoda-ruleset/tests
directory)test -d /tmp/cache || mkdir -p /tmp/cache python3 -m pytest -o cache_dir=/tmp/cache