TFS build server creates no test results - testing

Is there any way to activate a test related log at our TFS build server?
If a tests fails, I can't find any information about it (besides the name of the test).
I checked:
The drop folder. There is the normal log, but this log ends after the compilation, so before the tests are checked
The compilation folder at the build server (C:\Builds\8...). There is a folder "Test Results" next to the "bin" and the "src" folder, but the "Test Results" folder is always empty.
The build definition. Couldn't find any option to activate a log regarding tests.
When i check the build in the web view, all I see is:
x/y test(s) passed, z failed, 0 inconclusive
No Code Coverage Results
Other Errors and Warnings
z+1 error(s), 0 warning(s)
Failed z1
Failed z2
...
Failed zn
Test Run Failed.
How can I find further information, why the tests are failing?
We are using:
TFS 2012 + a TFS 2012 build server
Rolling builds
Visual Studio 2013 + Resharper at our local machines
NUnit + MOQ
Rolling builds (no more than 30 minutes) build definition

We got rid of the problem after we upgraded to TFS 2015.
Now I just have to check the web interface, if a build is broken because of a unit test I click at the specific build to open the detail view of it. At the right side there is an area named Test result, where I can click at a link to get to the Test Run page. Under Attachments (1) I got a file of the type Visual Studio Test Results File, which shows me exactly what the problem was.

Related

TFS - Enabling "Rerun Failed Tests"

I have a TFS Release definition that runs several tests as part of the deployment:
When I check the "Rerun Failed Tests" Option in my "Visual Studio Test" step in:
My unit tests no longer run as part of my release. The release fails with the following error in the "Visual Studio Test" step:
2019-02-22T16:21:33.0983821Z ##[error]Error opening response file
'C:\TFS' 2019-02-22T16:21:33.1413767Z ##[error]The test source file
"C:\TFS Agent\ _work\r6\a\Agent_work_temp\ea14a091-36bd-11e9-99f5-51895cf3942e.txt" provided was not found.
I figured since the error started with the following statement:
Error opening response file 'C:\TFS'
That there is some sort of bug with the TFS test runner where the call to the task to execute the tests is not putting the path in quotes. I changed all my TFS build agents to using the following "type" of paths for all builds(I removed all spaces from the folder the TFS agents lived in):
C:\TFSAgent\ _work
And it seems to work now...

VSTS Build - Coded UI Tests Could not be found during Build's Test Execution

I have a Coded UI test program that runs without any error on local Visual Studio (2017). Only one test method is in the program. One feature it has is saving file in Azure Storage container. During build's Test Runs process, Build message says it cannot find any tests. Hoping for any feedback to see if I am making any error in build definition.
The build message says:
No test is available in D:\a\3\s\FullSite1\bin\Debug\FullSite1.dll D:\a\3\s\FullSite1\bin\Debug\Microsoft.Azure.KeyVault.Core.dll D:\a\3\s\FullSite1\bin\Debug\Microsoft.Data.Edm.dll D:\a\3\s\FullSite1\bin\Debug\Microsoft.Data.OData.dll D:\a\3\s\FullSite1\bin\Debug\Microsoft.Data.Services.Client.dll D:\a\3\s\FullSite1\bin\Debug\Microsoft.WindowsAzure.Storage.dll D:\a\3\s\FullSite1\bin\Debug\Newtonsoft.Json.dll D:\a\3\s\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll D:\a\3\s\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\portable-net45+wp8+wpa81+win\Microsoft.Azure.KeyVault.Core.dll D:\a\3\s\packages\Newtonsoft.Json.10.0.2\lib\net20\Newtonsoft.Json.dll D:\a\3\s\packages\Newtonsoft.Json.10.0.2\lib\net35\Newtonsoft.Json.dll D:\a\3\s\packages\Newtonsoft.Json.10.0.2\lib\net40\Newtonsoft.Json.dll D:\a\3\s\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll D:\a\3\s\packages\Newtonsoft.Json.10.0.2\lib\netstandard1.0\Newtonsoft.Json.dll D:\a\3\s\packages\Newtonsoft.Json.10.0.2\lib\netstandard1.3\Newtonsoft.Json.dll D:\a\3\s\packages\Newtonsoft.Json.10.0.2\lib\portable-net40+sl5+win8+wpa81+wp8\Newtonsoft.Json.dll D:\a\3\s\packages\Newtonsoft.Json.10.0.2\lib\portable-net45+win8+wpa81+wp8\Newtonsoft.Json.dll D:\a\3\s\packages\WindowsAzure.Storage.9.1.1\lib\net45\Microsoft.WindowsAzure.Storage.dll D:\a\3\s\packages\WindowsAzure.Storage.9.1.1\lib\netstandard1.0\Microsoft.WindowsAzure.Storage.dll D:\a\3\s\packages\WindowsAzure.Storage.9.1.1\lib\netstandard1.3\Microsoft.WindowsAzure.Storage.dll D:\a\3\s\packages\WindowsAzure.Storage.9.1.1\lib\win8\Microsoft.WindowsAzure.Storage.dll D:\a\3\s\packages\WindowsAzure.Storage.9.1.1\lib\wp8\Microsoft.WindowsAzure.Storage.dll D:\a\3\s\packages\WindowsAzure.Storage.9.1.1\lib\wpa\Microsoft.WindowsAzure.Storage.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
I am using the following in the build definition:
Process
Agent queue: Hosted VS2017
Get Sources
Select a Source: TFVC
Phase 1
Agent Queue: Hosted VS2017
Demands
Exists: msbuild, visualstudio, vstest
NuGet Restore
Version: 2
Command: restore
Path to solution, packages.config or project.json: **/*.sln
Use packages from NuGet.org
Build solution **.sln
Visual Studio Build
Build solution **\*.sln
Version = 1.*
Solution = **\*.sln
Visual Studio Version = Latest
Test Runs (Visual Studio Test)
Version = 2.*
Select tests using = Test assemblies
Test Assemblies = **\*.dll
!**\*TestAdapter.dll
!**\obj\**
Search Folder = $(System.DefaultWorkingDirectory)
Test mix contains UI Tests
Select test platform using = Version
Update test attachments = Checked
Control Options = Enabled
After comparing the code with another test I found the reason was because CodedUITest.cs file was missing [CodedUITest] after the namespace. I have added it and VSTS now can find the test method.

trouble publishing website TFS 2013

I have a TFS 2013 build that I'm trying to get to publish to a folder on the build server. I've installed WebDeploy, but I always get the error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets (4274): Web deployment task failed. (Could not connect to the remote computer ("localhost"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.)
I've set up a website on the build server and that's where I'm trying to publish the website. Actually I don't even care about publishing it per se - I just need my build output to go to a folder locally automatically. Right now we have to manually open the solution and choose Publish... to get the output that subsequent InstallShield builds need for input. Here are my MSBuild arguments. Does anyone have any idea what could be missing?
/p:SrcDir=C:\Builds\TFS\WebApps\Src
/p:RevKeyname=WebAppsRevNr
/p:DeployOnBuild=true
/p:DeployTarget=MsDeployPublish
/p:MSDeployServiceURL=https://127.0.0.1:8172/msdeploy.axd
/p:CreatePackageOnPublish=True
/p:DeployIisAppPath="WebApp"
/p:MsDeployPublishMethod=WMSVC
/p:AllowUntrustedCertificate=True
/p:AutoParameterizationWebConfigConnectionStrings=False
/p:Authtype=NTLM /p:username=""
I've checked both net start wmsvc and net start msdepsvc and both are running. Any ideas?
Thanks!
UPDATE
I've tried everything that Andy suggested and now when I run this from the command line I get this bizarre error message:
"C:\Workspace\VS2013\WebApps\Main\Src\webapps.sln" (default target) (1) ->
"C:\Workspace\VS2013\WebApps\Main\Src\CoreWebApps\CoreWebApps.csproj"
(default
target) (7) ->
(AutoParameterizationWebConfigConnectionStringsCore target) ->
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web
.Publishing.targets(2295,5): error : Could not open Source file: Could not
find
a part of the path
'C:\Workspace\VS2013\WebApps\Main\Src\CoreWebApps\Areas\Adm
in\Views\Web.config;Areas\Admin\Views\Web.config'.
[C:\Workspace\VS2013\WebApps
\Main\Src\CoreWebApps\CoreWebApps.csproj]
Any idea why it's looking for Web.config;Areas\Admin\Views\Web.config'.? That makes no sense.
Please try below items to narrow down the issue:
Try to use IP or Machine Name instead of "localhost"
Logon your build agent machine, then manually execute the same
MSBuild command within the same arguments(which you provided in build
definition) to build and deploy your solution, then check result. You
need to ensure you can manually run the same MSBuild command within
deploy argument to build and deploy your solution successfully from
build agent machine. Then use the same deploy arguments in TFS Build
definition.
Double check Web Deploy settings to make sure that the name of the
website is exactly that of what's in IIS.
Install Web Management Tools before Web
Deploy : Install the Web Management Services (Roles -> Web Server >
Management Tools > Management Services). Then uninstall Web Deploy, and then install Web Deploy again.
You can also reference this thread for your troubleshooting.
Update:
For the issue "Could not open Source file: Could not find a part of the path" you can reference below similar articles for the troubleshooting.
https://social.msdn.microsoft.com/Forums/en-US/8f959964-c951-4f9a-8486-8283a925c9f6/build-error-could-not-open-source-file-though-i-know-it-exists?forum=windowsazurewebsitespreview
https://our.umbraco.org/forum/getting-started/installing-umbraco/60222-Umbraco-721-Build-fails-after-deploy-to-Azure-WebSite (See the last two answers)

How to associate a Fake Build to the test plan in Microsoft Test Manager (MTM)2012 in order to run CUIT automated test

I want to run a codedUI test case using MTM 2012
Here is what I already have so far:
I created codedUI test cases to test my window application. CodeedUI Test run passed successfully.
I linked the test case to associate Automation.
When trying to run an automated test from MTM, I am receiving the following warning message:
"Cannot create automated test run. A build associated with the active test plan is required to submit an automated test run"
When I open MTM>Testing Center>Properties Build Configurations I can see my build definition field is empty.
In MTM>Testing Center>Properties Build Configurations > "Build in use:" is set to None, I have not available build.
I need to select a build from TFS in order to run the CUIT automated test. How can I create a fake build in visual studio 2012 to run my automated test in MTM envioremrnt.
Thanks!
You need to create a build definition for your automation project and have TFS build that. Then you can associate the builds that definition creates to your test plan.

Automated check-in using tf.exe fails with TFS policy failure

We have incorporated an automatic check-in from a TFS build that is throwing an error with regards to a policy failure, even though the check-in does get committed.
The command we are using is as follows;
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\tf.exe checkin FileSpec1.. FileSpec2.. /bypass /override:"Check-in from automated build" /comment:"Check-in from automated build D-BuildName-M_20141013.6
The error that we are getting in the TFS build log is;
Handle Error from TF
TF10139: The following check-in policies have not been satisfied:
Inputs
Condition: True
You must associate this check-in with one or more work items.
However, from the documentation that I can find, setting the /override flag should stop this from ocurring.
Checkin Command
The file do get checked in, but the build is a partial success due to this error.