TestFx 2.2.0-preview won't discover or run tests on VS16.8
See original GitHub issueDescription
TestFx won’t discover or run tests on .Net Framework 4.7
when using Visual Studio 16.8.
Steps to reproduce
- Create a Unit Test Project on
.Net Framework 4.7
. - Verify that tests are getting discovered and run successfully.
- Update
MSTest.TestAdapter
andMSTest.TestFramework
to version2.2.0-preview-20201126-03
. - 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:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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?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.