diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c0efad..718e9eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,41 +1,53 @@ ο»Ώ# Changelog ## v5.0.0 + ### ✨ Features - Dependency injection is now at the Environment level - - Create a `IDependencyInjectionConfigurator` - ```csharp - public class DependencyInjectionConfigurator : IDependencyInjectionConfigurator - { - public IServiceCollection ConfigureServices(IServiceCollection services) => services; - } - ``` - - Add a `[InjectionConfigurator(typeof(DependencyInjectionConfigurator))]` to the test class. - - You could add multiple `InjectionConfiguratorAttribute` to the same test class (or parents), they will all be used. - - Add dependencies to the environment/infrastructure constructor ! + - Create a `IDependencyInjectionConfigurator` + ```csharp + public class DependencyInjectionConfigurator : IDependencyInjectionConfigurator + { + public IServiceCollection ConfigureServices(IServiceCollection services) => services; + } + ``` + - Add a `[InjectionConfigurator(typeof(DependencyInjectionConfigurator))]` to the test class. + - You could add multiple `InjectionConfiguratorAttribute` to the same test class (or parents), they will all be + used. + - Add dependencies to the environment/infrastructure constructor ! ### πŸ’₯ Breaking Changes - Deleted support for Extensions, use dependency injection instead. - + ### πŸ› Bug Fixes -- Fixed a bug where SqliteInfrastructure could not delete the file because it was still used by another process. Triggering DoggyDog cleaning. +- Fixed a bug where SqliteInfrastructure could not delete the file because it was still used by another process. + Triggering DoggyDog cleaning. + +### πŸ“¦ Dependencies + +- Upgraded 'Microsoft.Data.Sqlite' and 'Microsoft.Data.Sqlite.Core' to 11.0.0-preview.5.26302.115 because 10.0.5 has a + high + vulnerability on SQlite provider. ## v4.1.1 ### πŸ›  Technical -- Internal packages (such as NotoriousTest.Runtimes|Watchdog|SqliteRegistry|TestSettings) are now includes in NotoriousTest. +- Internal packages (such as NotoriousTest.Runtimes|Watchdog|SqliteRegistry|TestSettings) are now includes in + NotoriousTest. And can no longer be downloaded via Nuget Packages. - ## v4.1.0 ### ✨ Features + - DoggyDog now log when an infrastructure is initialized, reset, or destroyed normally. - You can now use `testsettings.json` to disable DoggyDog for the entire test project. + ```json { "Environment": { @@ -48,6 +60,7 @@ - For debugging purpose, the test suite can now wait for DoggyDog to be launched manually. - Enable this mode by setting `ManualLaunch` to true in the `testsettings.json` file. + ```json { "Watchdog": { @@ -81,40 +94,50 @@ NotoriousTest now has a new mascot, the DoggyDog ! 🐢🐢🐢 DoggyDog is a watchdog that clean infrastructures that may have been left dirty by previous tests, and make sure that your tests are running in a clean environment. -- Introducing DoggyDog - an executable that clean your infrastructures left behind a test campaign that have been killed unexpectedly. +- Introducing DoggyDog - an executable that clean your infrastructures left behind a test campaign that have been killed + unexpectedly. - DoggyDog use a registry to track all your infrastructures, and execute their cleaner. - [Cleaner(CleanerType)] attribute to specify the cleaner of your infrastructures. #### Infrastructure extensions πŸ’₯NEWπŸ’₯ -**Infrastructure extensions** introduce a composition model for adding behaviors to your infrastructures. Instead of creating specialized subclasses to combine multiple concerns (configuration, database seeding, respawn, etc. ) +**Infrastructure extensions** introduce a composition model for adding behaviors to your infrastructures. Instead of +creating specialized subclasses to combine multiple concerns (configuration, database seeding, respawn, etc. ) You register extensions on any infrastructure via `EnsureExtension()`. -Each extension is self-contained, reusable across infrastructures, and hooks into the infrastructure lifecycle through dedicated callbacks such as `OnBeforeInitialize`. - +Each extension is self-contained, reusable across infrastructures, and hooks into the infrastructure lifecycle through +dedicated callbacks such as `OnBeforeInitialize`. - Introducing a new concept called infrastructure extension, meant to be used to react to infrastructure setup. - New interface `IInfrastructureExtension`, provide hooks such as `OnBeforeInitialize` to extends Infrastructure. - Configuration is now handled by extensions classes. - Use `EnsureExtension()` or `EnsureExtension(new MyExtension())` to register an extension. - Built-in extensions : - - Core - - `OutputConfigurationExtension` : Provide a way to output configuration. Included in `Infrastructure` base class. - - `SettingsExtension`: Load from `testsettings.json` your infrastructure configuration. Config key default to infrastructure name, and can be override. - - Database - - `RespawnExtension`: Integration of Respawn package to reset databases between test. - - Included in every database infrastructures by default. + - Core + - `OutputConfigurationExtension` : Provide a way to output configuration. Included in + `Infrastructure` base class. + - `SettingsExtension`: Load from `testsettings.json` your infrastructure configuration. Config key + default to infrastructure name, and can be override. + - Database + - `RespawnExtension`: Integration of Respawn package to reset databases between test. + - Included in every database infrastructures by default. #### Settings πŸ’₯NEWπŸ’₯ + - By registering a `SettingsExtension`, you can now load settings from `testsettings.json` to configure infrastructure. - Automatically loaded from the infrastructure name as config key. #### Output configuration πŸ”§ UPDATED πŸ”§ -- Environments no longer require a global configuration object. Configuration is now propagated automatically through extensions. + +- Environments no longer require a global configuration object. Configuration is now propagated automatically through + extensions. - Output configuration is now handled by an extension built-in Infrastructure base class. - Adding a configuration output will now be made by calling `AddEntry(key, config)`. -- Environment will gather all configuration under all keys and pass to all `IConfigurationConsumer` infrastructures, such as `WebApplicationInfrastructure`. -- `WebApplicationInfrastructure` now maps configuration entries to appsettings format automatically. Generating the section path from the key and config structure. +- Environment will gather all configuration under all keys and pass to all `IConfigurationConsumer` infrastructures, + such as `WebApplicationInfrastructure`. +- `WebApplicationInfrastructure` now maps configuration entries to appsettings format automatically. Generating the + section path from the key and config structure. - e.g. + ```json // Entry: "Example:Test" β†’ { "Host": "localhost", "Port": 5432 } // appsettings.json @@ -129,36 +152,50 @@ Each extension is self-contained, reusable across infrastructures, and hooks int ``` #### Database πŸ’₯NEWπŸ’₯ -- Non docker database infrastructure for SqlServer and PostgreSql have been added ! For those who want to run test on existing servers. + +- Non docker database infrastructure for SqlServer and PostgreSql have been added ! For those who want to run test on + existing servers. - New package NotoriousTest.Database provides base classes for docker and non-docker database infrastructures. -- `ExternalDatabaseInfrastructure`: Base class for non docker database infrastructures, that need a running server to setup. - - `DatabaseSettings` will be loaded directly from the `testsettings.json` file. -- `DockerDatabaseInfrastructure`: Base class for testcontainers powered infrastructure. Takes a `IDatabaseContainer`. +- `ExternalDatabaseInfrastructure`: Base class for non docker database infrastructures, + that need a running server to setup. + - `DatabaseSettings` will be loaded directly from the `testsettings.json` file. +- `DockerDatabaseInfrastructure`: Base class for testcontainers powered infrastructure. Takes a + `IDatabaseContainer`. - SqlServer, PostgreSql and Sqlite packages are using theses classes. ### Dependency Injection πŸ’₯NEWπŸ’₯ -- Environments now expose an internal DI container, configurable via ConfigureInfrastructureServices(IServiceCollection collection). -- Registered services are automatically injected into every infrastructure, removing the need for manual wiring in Initialize. +- Environments now expose an internal DI container, configurable via ConfigureInfrastructureServices(IServiceCollection + collection). +- Registered services are automatically injected into every infrastructure, removing the need for manual wiring in + Initialize. - Available by default: ContextId, ITestSettingsProvider. #### Logging πŸ’₯NEWπŸ’₯ -- NotoriousTest now deliver a `ITestLogger` that is injected directly in the `Infrastructure.Logger` property, and can be accessed from everywhere via DI. +- NotoriousTest now deliver a `ITestLogger` that is injected directly in the `Infrastructure.Logger` property, and can + be accessed from everywhere via DI. - Every framework has it's own `ITestLogger` implementation that is registered in DI. #### Web + - Web support has been moved to `NotoriousTest.Web`. -- `Environment` now has extensions to retrieve the WebApplication or add a WebApplication. You can find them in the `NotoriousTest.Web` packages, under the `NotoriousTest.Web.Environment.WebEnvironmentExtensions`. +- `Environment` now has extensions to retrieve the WebApplication or add a WebApplication. You can find them in the + `NotoriousTest.Web` packages, under the `NotoriousTest.Web.Environment.WebEnvironmentExtensions`. - `WebEnvironment` has been deleted. Use extensions to retrieve/add WebApplication. ### πŸ’₯ Breaking Changes -- Synchronous classes have been removed. All `Async`-prefixed classes have been renamed without the suffix (e.g. `AsyncInfrastructure` β†’ `Infrastructure`). + +- Synchronous classes have been removed. All `Async`-prefixed classes have been renamed without the suffix (e.g. + `AsyncInfrastructure` β†’ `Infrastructure`). - .NET 6 is no longer supported. Minimum target is .NET 8. -- XUnit has been updated to xunit.v3, which introduces breaking changes of its own. See the [xunit.v3 migration guide](https://xunit.net/docs/getting-started/v3/migration). -- Infrastructures are now executed in parrallel if there order are the same. IConfigurationConsumer are run after all infrastructures with the same order. +- XUnit has been updated to xunit.v3, which introduces breaking changes of its own. See + the [xunit.v3 migration guide](https://xunit.net/docs/getting-started/v3/migration). +- Infrastructures are now executed in parrallel if there order are the same. IConfigurationConsumer are run after all + infrastructures with the same order. ### Integrations + #### Sqlite integration πŸ’₯NEWπŸ’₯ - `SqliteInfrastructure` is now available in the `NotoriousTest.Sqlite` package. @@ -166,7 +203,8 @@ Each extension is self-contained, reusable across infrastructures, and hooks int #### Test Frameworks integration πŸ’₯NEWπŸ’₯ - NotoriousTest is now compatible with **NUnit**, **MSTest**, **TUnit**, in addition to **xUnit**. -- Find them within `NotoriousTest.XUnit`, `NotoriousTest.NUnit`, `NotoriousTest.MSTest` and `NotoriousTest.TUnit` packages. +- Find them within `NotoriousTest.XUnit`, `NotoriousTest.NUnit`, `NotoriousTest.MSTest` and `NotoriousTest.TUnit` + packages. - New samples for every frameworks are available in the samples folder. ## v3.1.0 @@ -185,7 +223,8 @@ Each extension is self-contained, reusable across infrastructures, and hooks int ### ✨ Features -- `ConfiguredInfrastructure` and `AsyncConfiguredInfrastructure` are replaced with `IConfigurableInfrastructure` interfaces. Every infrastructures can be marked as configurable just by implementing this interface. +- `ConfiguredInfrastructure` and `AsyncConfiguredInfrastructure` are replaced with `IConfigurableInfrastructure` + interfaces. Every infrastructures can be marked as configurable just by implementing this interface. ### πŸ›  Technical @@ -195,30 +234,32 @@ Each extension is self-contained, reusable across infrastructures, and hooks int ### πŸ› Bug Fixes -- Fixed a bug in **NotoriousTest.SqlServer** where the `SqlServerContainerAsyncInfrastructure` did not changes the database connection to point to the newly created database. +- Fixed a bug in **NotoriousTest.SqlServer** where the `SqlServerContainerAsyncInfrastructure` did not changes the + database connection to point to the newly created database. ## v2.3.0 ### ✨ Features - **NotoriousTest.TestContainers** is now available as a separate package. - - Provides a simple way to use TestContainers in your tests. - - For more information, see the [Advanced Functionalities - TestContainers](./README.md#testcontainers). + - Provides a simple way to use TestContainers in your tests. + - For more information, see the [Advanced Functionalities - TestContainers](./README.md#testcontainers). - **NotoriousTest.SqlServer** is now available as a separate package. - - Provide your tests with a SqlServer ready-to-use infrastructure ! - - For more information, see the [Advanced Functionalities - SqlServer](./README.md#sql-server). + - Provide your tests with a SqlServer ready-to-use infrastructure ! + - For more information, see the [Advanced Functionalities - SqlServer](./README.md#sql-server). ### πŸ›  Technical -- Simplified management of generic types in the `AsyncConfiguredInfrastructure` and `AsyncConfiguredEnvironment` classes. +- Simplified management of generic types in the `AsyncConfiguredInfrastructure` and `AsyncConfiguredEnvironment` + classes. ## v2.2.0 ### ✨ Features - Introduced `ContextId` to uniquely identify infrastructures. For example, you can name your database with it. - - In standalone mode, `ContextId` will be a random GUID. - - Within an Environment, `ContextId` will be the environment identifier `Environment.EnvironmentId` + - In standalone mode, `ContextId` will be a random GUID. + - Within an Environment, `ContextId` will be the environment identifier `Environment.EnvironmentId` - Removal of `IConfigurationProducer` and `IConfigurationConsumer`, as it was not necessary. - `Order` property is now nullable and thus optional. @@ -230,7 +271,8 @@ Each extension is self-contained, reusable across infrastructures, and hooks int ### πŸ› Bug Fixes - Fixed a bug where `EnvironmentId` generated a new GUID on every reference. -- Fixed a bug where the configuration was erased when using an object as the configuration in `AsyncConfiguredEnvironment`. +- Fixed a bug where the configuration was erased when using an object as the configuration in + `AsyncConfiguredEnvironment`. ## v2.1.0 @@ -238,16 +280,21 @@ Each extension is self-contained, reusable across infrastructures, and hooks int - Added the `AutoReset` property to toggle infrastructure reset on or off. -For more information, see the [Advanced Functionalities - Advanced control over Infrastructure Reset](./README.md#advanced-control-over-infrastructure-resets) +For more information, see +the [Advanced Functionalities - Advanced control over Infrastructure Reset](./README.md#advanced-control-over-infrastructure-resets) ## v2.0.0 ### ✨ Features : - **Complete overhaul of configuration management:** - - **`AsyncConfiguredInfrastructure`** and **`AsyncConfiguredInfrastructure`**: Provides access to the `Configuration` property via an infrastructure. - - **`IConfigurationConsumer`** and **`IConfigurationProducer`**: Used to indicate whether a component consumes or produces configuration. - - **`AsyncConfiguredEnvironment`**: An environment managing the provisioning of a global configuration from configuration infrastructures. - - **`WebApplication`** is now automatically provided with configuration by the `AsyncWebEnvironment`. - -For more information, see the [Advanced Functionalities - Configuration](./README.md#configuration) and [Advanced Functionalities - Web](./README.md#web). + - **`AsyncConfiguredInfrastructure`** and **`AsyncConfiguredInfrastructure`**: Provides access to the + `Configuration` property via an infrastructure. + - **`IConfigurationConsumer`** and **`IConfigurationProducer`**: Used to indicate whether a component consumes or + produces configuration. + - **`AsyncConfiguredEnvironment`**: An environment managing the provisioning of a global configuration from + configuration infrastructures. + - **`WebApplication`** is now automatically provided with configuration by the `AsyncWebEnvironment`. + +For more information, see the [Advanced Functionalities - Configuration](./README.md#configuration) +and [Advanced Functionalities - Web](./README.md#web). diff --git a/Directory.Build.props b/Directory.Build.props index 4b8f59f..513e3ae 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,5 +9,9 @@ LICENSE.txt README.md 5.0.0 + true + high + all + $(WarningsAsErrors);NU1903;NU1904 diff --git a/Directory.Packages.props b/Directory.Packages.props index 044bf9f..693adcf 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,8 +7,8 @@ - - + + @@ -39,4 +39,4 @@ - + \ No newline at end of file diff --git a/NotoriousTest.sln.DotSettings.user b/NotoriousTest.sln.DotSettings.user index eec3120..4d04c25 100644 --- a/NotoriousTest.sln.DotSettings.user +++ b/NotoriousTest.sln.DotSettings.user @@ -13,6 +13,9 @@ <Project Location="C:\Repositories\Notorious Test" Presentation="&lt;src&gt;\&lt;5. Samples&gt;" /> </Or> </SessionState> + <SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from &lt;src&gt;\&lt;4. Tests&gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <Solution /> +</SessionState> diff --git a/NotoriousTest.slnx b/NotoriousTest.slnx index 6ae3611..ab48a9d 100644 --- a/NotoriousTest.slnx +++ b/NotoriousTest.slnx @@ -11,7 +11,7 @@ - + diff --git a/Samples/NotoriousTest.Sample.With/NotoriousTest.Sample.With.csproj b/Samples/NotoriousTest.Sample.With/NotoriousTest.Sample.With.csproj index ae2a112..864700f 100644 --- a/Samples/NotoriousTest.Sample.With/NotoriousTest.Sample.With.csproj +++ b/Samples/NotoriousTest.Sample.With/NotoriousTest.Sample.With.csproj @@ -7,6 +7,9 @@ false + + +