Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading xUnit, .NET Test SDK, and SpecFlow.Actions.WindowsAppDriver NuGet packages results in inability to run tests #2691

Open
aronweiler opened this issue Jan 23, 2023 · 1 comment
Labels

Comments

@aronweiler
Copy link

SpecFlow Version

3.9.74

Which test runner are you using?

xUnit

Test Runner Version Number

SpecFlow.xUnit 3.9.74, xUnit 2.4.2

.NET Implementation

.NET 6.0

Project Format of the SpecFlow project

Sdk-style project format

.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

specflow.json:

{
  "$schema": "https://specflow.org/specflow-config.json"
}

specflow.actions.json

{
  "windowsAppDriver": {
    "capabilities": {
      "app": "../../../../WpfExample/bin/Debug/net6.0-windows/WpfExample.exe"
    },
    "WindowsAppDriverPath": "C:\\Program Files (x86)\\Windows Application Driver\\WinAppDriver.exe"
  }
}

Issue Description

After upgrading the NuGet packages on my very simple UI test sample project (see image), I can no longer run UI tests.

specflow sample project references

Running the tests through the Visual Studio (2022) Test Explorer, I receive the following result:

  Message: 
System.AggregateException : One or more errors occurred. (Interface cannot be resolved: SpecFlow.Actions.Configuration.ISpecFlowActionJsonLoader (resolution path: SpecFlow.Actions.WindowsAppDriver.Configuration.WindowsAppDriverConfiguration)) (The following constructor parameters did not have matching fixture data: SpecFlow_Specs_XUnitAssemblyFixture assemblyFixture)
---- BoDi.ObjectContainerException : Interface cannot be resolved: SpecFlow.Actions.Configuration.ISpecFlowActionJsonLoader (resolution path: SpecFlow.Actions.WindowsAppDriver.Configuration.WindowsAppDriverConfiguration)
---- The following constructor parameters did not have matching fixture data: SpecFlow_Specs_XUnitAssemblyFixture assemblyFixture

  Stack Trace: 
----- Inner Stack Trace #1 (BoDi.ObjectContainerException) -----
<>c__DisplayClass3_0.<ResolvePerContext>b__1()
RegistrationWithStrategy.ExecuteWithLock(Object lockObject, Func`1 getter, Func`1 factory, ResolutionList resolutionPath)
TypeRegistration.ResolvePerContext(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
RegistrationWithStrategy.Resolve(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
ObjectContainer.ResolveObject(RegistrationKey keyToResolve, ResolutionList resolutionPath)
ObjectContainer.Resolve(Type typeToResolve, ResolutionList resolutionPath, String name)
<>c__DisplayClass71_0.<ResolveArguments>b__0(ParameterInfo p)
SelectArrayIterator`2.ToArray()
Enumerable.ToArray[TSource](IEnumerable`1 source)
ObjectContainer.ResolveArguments(IEnumerable`1 parameters, RegistrationKey keyToResolve, ResolutionList resolutionPath)
ObjectContainer.CreateObject(Type type, ResolutionList resolutionPath, RegistrationKey keyToResolve)
<>c__DisplayClass3_0.<ResolvePerContext>b__1()
RegistrationWithStrategy.ExecuteWithLock(Object lockObject, Func`1 getter, Func`1 factory, ResolutionList resolutionPath)
TypeRegistration.ResolvePerContext(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
RegistrationWithStrategy.Resolve(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
ObjectContainer.ResolveObject(RegistrationKey keyToResolve, ResolutionList resolutionPath)
ObjectContainer.Resolve(Type typeToResolve, ResolutionList resolutionPath, String name)
<>c__DisplayClass71_0.<ResolveArguments>b__0(ParameterInfo p)
SelectArrayIterator`2.ToArray()
Enumerable.ToArray[TSource](IEnumerable`1 source)
ObjectContainer.ResolveArguments(IEnumerable`1 parameters, RegistrationKey keyToResolve, ResolutionList resolutionPath)
ObjectContainer.CreateObject(Type type, ResolutionList resolutionPath, RegistrationKey keyToResolve)
<>c__DisplayClass3_0.<ResolvePerContext>b__1()
RegistrationWithStrategy.ExecuteWithLock(Object lockObject, Func`1 getter, Func`1 factory, ResolutionList resolutionPath)
TypeRegistration.ResolvePerContext(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
RegistrationWithStrategy.Resolve(ObjectContainer container, RegistrationKey keyToResolve, ResolutionList resolutionPath)
ObjectContainer.ResolveObject(RegistrationKey keyToResolve, ResolutionList resolutionPath)
ObjectContainer.Resolve(Type typeToResolve, ResolutionList resolutionPath, String name)
ObjectContainer.Resolve(Type typeToResolve, String name)
ObjectContainer.Resolve[T](String name)
ObjectContainer.Resolve[T]()
WindowsAppDriverRuntimePlugin.RuntimePluginTestExecutionLifecycleEventEmitter_BeforeTestRun(Object sender, RuntimePluginBeforeTestRunEventArgs e)
RuntimePluginTestExecutionLifecycleEvents.RaiseBeforeTestRun(IObjectContainer objectContainer)
RuntimePluginTestExecutionLifecycleEventEmitter.RaiseExecutionLifecycleEvent(HookType hookType, IObjectContainer container)
TestExecutionEngine.FireEvents(HookType hookType)
TestExecutionEngine.OnTestRunStart()
TestRunner.OnTestRunStart()
TestRunnerManager.FireTestRunStart()
TestRunnerManager.OnTestRunStart(Assembly testAssembly, IContainerBuilder containerBuilder)
SpecFlow_Specs_XUnitAssemblyFixture.ctor() line 19
RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
----- Inner Stack Trace #2 (Xunit.Sdk.TestClassException) -----

Steps to Reproduce

Clone my repo, build the project, and attempt to run tests via Visual Studio Test Explorer

Link to Repro Project

https://github.com/aronweiler/random/tree/main/SpecFlowExample

@aronweiler aronweiler added the Bug label Jan 23, 2023
@aronweiler
Copy link
Author

As a follow-up, I tried reverting the updated NuGet packages one by one, and found that it was the update of the SpecFlow.Actions.WindowsAppDriver that is the culprit.

If I downgrade the SpecFlow.Actions.WindowsAppDriver to v0.1.177, the tests work again.

Going to the SpecFlow.Actions.WindowsAppDriver v0.1.350 causes this issue.

Is there something I am missing in order to get these tests working again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant