Comments (4)
Same problem here, we can't use Autofac and run tests in parallel when the FeatureContext or ScenarioContext is injected in the constructors. We need either to stop using Autofac, or remove the FeatureContext dependencies.
@finaruioana did you found any solution to the problem yet?
from specflow.autofac.
I really wish this plugin handled this stuff for you. The plugin should include an extension method so you could do something as simple as:
builder.RegisterSpecFlowTypes();
For ScenarioContext, the following is working for me in limited testing.
builder.Register(_ => ScenarioContext.Current).InstancePerDependency().ExternallyOwned();
There's likely still a race condition here, but this is the best I could do without really digging deep into both the source of this plugin and SpecFlow itself. :(
This plugin severely needs support for context injection. As is, it entirely replaces BoDi and thus breaks existing conventions.
from specflow.autofac.
Oh God I'm waiting since so long for this plugin to support context injection with AutoFac
@gasparnagy Is there any way you can make it possible in Specflow.AutoFac plugin to inject FeatureContext and ScenarioContext ?
from specflow.autofac.
Hi,
I am trying to enable running tests in parallel, but I cannot seem to make it work.
I had an AfterScenario hook which initially was verifying the static ScenarioContext.Current.TestError value.
All the DI registration is made using Specflow.Autofac package.After upgrading NUnit to version 3.6.1, it threw an exception complaining about the use of this static ScenarioContext with a link to http://specflow.org/documentation/Parallel-Execution/
I made the update in my step class as in above link:
`
[Binding]
public class StepsWithScenarioContext
{
private readonly ScenarioContext scenarioContext;public StepsWithScenarioContext(ScenarioContext scenarioContext) { if (scenarioContext == null) throw new ArgumentNullException("scenarioContext"); this.scenarioContext = scenarioContext; } [AfterScenario] public void AfterScenario() { if (_scenarioContext.TestError != null) //do something }
}
`But now, the below exception is thrown:
Cannot resolve parameter 'TechTalk.SpecFlow.ScenarioContext scenarioContext'
I tried to find a way to register this scenario context into my DI, but wasn't able to find a way.
Did anyone else had this issue?
Is there a way to register the ScenarioContext into Specflow.Autofac registration?Thank you and happy coding!
@finaruioana @davidvesely @wekempf Still no resolution,
Have you tried asking this question in new specflow respository issue tracking ?
from specflow.autofac.
Related Issues (16)
- "Unable to find scenario dependencies!" thrown when using an external step assembly HOT 5
- Add [FeatureDependencies] attribute HOT 2
- Registered dependencies are not disposed HOT 3
- Tests fail when running in parallel HOT 1
- Specflow.Autofac with Specflow 2.2
- Specflow 2.2 HOT 5
- System.Typeload Exception: Could not load type TechTalk.Specflow.Infrastructre.IBindingInstanceResolver from assemble TechTalk.Specflow Version 2.2.0.0 HOT 2
- Cannot resolve ScenarioInfo HOT 5
- Lifetime is Incorrect HOT 1
- Support SpecFlow 2.2 HOT 1
- Plugin doesn't work when using FeatureContext on BeforeFeature Hook constructor HOT 17
- Support for multitenant dependency injection
- Support Autofac plugin for Specflow V3 HOT 1
- .Net Core with NuGet - The type or namespace name could not be found
- Static access to built IContainer HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from specflow.autofac.