question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TestFx 2.2.0-preview won't discover or run tests on VS16.8

See original GitHub issue

Description

TestFx won’t discover or run tests on .Net Framework 4.7 when using Visual Studio 16.8.

Steps to reproduce

  1. Create a Unit Test Project on .Net Framework 4.7.
  2. Verify that tests are getting discovered and run successfully.
  3. Update MSTest.TestAdapter and MSTest.TestFramework to version 2.2.0-preview-20201126-03.
  4. Run the tests using the Test Explorer Window.

Expected behavior

Tests are discovered and ran.

Actual behavior

---------- Starting test discovery for requested test run ----------
An exception occurred while test discoverer 'MSTestDiscoverer' was loading tests. Exception: Could not load type 'Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.TypesToLoadAttribute' from assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
No test is available in C:\...\UnitTestProject9\UnitTestProject9\bin\Debug\UnitTestProject9.dll. Make sure that test discoverer & executors are registered, and platform & framework version settings are appropriate and try again.
========== Test discovery finished: 0 Tests found in 8.1 sec ==========
---------- Starting test run ----------
An exception occurred while invoking executor 'executor://mstestadapter/v2': Could not load type 'Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.TypesToLoadAttribute' from assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
========== Test run finished: 0 Tests run in 7.4 sec (0 Passed, 0 Failed, 0 Skipped) ==========

Environment

Visual Studio v16.8.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Haploiscommented, Dec 2, 2020

This problem is not about one simple change. Since we started updating the TestPlatform and referencing it from TestFx, any change can be breaking. If we want to be able to update TestPlatform without breaking anything, this needs to be addressed. I was chatting with @jfleisher yesterday; he is looking into it from TestWindow’ss perspective; maybe something can be done there and retroactively fixed in older versions.

Also, I like to point out that this doesn’t fail when using NETCoreApp, since we’re referencing Microsoft.NET.Test.Sdk and using the referenced version. Is it possible to do that for NetFramework versions as well, @shyamnamboodiripad?

1reaction
Sanan07commented, Dec 2, 2020

We need think how can we release testfx to avoid this type of exception. Problem occurs when you use VS which does not have TP version which contains specific logic which we use inside testfx. If you use VS 16.8, it does not have our recent changes, and if you update MSTestAdapter inside your project to newer version which has recent changes it will break. Because MSTestAdapter has new types inside it, but TP in VS does not have it, that’s why it breaks. For instance in VS 16.9 Preview 2 everything works fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MSTestAdapter failed to discover tests because Method ...
The problem does not arise in Visual Studio, I guess because it doesn't need the TestAdapter but runs the tests directly.
Read more >
TestFX/TestFX: Simple and clean testing for JavaFX.
Simple and clean testing for JavaFX. TestFX 4 requires Java version of 8 (1.8), or higher, and has only legacy support. Documentation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found