- Visual Studio 2022, JetBrains Rider or Visual Studio Code,
If you want to test against real database servers (recommended for comprehensive testing):
- Microsoft SQL Server
- PostgreSQL
- MySQL
In the root of the project:
- Optional: Copy
TestUsingPluggableComponentCombinations.exampletoTestUsingPluggableComponentCombinations- If you don't create this file, it will be automatically created from the example during the first build
- By default, tests run using SQLite in-memory with no required configuration.
- Edit this file to configure which database servers the tests run against
- To test against external databases, uncomment the desired combinations in the config file
Open src/Compze.AllProjects.slnx in Visual Studio 2022 or Rider.
If you want to test against external database servers, you may need to configure connection strings.
By default, if SQL Server tests are enabled, they use this connection string:
Data Source=localhost;Initial Catalog=master;Integrated Security=True;TrustServerCertificate=True;
If this connection string works for you, you're good to go!
If you need to use different connection strings, set these environment variables:
COMPOSABLE_SQL_SERVER_DATABASE_POOL_MASTER_CONNECTIONSTRING
COMPOSABLE_PGSQL_DATABASE_POOL_MASTER_CONNECTIONSTRING
COMPOSABLE_MYSQL_DATABASE_POOL_MASTER_CONNECTIONSTRING
Compze_DatabasePool_
These databases are used by the test database pool and will be automatically managed by the test infrastructure.
If tests are failing due to performance expectations on your machine, you can adjust the performance threshold using the COMPOSABLE_MACHINE_SLOWNESS environment variable.
This environment variable lets you adjust the expectations for the performance tests.
Example: If you set it to 2.0, performance tests are allowed to take 2.0 times as long to complete without failing.
Edit TestUsingPluggableComponentCombinations to control:
- Which persistence layers to test (SQLite in-memory by default, can enable SQL Server, PostgreSQL, MySQL, file-based SQLite)
- Which dependency injection containers to test (Microsoft DI, SimpleInjector)
- Other pluggable component combinations
- Clone the repository
- Open the solution
- Run tests
- Start coding!
If tests fail with database connection errors
- Verify your SQL server is running
- Check that the connection string is correct
- Ensure you have appropriate permissions to create databases
- Quick fix: Switch back to SQLite in-memory by editing
TestUsingPluggableComponentCombinationsto only enableSqliteMemory:Microsoft
If performance tests are failing:
- Set
COMPOSABLE_MACHINE_SLOWNESSto a higher value (e.g.,2.0or3.0) - Close other resource-intensive applications
- Check if background processes are affecting performance
The documentation website is in the Website/ directory and uses DocFX.
See Website/README.md for instructions on building and running the documentation locally.