Documentation:
By default, the test suite runs SQL Server in a container using TestContainers.
The container database binds to an arbitrary port to avoid conflicts. Nevertheless, you can force the usage of the standard SQL Server port (1433) with a flag:
mvn test -DcontainerFixedPortYou can test with different SQL Server versions by using Maven profiles:
mvn test -P MSSQL-2019-latest
mvn test -P MSSQL-2022-latest
mvn test -P MSSQL-2025-latestOr by passing the version property directly:
mvn test -Dmssql-container.version=2019-latestThe following versions are supported:
-
2019-latest -
2022-latest -
2025-latest(default)
You can start external database instances:
cd docker
docker compose upThen run tests against it:
mvn test \
-Dconnection.uri=sqlserver://SA:A_Str0ng_Required_Password@localhost:1433 \
-Dtls.connection.uri=sqlserver://SA:A_Str0ng_Required_Password@localhost:1435 \
-Dforce.encryption.connection.uri=sqlserver://SA:A_Str0ng_Required_Password@localhost:1437 \
-Dstrict.encryption.connection.uri=sqlserver://SA:A_Str0ng_Required_Password@localhost:1439?encrypt=strict-
connection.uri: connection uri of the database to use for all other tests -
tls.connection.uri: connection uri of the database to use forMSSQLEncryptionTest -
force.encryption.connection.uri: connection uri of the database to use forMSSQLForcedEncryptionTest -
strict.encryption.connection.uri: connection uri of the database to use forMSSQLStrictEncryptionTest