-
Notifications
You must be signed in to change notification settings - Fork 11
ITestOutputHelper unavailable when using SpecFlow.xUnit #75
Comments
Interesting question @robert-stratecglobal -- although it's not related to the I've created a test which should cover this issue and committed it in the https://github.com/solidtoken/SpecFlow.DependencyInjection/tree/feature/75-ITestOutputHelper branch. Let me know if this truly the issue you're talking about. The challenge imho is to solve this without |
The ISpecflowOutputHelper could be an alternative that would work as well. Isn't there a way to "pickup" what is in the BoDi ? That way, any future enhancement to the DI and any third party plugin would automatically insert as well... |
|
That would make sense @bobbyangers but the current implementation completely replaces BoDi. So either it needs to fall back to BoDi if a dependency cannot be found in Microsoft's I'll investigate the latter. |
Check out Corvus.Testing they have an elegant way of handling the problem.... by using "hooks".... it's possible to "inject" more stuff and even do 'automatically' do some stuff in the background.... |
https://github.com/AdCodicem/SpecFlowMicrosoftDependencyInjection solved it with the public void ConfigureServices(IServiceCollection services)
{
services
// ITestOutputHelper is automatically registered by Specflow when using xUnit runner
.AddDelegated<ITestOutputHelper>() ///!< ------------------
// Calculator can use ITestOutputHelper as it's registered above to delegate the resolution to the original container
.AddTransient<ICalculator, Calculator>();
} Good logging is essential, so I also need the ITestOutputHelper |
@304NotModified Do you mind if I copy/paste your |
It isn't mine ;) |
Right, sorry. @AdCodicem was involved early on but created their own plugin instead, apologies for the mix-up. |
@mbhoek You can do copy anything you need from my repo, I think it's better to have only one project to maintain, and as I started a company of my own, I have less time to spend on my project. If it's ok for you I'll add a message to redirect the users to your project 🙂 |
@AdCodicem Congratulations on starting your own company! I'm happy to keep maintaining this project, I think we've had a couple of great contributions over time. I do however struggle with available time too. I'll take some time this weekend to look at your code and @shlomiassaf 's PR #74 and see how we can make this the best MDI plugin available. Of course I will keep on crediting all contributors. Thanks again! |
Guess this plugin is not the only one struggling with this issue: https://github.com/SpecFlowOSS/SpecFlow/issues/2550 Also want to track this one: https://github.com/SpecFlowOSS/SpecFlow/issues/2353 |
Thank you! Don't hesitate to ask me if you need any help 🙂 |
@AdCodicem I'm trying to figure out whether I want to copy your |
@mbhoek the You can see in this part of the code where the plugin search for Edit: |
@robert-stratecglobal @bobbyangers |
Hi,
We are using SpecFlow.xUnit; is there anyway to add/capture the ITestOutputHelper, in the same way [Binding] are being automatically ?
The text was updated successfully, but these errors were encountered: