VSTest task does not execute test dll(s) built for Platform x64 - testing

I am using Visual Studio Test task version 2 in my build definition in TFS 2017. Once my build is successful and it generates test dll(s),VSTest task is not able to run the test dll(s) that are built on platform x64.I am getting the following message:
Test run will use DLL(s) built for framework Framework45 and platform x86.Following DLL(s) will not be part of run: 'TestDllName.dll' is built for Framework FrameworkCore10 and Platform x64.
How to fix this?

Add the additional VSTest command line argument /Framework:FrameworkCore10.

Related

TFS build is not showing test result summary

I am running a CI build on TFS server using Visual Studio 2019. My project is based on .NET Core. The test results are not getting published after running the build.
First of all, you need to check your pipeline if that contain corresponding tasks.
You could choose to use Visual Studio Test task in your build definition/pipeline.
Use this task in a build or release pipeline to run unit and functional tests (Selenium, Appium, Coded UI test, and more) using the Visual Studio Test Runner. Other than MSTest-based tests, test frameworks that have a Visual Studio test adapter, such as xUnit, NUnit, Chutzpah, can also be executed.
Tests that target the .NET core framework can be executed by specifying the appropriate target framework value.
Another choice is using .NET Core CLI task with test command, and you need to combine with Publish Test Results task to show the results in the build summary.
If you already have the right configuration. Then check the logs of test related task. For example ,if it does not generate the test results, there should also no test result to publish. Also set system.debug=true to enable verbose debug mode to get a more detail result.
Besides, also attach an official doc show Build, test, and deploy .NET Core apps in case you need.

How to run Sonar Scanner on a Visual Studio 2019 solution?

We started to use VS2019 and all the new things that comes with. We noticed that the build manager doesn't work anymore:
The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:
1. The project has not been built - the project must be built in between the begin and end steps
2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0 and 15.0 are supported
3. The begin, build and end steps have not all been launched from the same folder
4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
I checked, but I thing I've the latest version of SonarScanner installed. I'm kind of stuck, how to execute all our tests if we use some things of the MSBUILD V16(2019) compiler, but sonar cube doesn't seems to be compatible?
Is there a workaround?
Thanks

Where is FrameworkUap10 used in VSTest.Console.exe for Win Universal Apps Unit testing

I've been tasked with adding Unit Testing to our WinUA. The developer said he added a new unit test for UWP project to his solution and I'm to add calling this at build time. He wasn't sure how to do it and pointed me to this article: Set up automated builds for your UWP app
I've added a "Visual Studio Test" step and set the following:
Test Assembly = **\*.UnitTests.build.appxrecipe
Other console options = /framework:FrameworkUap10
Running it throws the following error:
[error]Error: Invalid .Net Framework version:FrameworkUap10. Supported .Net Framework versions are Framework35, Framework40 and Framework45.
If I remove the invalid framework, no error is thrown but also no tests are run.
I cannot find any information on the /framework:FrameworkUap10 option. Searched MS, here and web and all that comes up is its use in this article... nothing about installing it on the build machine.
How does one install FrameworkUap10?
I was able to get this to work using the following using the following msbuild args for the msbuild step:
/p:AppxBundlePlatforms="$(BuildPlatform)"
/p:AppxPackageDir="$(Build.BinariesDirectory)\AutoBuildPackages\"
/p:AppxBundle=Always
/p:UapAppxPackageBuildMode=StoreUpload

How to integrate NUnit Tests (written in C#) in TFS builds?

I've written tests using Selenium in NUnit Framework using C# language. I want to associate these tests as part of builds in the TFS. So whenever new build is generated. These tests would be able to run as part of builds and generate/email reports as well.
Recommend you to use the new build system vNext build. vNext builds are JSON based, and you can plugin tasks built in msbuild, powershell and varied other scripting languages.
About how to integrate NUnit Tests in TFS builds, this blog describes clearly how to do this: Running NUnit Tests in a TFS 2015 Build vNext
Simply summarized as follows:
Add Nuget Package for NUnit Test Adapter
Specify path of custom Test Adapter inside build definition
Copying adapters inside Visual Studio TestWindows folder
Specify Path to Custom Test Adapter with nunit packages
Some other tutorial for you reference:
xUnit or NUnit with Visual Studio Online Build
Running nUnit and Jasmine.JS unit tests in TFS/VSO vNext build

How to both package with msbuild and run tests on TFS 2010 using Continuous Integration

I am using TFS2010 and MSBuild to integrate a windows azure cloud solution to the CI.
To create the required 2 files for deployment I added in the "MSBuild Arguments" the /t:Publish
Here is the configuration I use in TFS to build the packages:
Problem is : if I remove all arguments the tests are built correctly but no azure package is built as seen on the build results:
Tho if I put the parameters the package is there but the test are not run :
Is there a way to have both ?
I have managed to resolve this issue in my tfs build (TFS 2013). I am setting my MSBuild Argument target as /t:Publish;Build
Basically, during Publish target the unit test project is not being built. The 'Build' target builds the unit test project and my tests are executed. I also noted that the sequence of 'Publish' and then 'Build' was important. Setting 'Build' target before 'Publish' raised a few errors for my build.
I had discussion about your problem with TFS Team and I was told that as of now with TFS2010 this functionality is not yet fully supported however such functionality is in they radar and could be part of future TFS releases.
Because you are using TFS 2010, here are a few pointers that could help:
Building and Deploying Windows Azure Projects using MSBuild and TFS 2010
How-To: Deploy to Windows Azure from TFS Build using DeployToAzure
This problem still exists in TFS 2013.
I work around it by creating a Makefile project in the solution, and add a new 'Makefile' file with content as
all:
msbuild $(SolutionDir)AzureProject\AzureProject.ccproj /p:TargetProfile=Cloud /t:Publish /p:Configuration=$(Configuration) /p:PublishDir=$(OutDir)
And set build command line in project property page
nmake /E SolutionDir=$(SolutionDir) /E Configuration=$(Configuration) /E OutDir=$(OutDir)