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

Default .NET Template UITest Fails to Run Test #640

Closed
4 of 11 tasks
SkyeHoefling opened this issue Aug 8, 2022 · 1 comment
Closed
4 of 11 tasks

Default .NET Template UITest Fails to Run Test #640

SkyeHoefling opened this issue Aug 8, 2022 · 1 comment
Labels
kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification.

Comments

@SkyeHoefling
Copy link
Member

Current behavior

When creating a new project using the .NET CLI dotnet new unoapp-extensions the UI Tests will not work out of the box. This is because the NUnit3TestAdapter has a known issue in 4.2.1 where it will always have an exception when running the tests

The type initializer for 'NUnit.Engine.Services.RuntimeFrameworkService' threw an exception.
   at NUnit.Engine.Services.RuntimeFrameworkService.ApplyImageData(TestPackage package)
   at NUnit.Engine.Services.RuntimeFrameworkService.SelectRuntimeFramework(TestPackage package)
   at NUnit.Engine.Runners.MasterTestRunner.GetEngineRunner()
   at NUnit.Engine.Runners.MasterTestRunner.Explore(TestFilter filter)
   at NUnit.VisualStudio.TestAdapter.NUnitEngine.NUnitEngineAdapter.Explore(TestFilter filter) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\NUnitEngineAdapter.cs:line 88
   at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunAssembly(String assemblyPath, IGrouping`2 testCases, TestFilter filter) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 275
InnerException: System.ArgumentException: Unknown framework version 7.0

This issue is fully documented with a workaround nunit/nunit3-vs-adapter#987

Expected behavior

When right-click on the UITest project it should run the tests correctly

How to reproduce it (as minimally and precisely as possible)

ReproductionProject.zip

  1. Download the reproduction project or generate a fresh project using dotnet new unoapp-extensions using version 2.1.1
  2. Open with Visual Studio
  3. Launch the WASM project without debugging by setting as startup and tapping ctrl + F5
  4. Open the Visual Studio Text Explorer
  5. Run UI Tests

Environment

Nuget Package: Uno.Extensions.Templates

Package Version(s): 2.1.1

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • 2022 (version: 17.2.5)
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

I was able to follow the NUnit VS Adapter discussion in nunit/nunit3-vs-adapter#987 and update the test adapter to a preview build. Looks like it is the recommended approach as .NET 7 gets closer to GA. See exact comment nunit/nunit3-vs-adapter#987 (comment)

PR is incoming

@SkyeHoefling SkyeHoefling added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification. labels Aug 8, 2022
@nickrandolph
Copy link
Contributor

I don't think the issue is with the test adapter, there's a line of code missing in the template to instruct the UITests to not run in headless mode in debug.
Fixed here:

#if DEBUG
AppInitializer.TestEnvironment.WebAssemblyHeadless = false;
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification.
Projects
None yet
Development

No branches or pull requests

2 participants