You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Classic project format using <PackageReference> tags
.feature.cs files are generated using
SpecFlow.Tools.MsBuild.Generation NuGet package
Test Execution Method
Visual Studio Test Explorer
SpecFlow Section in app.config or content of specflow.json
No response
Issue Description
Hi,
I am using Autofac plugin for dependency injection. I am trying to register dependencies in a static method tagged with GlobalDependencies by following the Autofac Document
The registered dependencies are not getting resolved in BeforeTestRun
Steps to Reproduce
public sealed class GlobalHooks
{
[GlobalDependencies]
public static void CreateGlobalContainer(ContainerBuilder containerBuilder)
{
DependencyInjector.RegisterGlobalDependencies(containerBuilder);
Log.Logger = new LoggerConfiguration()
.WriteTo.Console()
.CreateLogger();
}
[BeforeTestRun]
public static void InitializeTestRun(ITestLogger testLogger)
{
testLogger.Log("Log is from before test run");
}
}
public static class DependencyInjector
{
public static void RegisterGlobalDependencies(ContainerBuilder containerBuilder)
{
var services = RegisterServicesWithSerivceCollection();
containerBuilder.Populate(services);
}
private static IServiceCollection RegisterServicesWithSerivceCollection()
{
var services = new ServiceCollection();
services.AddTransient<ITestLogger, TestLogger>();
return services;
}
}
Link to Repro Project
No response
The text was updated successfully, but these errors were encountered:
Is this a sequence of events problem for you (GlobalDependenies runs but after BeforeTestRun) or GlobalDependencies doesn't run at all? For me I don't see GlobalDependencies fire at all while ScenarioDependencies fires as expected.
SpecFlow Version
3.9.0
Which test runner are you using?
xUnit
Test Runner Version Number
2.5.1
.NET Implementation
.NET 6.0
Project Format of the SpecFlow project
Classic project format using
<PackageReference>
tags.feature.cs files are generated using
SpecFlow.Tools.MsBuild.Generation NuGet package
Test Execution Method
Visual Studio Test Explorer
SpecFlow Section in app.config or content of specflow.json
No response
Issue Description
Hi,
I am using Autofac plugin for dependency injection. I am trying to register dependencies in a static method tagged with GlobalDependencies by following the Autofac Document
The registered dependencies are not getting resolved in BeforeTestRun
Steps to Reproduce
Link to Repro Project
No response
The text was updated successfully, but these errors were encountered: