New to Telerik Test Studio? Download free 30-day trial

Use Application User Model ID for Test Studio Desktop Tests

Modern desktop applications often use alternative methods for starting and maintaining their processes. Desktop apps such as Windows store, UWP or Maui-based apps cannot be started from an executable file. For these Test Studio provides the option for automation using the Application User Model ID.

Read below how you can find what is the User Model ID of the application you want to test.

List the Application User Model IDs

The Application User Model ID is a unique identifier for an application in the OS. Follow the below steps to list the User Model IDs for all applicable applications installed on the computer.

1.  Start PowerShell console using Admin rights. Type 'PowerShell' in the Windows Start menu and choose the option 'Run as Administrator'.

Open admin PowerShell console

2.  Copy the below script and paste it in the PowerShell console. Press Enter to execute it.

$listOfAppUserModelIds = @()

foreach ($app in get-AppxPackage)
{
    try {
            if(-not $app.IsFramework){
                foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id)
                {
                    $listOfAppUserModelIds += $app.packagefamilyname + "!" + $id
                }
            }
        }
        catch
        {
        }
}

$listOfAppUserModelIds

Paste script in PowerShell console

3.  The script iterates through the installed applications and outputs a list with their User Model ID - every app ID is on a new line.

Execute script in PowerShell console

Note

The application's ID is the whole string on the line. Use the complete string with no additional or missing characters when configuring the desktop test.

Filter List of User Model IDs

Usually the name of the application is part of the User Model ID and you can use it to filter the output list from the script. The parameter to use | Select-String -Pattern 'nameOfTheApp' is added on the last line of the script where you need to specify the name of the application. Press Enter to run it.

Let's use the Windows Calculator app as an example - the filter parameter for this application is | Select-String -Pattern 'Calculator' and is added on the last line.

$listOfAppUserModelIds = @()

foreach ($app in get-AppxPackage)
{
    try {
            if(-not $app.IsFramework){
                foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id)
                {
                    $listOfAppUserModelIds += $app.packagefamilyname + "!" + $id
                }
            }
        }
        catch
        {
        }
}

$listOfAppUserModelIds | Select-String -Pattern 'Calculator'

Filtered list of app ids in PowerShell console

Note

You need to replace the Calculator value with the name of the application you look for.

In this article