Skip to content

Testing and Migrations

Running Tests

Unit and component tests run without extra infrastructure:

dotnet test

Functional tests require PostgreSQL. Start it locally before running the suite:

docker run -d --name hyperpath-test-db -e POSTGRES_USER=hyperpath -e POSTGRES_PASSWORD=hyperpath -p 50035:5432 postgres:16

If the container already exists but is stopped:

docker start hyperpath-test-db

The test factory creates and tears down HyperPathTestDB and TenantTestDB automatically.

Build, Test, and Format in One Step

BuildTestFormat.cs is a single-file app that starts the test database container, runs the tests, and verifies formatting.

dotnet BuildTestFormat.cs

Database Migrations

Migrations are stored in HyperPath.Web.

Applying Migrations

Aspire runs migrations automatically through HyperPath.MigrationService.

For manual application:

scripts/apply-migrations.sh

Adding Migrations

scripts/add-migration.sh {DbContextName} {NewMigrationName}

Locating the Connection String

Because Aspire provisions the database with generated ports and credentials, open the Aspire dashboard, choose the Web application, and copy ConnectionStrings__HyperPathDB.

The migration scripts read that environment variable if it is already set in the shell.