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

vstest.console.exe discovers no tests for a .NET Core class library project (VS 2017 RTM) #596

Closed
ek68794998 opened this issue Mar 10, 2017 · 15 comments

Comments

@ek68794998
Copy link

Description

After creating a brand new .NET Core class library and unit test project, the IDE discovers my test, but not the console.

Steps to reproduce

A project created using the steps below is available from this link.

  1. Create new Class Library (.NET Core).
  2. Add a new static method to Class1 that can be called from an external module.
  3. Right-click the solution and add a new Unit Test Project (.NET Core) project to it.
  4. Right-click the unit test project and add the library as a reference.
  5. Add an assertion test to the unit test project.
  6. Build the solution. (The test in your test project should show up in the VS Test Explorer.)
  7. Execute tests with code coverage, through the IDE or command line:
    vstest.console.exe "C:\...\bin\Debug\netcoreapp1.1\UnitTestProject1.dll" /UseVsixExtensions:true /logger:trx

Expected behavior

The single test in the project, TestMethod, should execute and pass.

Actual behavior

Starting test execution, please wait...
Warning: No test is available in C:\...\bin\Debug\netcoreapp1.1\UnitTestProject1.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.

Environment

  • Windows 10 (15031 Insider build)
  • Visual Studio 2017 RTM 15.0.0-RTW+26228.4
  • vstest.console.exe 15.0.26228.0
@smadala
Copy link
Contributor

smadala commented Mar 11, 2017

@ekumlin from #443 (comment), to run .Net Core tests project, please use vstest.console.exe from folder C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\.

Edit: From VS 2017 update 5, All the requests to TPv1 forwards to TPv2.

TP v1:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe

TP v2: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe

@ek68794998
Copy link
Author

ek68794998 commented Mar 13, 2017

Thank you for the reply. Unfortunately, this does not work either.

>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" "C:\...\bin\Debug\netcoreapp1.1\UnitTestProject1.dll" /logger:trx
Microsoft (R) Test Execution Command Line Tool Version 15.0.0.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
No test is available in C:\...\bin\Debug\netcoreapp1.1\UnitTestProject1.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.

I also tried with /UseVsixExtensions:true, but that provided an error:

The test source file "/UseVsixExtensions:true" provided was not found.

@smadala
Copy link
Contributor

smadala commented Mar 13, 2017

@ekumlin For .Net Core project, /Frameowrk:FrameworkCore10 should be provided when running with vstest.console.exe

Edit: From vstest 15.5 onwards, /Framework argument is not required for .NET Core targeted tests.

@ek68794998
Copy link
Author

@smadala Great, those two fixes together work.

What is the difference between the vstest.console.exe on the Developer Console and the C:\...\vstest.console.exe path you provided? Why do we have to specify?

@smadala
Copy link
Contributor

smadala commented Mar 13, 2017

@ghost
Copy link

ghost commented Aug 31, 2017

@smadala Hi I just want to ask something this is a bit irrelevant to the current topic but I hope you can help me.

Why is it that I can't add a new capability on a certain build agent (this is a private pipeline). I tried adding a new one but it doesn't displays on the list of capabilities.

Is there any work around on this?

@smadala
Copy link
Contributor

smadala commented Aug 31, 2017

@lorenz31 Sorry, I don't have idea about it. Can you pose your question here? See the doc helps?

@ghost
Copy link

ghost commented Aug 31, 2017

Here's a screenshot of what I mean.
screenshot

As you can see the Save Changes and Undo Changes buttons are disabled. That's when I added the new capability.

Also the "here" link isn't available.

@smadala
Copy link
Contributor

smadala commented Aug 31, 2017

Edited the link

@ghost
Copy link

ghost commented Aug 31, 2017

The link is still not available.

@smadala
Copy link
Contributor

smadala commented Aug 31, 2017

@ghost
Copy link

ghost commented Aug 31, 2017

Thanks works now! :)

@mit-jamie-clayton
Copy link

mit-jamie-clayton commented Oct 10, 2017

I found that the my older mstest csproj files didn't include various targets needed for VSTO to find unit tests. I created a new MSTest project and compare that with the existing csproj files and found a stack of references that needed to be copied to my older projects.

E.g.
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />

@pMaske
Copy link

pMaske commented Jan 18, 2018

I am trying to run vstest.console.exe for a Xamarin UI test project and I am getting message
Starting test execution, please wait...
No test is available in E:\UnitTests\XFUITest\bin\Debug\Xamarin.UITest.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

I am using Enterprise version of VS2017 15.4.4.
command I am using is

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform>vstest.console.exe E:\UnitTests\XFUITest\bin\Debug\Xamarin.UITest.dll /logger:trx

Can you please help @smadala

@smadala
Copy link
Contributor

smadala commented Jan 18, 2018

@pMaske What is target framework of Xamarin.UITest.dll? Can you please create separate issue with all details in Issue template?

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

No branches or pull requests

4 participants