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.

runsettings not applied to test discovery ?

See original GitHub issue

Description

  • The runsettings seems that is not being applied to the test discovery.

Steps to reproduce

  • Test project (nanoFramework) with a couple of tests.
  • After the build no tests are found. After hitting Run All message with “No tests found to run.” shows.
  • However running from the console shows the test. vstest.console NFApp3.exe --Diag:diag.txt --Framework:".NETFramework,version=4.6.1" /TestAdapterPath:C:\Users\jassimoes\AppData\Local\Microsoft\VisualStudio\15.0_d9708c20\Extensions\0uwxjzp3.ahk /listtests

The output is:

Microsoft (R) Test Execution Command Line Tool Version 15.8.0
Copyright (c) Microsoft Corporation.  All rights reserved.

The following Tests are available:
Logging Vstest Diagnostics in file: C:\Users\jassimoes\Source\Repos\NFApp3\NFApp3\bin\Debug\diag.txt
Test run will use DLL(s) built for framework .NETFramework,Version=v4.6.1 and platform X86. Following DLL(s) do not match framework/platform settings.
NFApp3.exe is built for Framework 1.0 and Platform AnyCPU.
Go to http://go.microsoft.com/fwlink/?LinkID=236877&clcid=0x409 for more details on managing these settings.

Hello from nF DiscoverTests
Hello from nF DiscoverTests
Starting test discovery...
Starting test discovery...
Test discovery completed.
Test discovery completed.
    test name

The exe for this test project is build against a custom mscorlib and it’s using it’s own framework identifier. That’s why the warning about the framework mismatch. That seems to be handled properly in the console, but not inside VS.

Expected behavior

The tests should be listed in the test explorer window.

Actual behavior

  • No test is showing.

Environment

  • VS 15.8.5

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
jayaranigargcommented, Nov 12, 2018

@josesimoes : Apologies for the delay. To support this new platform/framework, you will need to add two projects. One for adapter logic and one for framework attributes.

  1. For adapter, you can create a project of this new platform type, something like PlatformService.Nano which takes a project dependency on PlatformService.Interface and implements all these interfaces. Refer how these interfaces have been implemented for Desktop(net45), Universal(UWP), .NetCore based projects. You would want to do similar implementations for this nano framework. Note- Make sure your project has rootNamespace and assemblyName as <RootNamespace>Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices</RootNamespace> <AssemblyName>Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices</AssemblyName>

  2. If this new framework has/requires attributes specific to this project type, you can create a project for framework extension, something like Extension.Nano which takes a dependency on MSTest.Core. In this project, you can implement customized attributes you need for the nano framework based projects. Note - Make sure your project has rootNamespace and assemblyName as <RootNamespace>Microsoft.VisualStudio.TestTools.UnitTesting</RootNamespace> <AssemblyName>Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions</AssemblyName>

Once the above changes are done, you might want to package these dlls in nuget packages. For that you will have to change Adapter and framework nuspec files to pick these new dlls when the project framework is nano. Note - You might need to check with nuget folks as to what keyword to use to target nano framework, if there is no keyword dedicated to it as of now.

0reactions
jayaranigargcommented, Dec 10, 2018

Closing the thread from our end. Please feel free to contact us if you face any issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

runsettings not applied to test discovery ? · Issue #491
The runsettings seems that is not being applied to the test discovery. Steps to reproduce. Test project (nanoFramework) with a couple of tests....
Read more >
Configure unit tests by using a .runsettings file
In the IDE, select Test > Configure Run Settings > Select Solution Wide runsettings File, and then select the .runsettings file. This file ......
Read more >
I can't get Live Unit Testing to see .runsettings
So, just to make it clear: SetAdaptersPaths is under the RunConfiguration element. Anything under TestRunParameters is not recognized at this ...
Read more >
When I Run All tests from Test Explorer After it Compiles ...
Testsettings can not be used with MSTest v2 based test projects. You can instead use LegacySettings in the runsettings if you want.
Read more >
MSTest | ReSharper Documentation
The discovery of tests in specific project happens only after the project is ... Use .runsettings/.testsettings specified in Visual Studio.
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