reqnroll / Reqnroll

Open-source Cucumber-style BDD test automation framework for .NET.
https://reqnroll.net
BSD 3-Clause "New" or "Revised" License
310 stars 32 forks source link

Add Microsoft.Extensions.DependencyInjection integration plugin #94

Closed mbhoek closed 1 month ago

mbhoek commented 3 months ago

As discussed in #19, this PR adds the Microsoft.Extensions.DependencyInjection integration plugin taken from https://github.com/solidtoken/SpecFlow.DependencyInjection/commit/daa540946a7024cae2fbd7027deecc82eca30cb2.

iunal commented 2 months ago

Hi @mbhoek,

Thank you for your great effort. Could you kindly give an update?

mbhoek commented 2 months ago

@gasparnagy Status update: the plugin in this PR is a direct copy of my original plugin with the namespaces adjusted. As such, it works and is ready to be merged.

However I wanted to include (new) unit tests and align the way the plugin works with how the Autofac plugin handles Global/Feature/Scenario dependencies. This has been a long standing wish of mine, because I'm not completely satisfied with how the original plugin does Feature/Scenario dependencies. It would also introduce some breaking changes in how the plugin works, which make sense to do now because we're including it in Reqnroll for the first time.

Unfortunately this turned out into a complete rewrite of the plugin, which is taking a lot longer than expected (also due to limited time). I do like where it's heading though so I would like to keep working on it. I also understand that the community is getting anxious/is waiting for this plugin, so I would like to discuss what the best next step is.

phatcher commented 2 months ago

How about a simple first pass that aligns with the current, and then the second version with the breaking changes?

Could have a common interface but different names so people can adopt when they have bandwidth

mbhoek commented 2 months ago

I guess that's a solution and maybe the preferred one for Reqnroll's progression.

@gasparnagy Are you okay with me submitting this PR without the unit tests and aligning with Autofac's scopes (i.e. the first two items on this PRs todo list)? I could then introduce the breaking changes for the v2 milestone you already created.

gasparnagy commented 2 months ago

@mbhoek sure. let's include it without the bigger changes and we will add them later

robertcoltheart commented 2 months ago

Just to chip in, could you consider a shorter nuget package name? For example, lots of package authors use <name>.DependencyInjection

For example:

Xunit.DependencyInjection
Npgsql.DependencyInjection
EventFlow.DependencyInjection
RavenDB.DependencyInjection

and so on.

gasparnagy commented 1 month ago

@robertcoltheart The naming here is really painful, because "DependencyInjection" is such a generic name, but the correct name is too long... We have discussed about it here and decided on this long name. In our case Reqnroll.DependencyInjection is quite misleading, because Reqnroll has its own dependency injection solution. I think there is no good solution here. Let's stick to the looooong name for now. 😟

gasparnagy commented 1 month ago

@mbhoek I have fixed the merging problems and ported the docs from https://github.com/solidtoken/SpecFlow.DependencyInjection#usage. I will merge this PR now, as I would like to make a release. We can keep improving it of course. I have made some unit tests for the Autofac plugin (see https://github.com/reqnroll/Reqnroll/blob/main/Tests/Reqnroll.PluginTests/Autofac/AutofacPluginTests.cs), maybe based on that we can also make some for this. But let's keep that for another PR.

Thx for the contribution!

mbhoek commented 1 month ago

Thanks again for taking the time to take this across the finish line @gasparnagy -- wish I could've been more helpful, but glad that the plugin is now part of Reqnroll! 👍

bhugot commented 1 month ago

Thanks to both of you, @gasparnagy any ETA for the nuget package?

gasparnagy commented 1 month ago

@bhugot in a few hours...

iunal commented 1 month ago

Thank you @mbhoek and @gasparnagy