Invalid : E:\Jenkins\workspace\XXX.dll Has no TestFixtures - msbuild

When trying to run nunit3-console.exe on my testing dll project on jenkins machine
I'm Getting Invalid : E:\Jenkins\workspace\XXX.Tests.dll
Has no TestFixtures
the dll was created by jenkins using msbuild.exe
on my dev machine machine it works perfectly using the build from Visual studio

Turns out that i had another testing project in the solution with an older version of nunit
and on jenkins it was building the solution and copying the binaries to the same folder
making the nunit.framework.xml to be overwritten
the solution was making sure that both project referenced the latest nunit version.

Related

How to successfully run/debug NUnit + SpecFlow tests using Visual Studio Mac

I have a cross platform automation solution based on SpecFlow and NUnit 3.
This solution succeeds to run Web (Selenium) and Android (Xamarin.UITest) automated tests on Windows, unfortunately, it does not works on OS X in Visual Studio Mac.
When I use the command line NUnit console runner OR Rider (JetBrains IDE), tests seems to be working, but when I use VS Mac, it does not.
All my issues seems to be related to VS Mac, the first I had was because assemblies dynamically loaded by SpecFlow were not found.
Someone gave me a workaround on GitHub (TestRunnerSupportAssembly key to add in .csproj so that test runner can find assemblies).
And now that the assemblies are loaded, it is the App.config file which seems to be loaded but whose keys do not appear in AppSettings object.
Here is a part of the log I get from the IDE during test run :
Mono: Config attempting to parse: '/Users/.../Automation/AutomationMobile/bin/Debug/AutomationMobile.dll.config'.
I really think the issue is because of the test runner used by VS Mac, but I can't find how to configure it appropriately.
PS : I cannot migrate to .NET core, because few assemblies does not support it (Xamarin.UITest for instance).

Make local TFS build agent to use v14 msbuild tools

I've got a couple of ASP.NET vNext applications and I want my CI server to also be able to build them. Both my local machine and the CI server are running VS2015 RC. Then we've got VS Online and a local build controller - which is the server mentioned.
However, I cannot get builds going since it seems to be looking for v12 tooling - which does not include anything DNX.
So - building the solution gives:
The Dnx Runtime package needs to be installed. See output window for
more details
It is installed - since it came with VS2015 RC, AFAIK. So I thought the build template isn't using v14 tooling. I downloaded the Default Git template v12. And indeed it says:
<this:Process.BuildProcessVersion>12.0</this:Process.BuildProcessVersion>
So I switched that to 14, uploaded template, ran build. Then:
Exception Message: The build controller used for this build does not
support the version of the template file used by the build definition.
The version of the template file is 14.0. The maximum supported
version for this build controller is 12.0.0.0.
So trying to solve this - got me to this forum question that states:
Then, instead of changing the BuildProcessVersion property, you need
to change the involved MSBuild version. Open the build process template, find the Run MSBuild for Project activity, change the ToolPath property to the 2013 version msbuild
So - I checked out the template - there is no ToolPath version. There is a ToolVersion property however - which I'll try setting to 14:
In short, my question is: how can I build ASP.NET vNext apps on my build server, that has VS2015RC installed - but is building using v12 tooling?
UPDATE
Seems that the problem is not as much in using the wrong tooling, but more in finding/using the correct DNX runtime while running under a service account ( which the TFS agent is doing ). I've added an issue for the DNX team: https://github.com/aspnet/dnx/issues/2239 .
use msbuild parameter /p:VisualStudioVersion=14.0 ,which can be added in build definition .

Microsoft.TeamFoundation.Client.dll fakes fail during build

I have this simple test project in vs 2013 I reference the Microsoft.TeamFoundation.Client in my library so added a Microsoft.Teamfoundation.Client.12.0.0.0.Fakes in the test project, using right click add fakes assembly.
Locally everything works fine but when i run the project trough the build server using the default template I get Fakes: code : assembly XXX\Microsoft.TeamFoundation.Client.dll failed to load properly.
The non fake dll's are included in a solution folder.
Any other assembly added by fakes working perfectly fine but as soon as I fake the Microsoft.Teamfoundation. my build breaks.
Using VS2013 with TFS 2012 update 2.
I had the similar issue. The problem is because TFS and Visual Studio versions are not the same. I installed VS 2013 to the server where TFS Build Server installed.
Then renamed C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Fakes folder and copied
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Fakes folder into C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Fakes. This will solve your problem I guess.

xUnit Runner for Visual Studio 2012 and native .dlls

Context
I am an application with C# and C++/CLI dlls. The C++/CLI dlls reference pure C++ .dlls, e.g. the boost libraries.
Tests are compiled into Tests.dll, which is placed with all the other binaries in $(SolutionDir)\bin\Debug.
Problem
Trying to run the xunit tests using Visual Studio 2012 fails, with the following error:
xUnit.net: Exception discovering tests from C:\Dev\xu-tests\bin\Debug\Tests.dll:
> System.IO.FileNotFoundException: Could not load file or assembly 'ManagedCpp.DLL'
> or one of its dependencies. The specified module could not be found.
> File name: 'ManagedCpp.DLL'
I can reproduce the problem in two ways outside of visual studio:
When trying to run the console runner from outside this directory
..(longpath)..\xunit.console.clr4.exe Debug\Tests.dll
When trying to run the GUI runner from its installed directory.
I can get it to work however when I use the console to get to the bin\Debug directory, then start the console or GUI runner from there.
This makes me believe that the problem is that VS2012 tries to run the unit tests not using the bin\Debug directory as working directory.
Question
How can I set the working directory in which xunit is run to $(OutDir) (or any specific directory)?

How to reference non-existant Office libraries when running MSBuild on a build server

I am trying to set up .Net builds on our Hudson (CI build) server. One application uses Microsoft.Office.Interop.Excel.dll. This is not found on the build server and causes the build to fail.
I obviously don't want to install Office on the server just for this case so what do I do?
To clarify: this is a build server. The project is not run on the server and Excel is not needed except to satisfy the compiler.
Install the primary interop assemblies:
Office 2003: http://www.microsoft.com/en-us/download/details.aspx?id=20923
Office 2007: http://www.microsoft.com/en-us/download/details.aspx?id=18346
Office 2010: http://www.microsoft.com/en-us/download/details.aspx?id=3508
Those PIA's should be also deployed to the GAC when you install Visual Studio (if you can).
You might also take a look at this question: Unit test with Microsoft.Office.Interop dll fails on build server
This is straight forward if you are using nuget and any repositories like nexus for dependency management. In our project we use VS2017 which has msbuild nicely integrated with nuget and it does the job to download this dll locally and on build server.
Hope this helps