This document has not been formally reviewed for accuracy and is provided "as is" for your convenience.
Summary
How to launch a desktop application using launchAUT using different parameter combinations. To used this capability, you must create an application whitelist file
Error
Problem
When using the lauchAut method to Run an application with UFT developer
IAut mfc = Desktop.LaunchAut("C:\\Windows\\System32\\calc.exe");
Without the proper configuration the use of this method will result in the following error message
Test method UFT_dev_test.UftDeveloperTest.TestMethod1 threw exception:
HP.LFT.SDK.GeneralLeanFtException: AUT launch is not allowed. Verify that the AUT is configured in autConfig.json. fileName=C:\Windows\System32\calc.exe, args=[undefined], workingDirectory=undefined
Cause
Cause
You can write test code to launch a desktop application using the launchAut() method. This method is available in all UFT Developer SDKs (.NET, Java, and JavaScript).
But for security reasons, in order to launch an application using this method, you must add the application and the format in which you are running it to a whitelist file.
If this is your first time using the launchAut() method, you need to create the whitelist file. If you have already created the file, add the new applications to the file. In either case.
▪ Note: You must restart
Fix
Create a file called autConfig.json in the following location:
File Format
Platform | File localtion |
---|---|
Windows | %localappdata%\LeanFT\config\ |
Mac | ~/Library/Application Support/LeanFT/config |
Linux | ~/.leanft/config |
The file is in JSON format and its supported objects are
allowedAuts
Includes the applications that you want to launch using the launchAut() method.
If you want to launch the same application in different ways, make sure to add an entry for each way.
fileName
The application name. You can specify the name
only, with or without the extension, the relative path or
the full path.
args
An array of arguments. For example, command line
arguments.
workingDirectory
The current working directory of the application.
The following is an example of an autConfig.json file. It demonstrates different ways for
specifying a desktop application.
{
"allowedAuts": [
{
"fileName": "C:\\Windows\\System32\\calc.exe"
},
{
"fileName": "mspaint.exe"
},
{
"fileName": "mspaint",
"args": ["C:\\devTools\\img\\2.png"]
},
{
"fileName": "mspaint",
"args": ["1.png"],
"workingDirectory": "C:\\devTools\\img"
}
]
}
This file corresponds to the following launchAut() implementations:
Aut calc = Desktop.launchAut("C:\\Windows\\System32\\calc.exe");
Aut mspaint1 = Desktop.launchAut("mspaint.exe");
Aut mspaint2 = Desktop.launchAut("mspaint", "C:\\devTools\\img\\2.png");
Aut mspaint3 = Desktop.launchAut("mspaint", new String[] {"1.png"},
"C:\\devTools\\img");
Aditional Information
You can find launchAut() code samples here:
• .NET: Launch AUT code samples
• Java: Launch AUT code samples
• JavaScript: Launch AUT code samples