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

Tests not found by TFS 2017 Builds #368

Closed
ViIvanov opened this issue Feb 14, 2018 · 7 comments
Closed

Tests not found by TFS 2017 Builds #368

ViIvanov opened this issue Feb 14, 2018 · 7 comments
Assignees

Comments

@ViIvanov
Copy link

Description

I have upgraded my test projects to MSTest V2 from traditional MSTest. Locally all tests run successfully.

In the TFS Build I see message

No test found. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.

Is NOTE from http://www.michaeltaylorp3.net/upgrading-from-mstest-to-mstest-v2/ still correct?

NOTE: As of Oct 2017, MSTest v2 and package references do not work correctly with TFS builds. The project file traditionally has a .targets file for the test adapter and test framework. The framework .targets file resides in a Visual Studio folder but the adapter’s .targets file comes from the package. Because package references do not create a packages folder in the solution, the .targets file cannot be found. For TFS builds this results in tests not being run because no adapter can be found. Running tests in Visual Studio work correctly.

Is some workaround exists?

Steps to reproduce

I just have added (via NuGet Package Manager) two packages (see Environment) to my project and removed reference to Microsoft.VisualStudio.QualityTools.UnitTestFramework.

Expected behavior

Tests runs by TFS.

Actual behavior

Tests not found by TFS

Environment

TFS 2017 (Microsoft Visual Studio Team Foundation Server Version 15.105.25910.0)

  <package id="MSTest.TestAdapter" version="1.2.0" targetFramework="net462" />
  <package id="MSTest.TestFramework" version="1.2.0" targetFramework="net462" />
@salmeister
Copy link

I had the same issue and the cause was that my csproj had multiple references to different versions of MSTest.TestFramework

@cltshivash
Copy link
Contributor

@ViIvanov : Can you provide more info on the VS version being used and also the test task logs if possible as it would help to narrow down the cause ?

@ViIvanov
Copy link
Author

@cltshivash I have used Visual Studio 2017 Version 15.5 on a build machine.

I`m sorry, I can not share a build log with you. RunTests task prints an error

 No test found. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.

I do not found any other tests-relates messages in a TFS log.

@kaadhina
Copy link
Contributor

@Vilvanov If you set build variable system.debug=true you will find more logs. You can remove sensitive data before sharing with us.
Else, you can enable test logs by settings trace level to 4 in vstest.console.exe.config file in the agent machine and pass on the test logs

@kaadhina
Copy link
Contributor

@ViIvanov were you able to get past this? If not, can you check if the adapters are present along with the test binaries. If yes and you are still hitting this, can u share the logs with us as above?

@ShreyasRmsft
Copy link
Member

@ViIvanov can you please either provide us the logs with system.debug=true (After redacting any sensitive information). Also please ensure that the test adapter is present next to the test sources if not you will need to provide custom adapter path to the adapter dll to get this to work.

Please refer to 286 for more info on how to set up a proper ci/cd

@ShreyasRmsft
Copy link
Member

I'm closing this issue due to no response and after having tried it out myself it works fine.

The workaround in case the adapter dll does not get copied to the binaries directory is to provide custom adapter path to the location where the adapter dll is present.

Please re-open if you follow the above mentioned steps and are still failing issues and please ensure you either provide the complete logs (sensitive data redacted) or a sample solution where this consistently repros along with the details of the build/release definition you are using.

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

No branches or pull requests

5 participants