Issue with ‘VsTest’ task in azure devops CI build - azure-devops

I am using sonarqube version 6.1 and i have sonarqube scanning task integrated with my azure CI build . I want to calculate code coverages too , so I have added VsTest task in my CI build (as mentioned in sonarqube-vsts integration documentation).
I am getting error in VsTest task when a build is queued . (All other sonarqube task is running fine)
The error is as below :
Error: The process ‘C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe’ failed with exit code 1
VsTest task failed.
Please let me know how can this be fixed . Build server I am using has VS2017 on it.
Here's the log :
Total tests: 14. Passed: 8. Failed: 6. Skipped: 0.
Test Run Failed.
Test execution time: 41.8253 Seconds
Results File: D:\VSTS Agent Folder\SO\41\s\TestResults\SC-DEOPSCI_MEA-DEVOPS1_2019-09-09_11_14_11.trx
##[warning]Vstest failed with error. Check logs for failures. There might be failed tests.
##[error]Error: The process 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe' failed with exit code 1
##[error]VsTest task failed.
Publishing test results to test run '1000042'
Test results remaining: 14. Test run id: 1000042
##[section]Async Command Start: Publish test results
Published Test Run : https://xyz.visualstudio.com/TipB/_TestManagement/Runs?runId=1000042&_a=runCharts
##[section]Async Command End: Publish test results
##[section]Finishing: VsTest - testAssemblies

The error shows that 6 tests failed. It is the expected behavior of Vstest task. When the tests failed, the task will fail too.
This may indicate that there is something going unexpectedly in your code. You should go back to your source code and fix the failed test cases. After they are fixed, you can rerun your pipeline.
If you didnot want failed tests to effect the next task after Vstest, You can change the Control option of the next task to run the this task even if the previous task has failed.

Related

2.170.1\Modules\DTAExecutionHost.exe' failed with exit code 1

I am trying to run my automation pipeline on Private hosted agent and getting error as Test Run Failed.
Error: The process 'C:\agent_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.170.1\Modules\DTAExecutionHost.exe' failed with exit code 1
Vstest failed with error. Check logs for failures. There might be failed tests.
Error: The process 'C:\agent_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.170.1\Modules\DTAExecutionHost.exe' failed with exit code 1 Vstest failed with error. Check logs for failures. There might be failed tests.
Based on the error message, the reason for this issue should be that the VSTest task supported .Net Framework 4.6.2 from version 2.170.1.
You need to check the .NET framework version installed on the build agent machine. If the .NET framework version installed on the machine is 4.6.1 or less than that then can you please try upgrading the .Net framework version to 4.6.2.
Here is a doc about the requirement about the Visual Studio test task:
If you're using a Windows self-hosted agent, be sure that your machine
has this prerequisite installed:
.NET Framework 4.6.2 or a later version
In addition, you can try to use the Visual Studio test task version 1.

How can I solve error in teamcity (Nunit)?

Recently our NUnit build configuration has occasionally stopped halfway through the tests, but the overall build outcome is successful . When I look at the build log, the last test that actually got executed shows:
Process exited with code -100 (Step: tests (NUnit))
and then the build stops. Under "Failure Conditions". Our NUnit Consol is 3.10.0 .
Below is our NUnit configuration image.
I've found this comment in the TeamCity YouTrack. Seems, dotnet projects aren't supported in NUnit build step.
Try to use .NET CLI build step with "dotnet test" command to run tests in this project. Does it work?

VSTS build doesn't fail on failed tests

I am using VSTS to run protractor e2e test cases. I have a npm custom task that run the tests and even if the test fails, vsts build doesn't fail.
How can I make the vsts build fail?
You could try using Write-Error in combination with an exit 1 to fail a task:
Write-Error ("Some error")
exit 1
Check the case below:
How to fail the build from a PowerShell task in TFS 2015

run "clean-up": Job failed: exit status 1

I have Ionic pro, packaging for Android keeps failing with the following output:
$ run "clean-up"
Running Stage clean-up for Job: 5444336
ERROR: Job failed: exit status 1
The APK seems to generate correctly, but after the APK is generated this clean up command is attempted and fails.
Response from Ionic support:
I see you're using cordova-android 7.0.0. Unfortunately v7 isn't yet supported for package builds. You'll need to revert to v6.4.0 to complete the build. Have a look at this article for more details.

VSTS Build Fails With Error: Set-Content : Could not find a part of the path 'D:\a\1\a\Publish\manifest.xml'

I am completely new to VSTS and am working my way through the Microsoft Parts Unlimited GitHub Guide here: https://microsoft.github.io/PartsUnlimited/pandp/200.1x-PandP-CICDQuickstartwithVSTS.html
The build of the project successfully completes on my machine without any issues. The build task is a PowerShell 'dotnet restore, build, test and publish' task. I tried using Version 2.0 instead of 1.0 but it still fails (with a slightly different error).
I've followed all the instructions in the guide and the build is failing with the error:
Copyright (C) Microsoft Corporation. All rights reserved. Restoring
packages for
d:\a\1\s\src\PartsUnlimitedWebSite\PartsUnlimitedWebsite.csproj...
Restore completed in 81.65 ms for
d:\a\1\s\src\PartsUnlimited.Models\PartsUnlimited.Models.csproj.
Restore completed in 18.55 ms for
d:\a\1\s\src\PartsUnlimitedWebSite\PartsUnlimitedWebsite.csproj.
Restore completed in 29.21 ms for
d:\a\1\s\src\PartsUnlimitedWebSite\PartsUnlimitedWebsite.csproj.
Generating MSBuild file
d:\a\1\s\src\PartsUnlimitedWebSite\obj\PartsUnlimitedWebsite.csproj.nuget.g.props.
Restore completed in 688.66 ms for
d:\a\1\s\src\PartsUnlimitedWebSite\PartsUnlimitedWebsite.csproj.
npm ERR! Cannot read property '0' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\npm\cache_logs\2018-02-01T22_41_03_591Z-debug.log
d:\a\1\s\src\PartsUnlimitedWebSite\PartsUnlimitedWebsite.csproj(39,5):
error MSB3073: The command "npm install --loglevel=error" exited with
code 1.
Set-Content : Could not find a part of the path 'D:\a\1\a\Publish\manifest.xml'.
Process completed with exit code 1 and had 2 error(s) written to the error stream.
Where can I even begin to figure out what is causing this?