-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Hi all,
I have class like this:
public class TestDependencies
{
[ScenarioDependencies]
public static IUnityContainer CreateContainer()
{
// create container with the runtime dependencies
var container = CreateContainer();
//TODO: add customizations, stubs required for testing
// Registers the build steps, this gives us dependency resolution using the container.
// NB If you need named parameters into the steps you should override specific registrations
container.RegisterTypes(typeof(TestDependencies).Assembly.GetTypes().Where(t => Attribute.IsDefined(t, typeof(BindingAttribute))), WithMappings.FromMatchingInterface, WithName.Default, WithLifetime.ContainerControlled);
return container;
}
}
I am trying to use it like this:
[Binding]
public class FrameworkHooks
{
private readonly IUnityContainer objectContainer;
protected static DriverContext DriverContext { get; } = new DriverContext(AppDomain.CurrentDomain.BaseDirectory);
public static TestLogger LogTest { get; } = DriverContext.LogTest;
private static HtmlReporter HtmlReporter { get; } = DriverContext.HtmlReporter;
public FrameworkHooks()
{
this.objectContainer = TestDependencies.CreateContainer();
}
[BeforeTestRun]
public static void BeforeTestRun()
{
HtmlReporter.CreateReport();
}
[BeforeFeature]
public static void BeforeFeature()
{
HtmlReporter.CreateFeatureContext(FeatureContext.Current.FeatureInfo.Title);
}
[BeforeScenario]
public void BeforeTest()
{
DriverContext.ScenarioTitle = ScenarioContext.Current.ScenarioInfo.Title;
DriverContext.FeatureTitle = FeatureContext.Current.FeatureInfo.Title;
this.objectContainer.RegisterType<IButton, Button>();
this.objectContainer.RegisterInstance(DriverContext.Driver);
DriverContext.Start(this.objectContainer);
DriverContext.NavigateToApp();
DriverContext.WindowMaximize();
LogTest.LogTestStarting(DriverContext.ScenarioTitle);
HtmlReporter.CreateScenarioContext(ScenarioContext.Current.ScenarioInfo.Title);
}
But i get error when try to run tests [01.04.2019 11:26:38 Error] The active test run was aborted. Reason: Process is terminated due to StackOverflowException.
// create container with the runtime dependencies
var container = Dependencies.CreateContainer();
What is Dependencies in that line?
Metadata
Metadata
Assignees
Labels
No labels