Highlighted
Regular Contributor.
Regular Contributor.
377 views

Test execution via TFS extension fails

We are currently evaluating UFT One and we are trying out the UFT TFS extension.

I followed the instructions under ( link ). I installed the extension on our test TFS server (Tfs2018.Update2) through the marketplace and downloaded the extension from ( link ) to configure the agent (interactive mode with autologon enabled on a win10 enterprise pc).

The .unpack.ps1 set the UFT_LAUNCHER environment variable and it unzipped the UFTWorking folder (though it unzipped it in another UFT folder so i had to move it one level up)

I have set up a Git repo with the UFT tests. The idea is that tests along with the .mtbx file are downloaded in the agent's work folder and I use the RunFromFileSystemTask task to execute tests from the agent filesystem. The .mtbx file has the paths to the tests in the agent work folder. The agent is running on a different machine than the TFS server.

I set up the build definition and I get the following error when the task is executed

==============================================================================
Task : UFT File System Execution
Description : Execute UFT tests from file system
Version : 1.0.4
Author :
Help :
==============================================================================
Preparing task execution handler.
Executing the powershell script: C:\BuildAgents\UFT_Agent\_work\_tasks\RunFromFileSystemTask_cfbe1493-3bb1-44d5-ac87-7f14a148a6f2\1.0.4\localTask.ps1
##[error]System.IO.FileLoadException: Could not load file or assembly 'file:///C:\BuildAgents\UFT VSTS Addon\UFTWorking\bin\PSModule.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///C:\BuildAgents\UFT VSTS Addon\UFTWorking\bin\PSModule.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadBinaryModule(PSModuleInfo parentModule, Boolean trySnapInName, String moduleName, String fileName, Assembly assemblyToLoad, String moduleBase, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, String prefix, Boolean loadTypes, Boolean loadFormats, Boolean& found, String shortModuleName, Boolean disableFormatUpdates)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo parentModule, String fileName, String moduleBase, String prefix, SessionState ss, Object privateData, ImportModuleOptions& options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions importModuleOptions, String name)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()


##[error]System.Management.Automation.CommandNotFoundException: The term 'Invoke-FSTask' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
##[error]PowerShell script completed with 2 errors.

Can someone from the community shed some light?

0 Likes
12 Replies
Highlighted
Regular Contributor.
Regular Contributor.

Re: Test execution via TFS extension fails

Update!!

Since I downloaded the whole addon and the PSModule is there... I said "what the heck..." and I rebuild it. I  took the PSModule dll and  .pdb and...

==============================================================================
Task : UFT File System Execution
Description : Execute UFT tests from file system
Version : 1.0.4
Author :
Help :
==============================================================================
Preparing task execution handler.
Executing the powershell script: C:\BuildAgents\UFT_Agent\_work\_tasks\RunFromFileSystemTask_cfbe1493-3bb1-44d5-ac87-7f14a148a6f2\1.0.4\localTask.ps1
"Started..."
Run build tests
Launcher timeout is 10675199::02:48:05
Controller Polling Interval: 30 seconds
PerScenarioTimeout: 10675199::02:48:05 minutes
FileSystemTestRunner timeout is 10675199.02:48:05.4775807
Mc connection info is - Mc HostAddress: , McPort: 8080, Username: , TenantId: , UseSSL: 0, UseProxy: 0, ProxyType: 0, ProxyAddress: , ProxyPort: 0, ProxyAuth: 0, ProxyUser:
2 tests found:
Login_Screen
LExp_Screen
============================================================================
08/01/2020 14:23:32 Running: C:\BuildAgents\UFT_Agent\_work\1\s\AngularApp\Login_Screen
Test result: Error
08/01/2020 14:23:41 Test complete: C:\BuildAgents\UFT_Agent\_work\1\s\AngularApp\Login_Screen
-------------------------------------------------------------------------------------------------------
08/01/2020 14:23:41 Running: C:\BuildAgents\UFT_Agent\_work\1\s\AngularApp\LExp_Screen
Test result: Error
08/01/2020 14:23:42 Test complete: C:\BuildAgents\UFT_Agent\_work\1\s\AngularApp\LExp_Screen
-------------------------------------------------------------------------------------------------------
================================================
Run status: Job failed, total tests: 2, succeeded: 0, failures: 0, errors: 2, warnings: 0
Error : C:\BuildAgents\UFT_Agent\_work\1\s\AngularApp\Login_Screen
Error : C:\BuildAgents\UFT_Agent\_work\1\s\AngularApp\LExp_Screen
================================================
Return code: -1

Task failed

##[error]Microsoft.PowerShell.Commands.WriteErrorException: Task Failed
##[error]PowerShell script completed with 1 errors.

 

Well. The names are right, the paths also, but does anyone know if there is any kind of logging kept somewhere that could point out the issue?

0 Likes
Highlighted
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: Test execution via TFS extension fails

Hello,

  Could you check if the PSModule.dll file (UFTWorking -> bin directory) is marked as Unblocked? You can do that by right-clicking the file and selecting Properties; if the file is blocked, you will see a checkbox (Unblock) at the bottom of the dialog, under the Security category.

unblocked.png

0 Likes
Highlighted
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: Test execution via TFS extension fails

Hello, 

  I have come across the same problem, after having the PSModule.dll unblocked, I shortly realised that my files were messed up. Below, you can find some print-screens with my configuration.

 

PaulaP_0-1582101513047.png

PaulaP_1-1582101541846.png

PaulaP_2-1582101590953.png

 

 

 

 

 

0 Likes
Highlighted
Frequent Contributor.. Frequent Contributor..
Frequent Contributor..

Re: Test execution via TFS extension fails

Hi guys,

I've just get rid of PSModule.dll error problem but now I am stuck on the same error than @N_GR ...

Task 'RunFromFileSystemTask' (1.0.4) is using deprecated task execution handler. The task should use the supported task-lib: https://aka.ms/tasklib
Preparing task execution handler.
Executing the powershell script: D:\TFSAgents\CS43\1\_work\_tasks\RunFromFileSystemTask_cfbe1493-3bb1-44d5-ac87-7f14a148a6f2\1.0.4\localTask.ps1
"Started..."
Run build tests
Launcher timeout is 10675199::02:48:05
Controller Polling Interval: 30 seconds
PerScenarioTimeout: 10675199::02:48:05 minutes
FileSystemTestRunner timeout is 10675199.02:48:05.4775807
Mc connection info is - Mc HostAddress: , McPort: 8080, Username: , TenantId: , UseSSL: 0, UseProxy: 0, ProxyType: 0, ProxyAddress: , ProxyPort: 0, ProxyAuth: 0, ProxyUser:
1 tests found:
D:\UFT_ICA\1-Start_Page
============================================================================
20.03.2020 15:10:55 Running: D:\UFT_ICA\1-Start_Page
Running test: D:\UFT_ICA\1-Start_Page
Test result: Failed
20.03.2020 15:12:22 Test complete: D:\UFT_ICA\1-Start_Page
-------------------------------------------------------------------------------------------------------
================================================
Run status: Job unstable (Passed with failed tests), total tests: 1, succeeded: 0, failures: 1, errors: 0, warnings: 0
Failed : D:\UFT_ICA\1-Start_Page
================================================
Return code: -2
 
 
Task failed
 
 
Microsoft.PowerShell.Commands.WriteErrorException: Task Failed
PowerShell script completed with 1 errors.
 
What should I do? I need this working for as soon as possible 😞
0 Likes
Highlighted
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: Test execution via TFS extension fails

Hello,

    You could try to repeat the process after deleting the contents of the _work\tasks\ folder (TFS agent's folder) and restart your slave machine. When running the agent, make sure you run it as an Administrator.

Let me know if you managed to successfully run the task.

 

Thanks,

  Paula

0 Likes
Highlighted
Frequent Contributor.. Frequent Contributor..
Frequent Contributor..

Re: Test execution via TFS extension fails

Hi Paula,

Thanks for your quick replay. I was looking that, it seems that UFT ran somehow ... because I have the report file on the script's folder ... is that possible? Is the UFT run in silent mode? I mean I didn't see the initial screen neither UFT opening ... Is this the correct way of working?

I've already done that twice ... delete the content of _task folder (in fact it is a nice hint) and restar the agent service on services.msc ... also changed the UFTWorking folder to another place and gave all the permissions to this folder ... When you say to run the Agent as an Admin how do I check that? I am logon in the slave machine as an admin and the user that configured the agent is also an admin ... I think that part is ok ...

 

Anyway, I got the error that I showed on the previous post and I checked now that I have this report file:

diogo_cruz_0-1584715431353.png

The errors are expected because I don't have the location of my repository files set up on this machine yet .... But if this is the correct way of working ... why I am getting this error on Azure and why also UFT Tests Results Report doesn't work as expected?

diogo_cruz_1-1584715901261.png

2020-03-20T14:48:31.4520865Z ##[section]Starting: UFT Test Results Report
2020-03-20T14:48:31.4525686Z ==============================================================================
2020-03-20T14:48:31.4526426Z Task : UFT Test Results Report
2020-03-20T14:48:31.4526635Z Description : Display test results
2020-03-20T14:48:31.4526795Z Version : 1.0.4
2020-03-20T14:48:31.4526978Z Author :
2020-03-20T14:48:31.4527452Z Help :
2020-03-20T14:48:31.4527630Z ==============================================================================
2020-03-20T14:48:31.4533298Z ##[warning]Task 'ReportTask' (1.0.4) is using deprecated task execution handler. The task should use the supported task-lib: https://aka.ms/tasklib
2020-03-20T14:48:31.4534912Z Preparing task execution handler.
2020-03-20T14:48:33.2262388Z Executing the powershell script: D:\TFSAgents\CS43\1\_work\_tasks\ReportTask_dfbe1493-3bb1-44d5-ac87-7f14a148a6f7\1.0.4\localTask.ps1
2020-03-20T14:48:33.5030790Z D:\ADM-TFS-Extension-master\installation\UFTWorking\res\Results20032020154731SSS.xml
2020-03-20T14:48:33.5031959Z
2020-03-20T14:48:33.5032160Z
2020-03-20T14:48:33.6744329Z ##[error]System.Management.Automation.CommandNotFoundException: The term 'Invoke-ReportTask' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2020-03-20T14:48:33.6750343Z at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
2020-03-20T14:48:33.6751234Z at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
2020-03-20T14:48:33.6752423Z at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
2020-03-20T14:48:33.6754666Z at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
2020-03-20T14:48:33.6756993Z at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
2020-03-20T14:48:33.6758086Z at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
2020-03-20T14:48:33.6758715Z at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2020-03-20T14:48:33.7011786Z ##[error]PowerShell script completed with 1 errors.
2020-03-20T14:48:33.7014882Z ##[section]Finishing: UFT Test Results Report

Sorry for the long text !!!

Highlighted
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: Test execution via TFS extension fails

Hello,

    The details you have provided are very helpful. If a test has failures, it does appear in the pipeline task as failed (you can see in the logs that the test is found - Found tests: 1, Failures: 1).  Any error that UFT would throw when running a test will affect the task's result and that is why it fails within the pipeline.

     About the report step: we currently have an issue which blocks any task fro  being executed if there was a previous failure in the pipeline. Happily, that issue is something that is currently being worked on. 

 Thank you,

     Paula

0 Likes
Highlighted
Frequent Contributor.. Frequent Contributor..
Frequent Contributor..

Re: Test execution via TFS extension fails

Happy to hear that. So Paula, If I understood correctly any error on my script and I will always get an error on the task in the pipeline, is that right? So the UFT has run in silent mode let's say because I didn't see anything opening on the slave machine .. which is great in fact, it is faster 🙂 

Regarding the Report task so it's not able to use it yet, I saw in another post (https://community.microfocus.com/t5/UFT-One-User-Discussions/lt-UFT-Support-tip-gt-UFT-TFS-Extension-how-to-run-UFT-tests/m-p/562301) that you can use Copy/Publish Artifact to allow us to view the test results in azure, have you tried?

Regards,

Diogo

0 Likes
Highlighted
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: Test execution via TFS extension fails

Yes, you could use the Copy/Publish Artifact task for viewing results; my bad, I forgot to mention it. 🙂

Thanks,

  Paula

Highlighted
Frequent Contributor.. Frequent Contributor..
Frequent Contributor..

Re: Test execution via TFS extension fails

Hi Paula,

Any hint/suggestion about the configuration of copy and publish artifact? I am trying to configure it but in regard to the artifacts I have two types (server and fileshare) and I don't know what to choose. I tried with server artifact an after running the build, in tab artifacts what I got was the file (to download) as shown on the picture below:

diogo_cruz_0-1584957733694.png

When I tried to configure as a fileshare I got the following error:

Publish build artifacts failed with error: Unable to create directory '{p}'. Unable to verify the directory exists: '{testDir}'. If directory is a file share, please verify the share name is correct, the share is online, and the current process has permission to access the share. \\my\share\CS43-CI_Sample\11789\UFT Report Test \\my\share\CS43-CI_Sample\11789\UFT Report Test

But that's because I didn't configure well the path .. that's ok .. How do I configure a share between the slave and Azure DevOps machine?? What I was trying to have is after running the build, get somehow access to the .html file of the UFT report file (run_results.html) ....

Many thanks for your help!

Diogo

 

Highlighted
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: Test execution via TFS extension fails

Hello,

  I will present an example of how to use the Copy Publish Artifact task:

  • Copy root: Test path
  • Contents: Report\run_results.html
  • Artifact Name: Report_RunFromFileSystem
  • Artifact Type: Server

After running, you should find the report under the "Artifacts" section; it might be needed for you to download it. 

Let me know how it went.

 

Thank you,

  Paula

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.