AutomationUI function test don't start by Azure Pipelines YAML - azure-devops

I have to run some AutomationUI functional tests from Azure DevOps Pipelines. The tests use a desktop application in WPF/Winforms. The problem is a process of application start but without UI. I run the test using YAML and tasks: VSTest#2 or PowerShell#2. I found exception in Windows Event Viewer:
The description for Event ID 0 from source VSTTExecution cannot be
found. Either the component that raises this event is not installed on
your local computer or the installation is corrupted. You can install
or repair the component on the local computer.
If the event originated on another computer, the display information
had to be saved with the event.
The following information was included with the event:
(testhost.exe, PID 13060, Thread 3)
HKEY_LOCAL_MACHINE\EnterpriseTools\QualityTools\TestTypes Key cannot
be found!
The message resource is present but the message was not found in the
message table.
I reinstalled the service as was suggested on a forum, but it still not work.
When I run the same tests from PowerShell or Command Line there is no problem.
Where could be a problem? Is there any recommended way to run functional test? I suppose the problem is between Azure DevOps Pipelines and VS test runner, because the same test was running successful by Team City or from PowerShell/Command Line

Related

Microsoft DevOps Testing Agent "Cannot publish artifacts from OSX or Linux"

I am running a local Microsoft DevOps server along with two separate machines running test agents for nightly automated testing. I recently configured a third test agent, but have run into issues with it publishing artifacts during the Build jobs to be used by the Release jobs.
The same jobs run perfectly on the two existing test boxes, but always throw this error after the build has completed and during the artifact publishing step:
2020-09-01T21:32:29.2544245Z ##[section]Starting: Publish Artifact:
bin_drop 2020-09-01T21:32:29.2548130Z
============================================================================== 2020-09-01T21:32:29.2548196Z Task : Copy and Publish Build
Artifacts 2020-09-01T21:32:29.2548235Z Description : [DEPRECATED] Use
the Copy Files task and the Publish Build Artifacts task instead
2020-09-01T21:32:29.2548273Z Version : 1.0.32
2020-09-01T21:32:29.2548311Z Author : Microsoft Corporation
2020-09-01T21:32:29.2548365Z Help : More
Information
2020-09-01T21:32:29.2548404Z
============================================================================== 2020-09-01T21:32:30.7956739Z ***.runsettings
2020-09-01T21:32:30.8306609Z ##[error]Cannot publish artifacts from
OSX or Linux to a file share. You can change 'Artifact Type' to
'Server', use Windows, or use the 'Copy Files', 'Copy Files Over SSH',
or 'FTP Upload' task. 2020-09-01T21:32:30.8378696Z
##[section]Finishing: Publish Artifact: bin_drop
In attempting to solve this issue I did look into using the Publish Build Artifacts task instead, but its description says it would have the same problem (e.g. doesn't work on Linux etc.). To be clear, the newest test box is the same as the other two running windows 10, it is NOT running linux or OSX.
In looking at Microsoft's test agent code (I think I found the correct GitHub package here), it looks like they are using Node.js to detect the platform the agent is running on, and if it does not equal 'win32', then they are throwing this error.
So I navigated to the Node.js instance inside the agent:
\agent\externals\node\bin
\agent\externals\node10\bin
and ran this code, and verified that it did indeed return 'win32' from both Node.js instances:
const os = require('os');
console.log(os.platform());
As near as I can tell the configuration on the third box is the same as the other two Windows 10 test boxes. And this should not be throwing this error. Does anyone have an idea why the test agent might be getting a value other than 'win32' so it thinks it is not running on windows and throwing this error for me?
EDIT:
I did try removing and re-configuring the agent on the machine. On all the text boxes the agent is running in interactive mode so it can run GUI tests.
Also, I recently had to rebuild one of the other two test boxes (after I was already struggling with box 3), and that rebuild went fine. A complete re-install of everything and it is working perfectly just like it was before.
I was able to solve this issue by copying the agent from a working test machine. It seems as though the more recent agent downloaded from the DevOps server itself has a bug in it.
Copying the agent from a working machine and stripping all the _work and configuration data from it, then installing it on the new third test machine resulted in a working machine.
The test machine I rebuilt while struggling with machine three was successful because I did not do a full reformat. Just reinstalled the OS, then used the install files from its data drive to finish installing the required software on it, so I never had to download a new agent for it from the DevOps server.

VssServiceResponseException: Forbidden in Azure Pipelines

I'm using Azure Pipelines to run automated tests via VSTest Platform (V2). The deployment group I'm using has no Internet access and is private. I have the task currently set up to run Nunit tests in the project via the test assemblies. The deployment group has VSTest Platform installed on it and I specify the path to vstest.console.exe in the task. The build artifact is downloaded from the pipeline.
The error I'm getting during the VSTest task is this:
Unhandled exception ocurred: Microsoft.VisualStudio.Services.WebApi.VssServiceResponseException: Forbidden
Followed by a stack trace and then this shortly after:
Error: The process 'C:\agent\A1\_work\_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.164.2\Modules\DTAExecutionHost.exe' failed with exit code 3762504530
I can attach the full log if need be, but I'm just trying to get some general direction at the moment.
First off, what is VssService? I'm assuming it has something to do with Visual Studio, but the only things I can find with the VSS acronym are Visual SourceSafe (Microsoft source control software from ~2005, so I really doubt that's it) and something to do with Cisco network switches.
Second, what is DTAExecutionHost?
Third, where can I find information on that error code?

deploying webjobs through CI-CD pipeline

I have a continuous webJob and am running it through CI-CD pipeline. After successful release webjob is showing as restart pending. Getting an error in the logs
D:\local\Temp\jobs\continuous\MiddleCompassServer\rrwnz5aj.4el>dotnet
MiddleCompassServer.exe
A fatal error was encountered. The library 'hostpolicy.dll' required
to execute the application was not found in
'D:\local\Temp\jobs\continuous\MiddleCompassServer\rrwnz5aj.4el\'.
Failed to run as a self-contained app. If this should be a
framework-dependent app, add the
D:\local\Temp\jobs\continuous\MiddleCompassServer\rrwnz5aj.4el\MiddleCompassServer.runtimeconfig.json
file specifying the appropriate framework.
There was chance that the dotnet core version specified in .json file mismatch with the version installed. You can try the solutions given in this thread mentioned by TrevorBrooks.
If above thread didnot workout for you.Try run .exe directly from console (./MiddleCompassServer.exe ) without using dotnet. as pointed out in this thread.
You can also try adding the runtimes setting in project.json and modify the RuntimeIdentifiers in .csproj file as this thread pointed out.

How to get Roslyn Analizer results in VSTS Build Definition?

I'm working on DevSecOps. Related to that, I want to secure my application with the help of Roslyn Analyzer. For that I created an MVC Web Application along with custom ruleset in Visual Studio and it's working fine with outputs clearly.
But, when I tried to do same thing with the help of VSTS Build task in my Build Definition in VSTS account. By referring the link, I known that with the help of MSBuild task we can get the Roslyn Analyser results by default. But I didn’t get the results of Roslyn Analyzer results after running my Build Definition. Can you suggest me to “How to overcome this situation”?
If that works locally when run msbuild in command line, then you can try below items to narrow down the issue:
Add a command line task to run the msbuild command line script
directly.
Change another hosted agent.
Deploy an private agent on your dev machine, then check if that works
with the private agent.
You can also reference below articles to troubleshoot the issue:
Using, configuring and distributing Roslyn analysers in teams
Running Code Analyzers on Build Server

How to run scheduled Coded UI Tests on Virtual Machine without having a RDP connection

Situation in short:
Virtual Machine with Visual Studio 2013 installed. PowerShell script
runs on the VM to execute Get Latest, Build and Execute Coded UI
Tests. Windows Scheduled Task to execute PowerShell nightly.
auto-logon is enabled (or I'm doing something wrong?)
yes, I've read post Is it possible to run Coded UI tests without having to connect via remote desktop?
I've seen posts about TCM. Does this help and how can I use it in my
situation?
I made some tests in Microsoft Test Manager and I also executed and recorded them.
I've loaded these tests in a test project (and changed the script providing categories and custom checks).
I then categorized these (as Development or Acceptance).
I executed out using a PowerShell script on a VM (with Visual Studio 2013 installed) with following actions:
Get Latest
Build
Run latest build with a selected set aka category using mstest.exe
So far everything is going perfectly. All the tests pass.
However, when I create a Scheduled Task on my VM run the PowerShell script everything fails because of a missing session.
Do I have the VM (I have no knowledge of Virtual Machines) then unlock or something?
Side-Note:
I also tried to fix this with a Test Agent and Controller, but once I had installed these, all other users of TFS lost their rights, so I prefer not to do this again.
I would be very grateful if you know something that can solve this.
I spent hours on Google finding a solution for this issue, but no solution helped me.
Do I need to provide more information?
The problem you're seeming to have is that the testagent is not setup correctly. You need an active desktop session for Coded UI to be able to run (it needs it to perform all the actions such as clicks).
Microsoft has some nice info about setting up your test agent here.
But to tackle your exact problem of the test failing because of a missing session I'd suggest the following:
Run AutoLogOn.exe from the sysinternals suite (can be found at http://live.sysinternals.com/). It will automatically log in with specified user when the machine starts, and keeps the desktop session active.
Alright...I'm making progress.
I've installed test agent and controller. It's all running fine.
Next I've opened Lab Center on my own MTM to create a new environment.
Test Controller is found, but I receive the message in this post "Microsoft Test Manager cannot install test agent on these machines" when creating new Lab Center environment
File and Printer sharing exception is enabled. I don't get the other message.
I don't understand what is wrong.
Maybe I'm completely on the wrong track and it's not necessary to use the Lab Center.
Then the only remaining issue is the non-active desktop issue.