Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 102 additions & 55 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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": {
Expand Down Expand Up @@ -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<TExtension>()`.
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<MyExtension>()` or `EnsureExtension(new MyExtension())` to register an extension.
- Built-in extensions :
- Core
- `OutputConfigurationExtension<TOutputConfiguration>` : Provide a way to output configuration. Included in `Infrastructure` base class.
- `SettingsExtension<TSettings>`: 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<TOutputConfiguration>` : Provide a way to output configuration. Included in
`Infrastructure` base class.
- `SettingsExtension<TSettings>`: 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
Expand All @@ -129,44 +152,59 @@ 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<TOutputConfiguration, TSettings>`: 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<TContainer>`: Base class for testcontainers powered infrastructure. Takes a `IDatabaseContainer`.
- `ExternalDatabaseInfrastructure<TOutputConfiguration, TSettings>`: 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<TContainer>`: 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.

#### 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
Expand All @@ -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

Expand All @@ -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.

Expand All @@ -230,24 +271,30 @@ 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<TConfig>`.
- Fixed a bug where the configuration was erased when using an object as the configuration in
`AsyncConfiguredEnvironment<TConfig>`.

## v2.1.0

### ✨ Features

- 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<TConfig>`**: 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<TConfig>`**: 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).
4 changes: 4 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<VersionPrefix>5.0.0</VersionPrefix>
<NuGetAudit>true</NuGetAudit>
<NuGetAuditLevel>high</NuGetAuditLevel>
<NuGetAuditMode>all</NuGetAuditMode>
<WarningsAsErrors>$(WarningsAsErrors);NU1903;NU1904</WarningsAsErrors>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<PackageVersion Include="coverlet.collector" Version="8.0.1" />
<PackageVersion Include="Dapper" Version="2.1.72" />
<PackageVersion Include="FakeItEasy" Version="9.0.1" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="10.0.5" />
<PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="10.0.5" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.5" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.5" />
Expand Down Expand Up @@ -39,4 +39,4 @@
<PackageVersion Include="NUnit" Version="4.3.2" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>
</Project>
</Project>
3 changes: 3 additions & 0 deletions NotoriousTest.sln.DotSettings.user
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
&lt;Project Location="C:\Repositories\Notorious Test" Presentation="&amp;lt;src&amp;gt;\&amp;lt;5. Samples&amp;gt;" /&gt;&#xD;
&lt;/Or&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=9b916838_002D7187_002D42e8_002D89d3_002Dd272d964e16d/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from &amp;lt;src&amp;gt;\&amp;lt;4. Tests&amp;gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Solution /&gt;&#xD;
&lt;/SessionState&gt;</s:String>



Expand Down
2 changes: 1 addition & 1 deletion NotoriousTest.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<File Path="Documentation/4-example.md" />
<File Path="Documentation/5-architecture.md" />
<File Path="Documentation/Architecture/workspace.dsl" />
<File Path="NotoriousTest/LICENSE.txt" />
<File Path="LICENSE.txt" />
<File Path="README.md" />
</Folder>
<Folder Name="/Docs/Templates/">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<NuGetAuditSuppress Include="https://github.com/advisories/GHSA-2m69-gcr7-jv3q" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NotoriousTest.SqlServer" />
Expand Down
Loading