Chutzpah & Jasmine tests - upgrade to TFS 2017 has broken tests? - tfs

We've been running javascript tests using jasmine and chutzpah for a while now. We just upgraded to TFS 2017. Our C# test run fine, but javascript tests are no longer being found by the TFS builds. (They continue to be discovered and run from Visual Studio.)
There are two suspicious messages in the build log, but I've found no useful information about either of them:
Test run will use DLL(s) built for framework .NETFramework,Version=v4.7.1 and platform X86. Following DLL(s) do not match framework/platform settings.
Chutzpah.VS2012.TestAdapter.dll is built for Framework 4.5.1 and Platform AnyCPU.
I don't know what determines the framework version, and I've read that this is a warning and not necessarily an error. That's backed up by the next error, which implies that the test adapter is being used anyway:
No test is available in c:\agent\_work\2\s\D\W\packages\Chutzpah.4.4.4\tools\Chutzpah.VS2012.TestAdapter.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
Is there something about the TFS 2017 upgrade that I'm missing? Does anyone have any insight into these two error messages or how to further diagnose them?

We recently created a new javascript test project and got this running on tfs 2017 build. Just had to add the chutzpah test runner nuget package to the javascript test project enabled the vstst test runner to discover the tests.
https://www.nuget.org/packages/Chutzpah/

Related

Visual Studio 2019 Test Explorer puts all tests under "Not Run Tests"

I have a ASP.Net Core 3 project with Visual Studio Professional 19.4.1 with xUnit 2.4.0. I have a couple of tests written there. My problem is that Visual Studio shows all the tests in this project always under "Not Run Tests". The same tests run well with command line (dotnet test) or another computer.
Repairing/Reinstalling Visual Studio did not help.
Any help is much needed!
UPDATE: I also realized that extension DotNet Extensions for Test Explorer is not present on this computer. This is present on other computer where these work. The problem, however, is how and where to get this extension from?
I already have xunit.runner.visualstudio 2.4.0 included in the project.
Any help is much valuable!!!
Upgrade the nuget package Microsoft.NET.Test.Sdk to version 16.4.0 (or newer).
When creating a new xunit project in vs2019, the version of Microsoft.NET.Test.Sdk installed is 16.2.0, which xunit.runner.visualstudio (v2.4.0 or newer) doesn't seem to work in.
Okay, got the same error where it simply did not run any of my tests despite obviously knowing about them (visible in test explorer in Test > Test Explorer). When I pressed Run or Run all tests, it just categorized them all as "not run". To fix this I lowered my .Net Core Target framework from 3.1 to 3.0 and that fixed it for me after a clean, rebuild of the unit test project.
This error may occur if you have cloned from a repository that used a different framework.
Installing both xunit.runner.visualstudio and xunit.runner.console worked for me.

An exception occurred while invoking executor 'executor://xunit/VsTestRunner2/uap': Could not load file or assembly 'System.IO.FileSystem

I'm facing to an issue when I'm running my unit tests on a VSTS build.
When I'm launching all my tests on Visual Studio locally, everything works fine. No error at all. Perfect.
But when I'm launching my tests via a tests task on a VSTS build, I have this error:
An exception occurred while invoking executor
'executor://xunit/VsTestRunner2/uap': Could not load file or assembly
'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral,
PublicKeyToken=***********' or one of its dependencies. The
system cannot find the file specified.
My test project is set like this:
"xunit.runner.visualstudio" on version 2.4.0 with a "targetFramework" set to "net462" (set inside the packages.config)
.NET Framework 4.6.2
On the build server I have:
Visual Studio 2017, v15.7.5
Visual Studio 2015, v14.0
I'm running out of clues... I'm surely missing something...
Thanks for your help
PS:
All tests passed correctly on the VSTS build
On the settings of my build task, when I set "Test platform version" to "Visual Studio 2015", it works. But when I'm choosing "Visual Studio 2017" or "Latest" I have the same error...
EDIT
I have Nuget packages "FluentAssertions" v5.4.1 and "System.ValueTuple" v4.5.0. I already tried to downgrade one of them and both. It failed. But I saw that "FluentAssertions" has a dependency to "System.ValueTuple"
EDIT 2
As #PatrickLu-MSFT said, passing the vs test task version to 1 solved the issue.
But when I'm looking closely, the Test platform versions available are 2015 and 2013:
When I'm choosing VS test task version 2, I have those choices:
I would like to stay on vs test task version 2 (in case of future updates, I don't want to be stuck...). What I saw is when I'm on Test platform version set to "Latest" or "Visual Studio 2017", it does not work. When I'm choosing "Visual Studio 2015", it working...
So what I point is:
Having a vs test task version set to version 1 make it work (maybe because the latest test platform version is "Visual Studio 2015"...?)
Having a vs test task version set to version 2 with Test platform version set to "Visual Studio 2015" make it work
So:
A VS test task version set to version 1 seems to work the same way as a VS test task version set to version 2 with a "Test platform version" set to "Visual Studio 2015".
How can I make it work with a VS test task version set to version 2 and a "Test platform version" set to "Latest"?
EDIT 3
After connected remotely to the server of my build agent and run tests from VS2017, I compare the output of Visual Studio 2017 of the host server to the output of my local Visual Studio 2017:
Local Visual Studio 2017:
Remote Visual Studio 2017:
Are there some issues with "xUnit.net VSTest Adapter v2.4.0 (32-bit Universal Windows)" on the host?
I hit this same problem and solved it by changing the "Path to custom test adapters" to point specifically to the correct test adapter by setting it to "Source\packages\xunit.runner.visualstudio.2.4.0\build_common". (You should modify the path to account for where the packages folder is in your repository.)
This apparently happens because by default VSTS tries to be helpful and scans the entire working directory structure for test adapters and loads all of them, but the xUnit Visual Studio test adapter Nuget package installs test adaptors for .Net Core and UWP as well, so VSTS happily loads them and they blow up.

Using GoogleTestRunner in our TFS Build

We are using the Google Test framework (version 1.7) for unit tests in C++ project (with Visual Studio 2012 and TFS 2012). By using GoogleTestRunner for VS2012 I am able to discover the tests written in Google Test within Visual Studio and run them. So far so good :)
Now I would like to run the tests with my CI build I have set up on our TFS. Therefore I have installed the GoogleTestRunner on my build server for the user that runs our build. If I run the build (and tests) on the build server directly in Visual Studio it works - but when the build is triggered by the TFS build definition I displays the following message in the log:
No test found. Make sure that installed test discoverers & executors,
platform & framework version settings are appropriate and try again.
Any suggestion what I am missing?
Is this working for anybody at all?
Your help is highly appreciated!
Christoph
I have been able to sort it out myself :)
There is a guide showing how to get it running for NUnit. Just follow that guide and adopt it to the GoogleTestRunner:
http://bartwullems.blogspot.de/2012/10/tfs-2012-build-configure-nunit-to-run.html
I extracted the DLLs from the GoogleTestRunner.vsix file with 7zip (I assume any other Zip program would work as well). I checked in all DLLs I found there (as described in the mentioned guide) - don't know if really all DLLs are needed.

How to get latest code from Visual Studio Online using alternate credentials?

As part of our continuous integration process, we want to get the latest code from Visual Studio Online in order to execute automated tests locally.
We can already download the latest builds, but we cannot execute Coded UI tests correctly with the compiled assemblies, for some reason. Thus, we want to get the latest code in order to compile and execute it locally. How could I get the latest code from Visual Studio Online from a TFVC (Team Foundation Version Control) project?

Post TFS 2012 upgrade project fails to compile

I just updated TFS from 2012 RC to 2012 RTM. The instal went just fine and everything is setup as it was. However now when I check-in files and the build process kicks off I keep getting an error relating to a missing System.EnterpriseServices.dll. Here is the full error:
CSC: Metadata file 'c:\Builds\1\MySite\bin\System.EnterpriseServices.dll' could not be opened -- 'Error importing module 'System.EnterpriseServices.Wrapper.dll' of assembly 'c:\Builds\1\MySite\bin\System.EnterpriseServices.dll' -- The system cannot find the file specified. '
Yes I have verified the file is in the bin, as as well I have removed then re-added it. One thing I suspect here is that I see the new TFS install added .NET 4.5 to the server, where before it did not exist... maybe that's a possible cause?? The application is a C# MVC4 website set to .NET 4.0.
I have also ran the 'Repair' on the TFS install and re-installed .NET 4.5. The project compiles and runs perfectly locally.
Any help is greatly appreciated!
Most of custom dlls problems comes from they are not in the right place, so try to put any custom dlls on the build server on the right place, see my answer there.
Upgraded TFS 2008 build definitions to TFS 2012 build defs using Upgrade Template, errors when queueing builds

Resources