Skip to content
Ondrej Kosarko edited this page Jun 19, 2024 · 2 revisions

There are many tests in dspace. Unit tests for both backend and frontend as well as integration tests. Then there are tests that run as Github actions.

UI test scenarios

TODO

Frontend Github actions tests

Tests are run from this docker compose. In service dspacedb there is environment variable LOADSQL that loads SQL script which contains database dump. Tests will be run on this database.

It is possible to change it by uploading it into this release.

It was necessary to change entrypoint into service dspace, in order to create new metadata fields (added force after dspace database migrate).

Test database migrations

Database migrations are in following folder (and subfolders) dspace-api/src/main/resources/org/dspace/storage/rdbms/sqlmigration. Subfolder postgres is used when dspace is installed and deployed, h2 is used for tests with in-memory database. If migration is added to postgres, it needs to be added to h2 as well.

Delete and create database

  1. Drop database in pgAdmin or use command dropdb --username=postgres dspace (with appropriate username)
  2. In PostgreSQL\13\bin: createdb --username=postgres --owner=dspace --encoding=UNICODE dspace
  3. Create extension pgcrypto psql -U postgres -d dspace -c "CREATE EXTENSION pgcrypto"
  4. In [dspace]/bin/ dspace database migrate
  5. Create new admin: dspace create-administrator

How to run test using InteliJ

Why to do that: Running test time:

  • Using cmd: 90s
  • InteliJ: 40s

Steps:

  1. Edit Configurations
  2. Add -> choose JUnit
  3. Run params: -ea -Ddspace.dir=[dspace-source]/dspace-server-webapp/target/testing/dspace/ -Dsolr.install.dir=.
  4. Option: Shorten command line: JAR manifest

Screenshot: image

Clone this wiki locally