# Create a Windows test case

> Test Windows desktop applications with Windows (Lite) or Windows (Advanced) — capture or import elements, record steps, debug with Copilot, and automate SAP.

Testsigma tests Windows desktop applications through 2 project types. **Windows (Lite)** captures elements with the Test Recorder and suits applications built on the modern Windows frameworks. **Windows (Advanced)** uses the Element Recorder or a UFT One object repository, and reaches Oracle, Java, SAP, Insight, terminal emulators, and legacy software that Lite cannot.

The project type is set when you create the application and cannot be changed afterwards, so choose before you start.

Windows tests execute locally through the Testsigma Agent only. There is no cloud lab for them.

## Technologies supported

| Project type | Covers |
|---|---|
| Windows (Lite) | Universal Windows Platform, Windows Forms, Windows Presentation Foundation, Classic Win32 |
| Windows (Advanced) | Oracle, Java, SAP GUI, SAP UI5, Insight, Terminal Emulator, UIA-based applications, legacy Windows software |

## Before you start

**Windows (Lite)** needs the [Testsigma Agent](https://testsigma.com/docs/v2/get-started/installation/testsigma-agent/) set up and **Developer Mode** enabled on the Windows machine.

**Windows (Advanced)** needs [Testsigma Terminal](https://testsigma.com/docs/v2/get-started/installation/testsigma-terminal/) installed, the **WinTest Automation** folder in the Testsigma Agent directory, and **Developer Mode** enabled.

## Capture elements and create test cases

The flow is the same throughout: capture the elements, then build steps against them. What changes is how the elements arrive. Running the test case is the same for every route, and is covered below.

### Capture the elements

A Lite test case is built from elements captured beforehand, so this comes first. The Test Recorder takes them one at a time from the running application.

1. Go to **Create Tests > Elements** and click **Record**.
2. In the **Record Elements** overlay, select **Local Test Machine**, enter the **App path**, and click **Record**.
3. Wait for the application to load fully.
4. Click the element you want to capture.
5. Check the **Name**, **Screen Name**, **Element Type**, and **Value** in the **Create Element** section.
6. Click **Create**.
7. Repeat for every element you need, then stop the recorder to close the session.

![The Record Elements overlay, with the connected machine and the desktop app path](https://s3.amazonaws.com/website-static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/WL_ElementRecord.png)

![The recorder streaming the application, with Create Element filled in from the clicked control](https://s3.amazonaws.com/website-static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/WL_CreateElement.png)

The captured elements appear under **Create Tests > Elements** and can be reused across test cases.

### Create the test case

1. Go to **Create Tests > Test Cases** and click **Create Test Case**.
2. Build the steps on the Test Case Details page from the built-in NLPs and the elements you captured.

### Capture the elements

The Element Recorder has 2 modes. **Selective** captures elements one at a time. **Batch** captures every element in the current window at once. You switch between them inside the recorder without relaunching it.

The application you are recording has to be open on the device.

1. Go to **Create Tests > Elements** and click **Record**.
2. Select the application in the **Select application** window.
3. Click **Start recording**.

Only applications running on your device are listed. Use the search field to filter the list, or the refresh icon to reload it after opening a new application.

**Selective mode**

The recorder opens on the **Selective** tab with the application name in its header.

1. Hover over an element in the application until it highlights in green, then click it to capture it.
2. Select a captured element in the tree to see its details in **Element properties**.
3. Click **Locate** to highlight the selected element in the application window.
4. Click **Save**.

To capture an element that disappears on hover, such as a menu or a dropdown, click **Freeze** or press **Ctrl+Shift+F** to hold the current UI state, then click it.

**Batch mode**

1. Click the **Batch** tab. The recorder captures every element in the application's current window and lists them in a hierarchical tree.
2. Select an element in the tree to see its details in **Element properties**.
3. Click **Locate** to highlight the selected element in the application window.
4. Click **Save**.

Switching windows within the same application captures the new window's elements and clears those from the previous one.

Batch records the window's full control tree, including containers such as the title bar and tab groups, so narrow the tree with the search field before saving.

The saved elements appear under **Create Tests > Elements**.

#### Recorder controls

| Control | What it does |
|---|---|
| Selective and Batch | Switches capture mode without relaunching the recorder |
| Pause | Pauses capture. The application stays open and captured elements are kept |
| Stop | Ends the session |
| Freeze | Holds the current UI state, so a transient element such as a menu can be captured |
| Expand all and Collapse all | Expands or collapses the element hierarchy |
| Search | Filters the tree by name |
| Element properties | Shows the selected element's Name, Type, Class, AutomationId, and FrameworkId |
| Locate | Highlights the selected element in the application |
| Save | Saves the captured elements to the Elements list |

The footer keeps a running count, such as `78 elements recorded`.

| Shortcut | Action |
|---|---|
| **Alt+R** | Record |
| **Alt+S** | Stop |
| **Ctrl+Shift+F** | Freeze |

### Create the test case

Recording captures each interaction as a test step and creates the elements it touches along the way, so you do not have to capture them first.

1. Go to **Create Tests > Test Cases** and open the test case to record into.
2. Click **Record** in the action panel.
3. Select the application in the **Select application** window, and click **Start recording**.

The Testsigma Recorder opens, the application comes to the foreground, and **Open application** is added as the first step with the application path.

4. Perform the actions you want as test steps. Each interaction becomes a step, and its elements are created automatically.
5. Click **Pause** to hold recording without ending the session, or **Stop** to end it.

To record an advanced action on an element, hold **Ctrl** and click it.

Elements created this way are saved under **Create Tests > Elements** and can be reused in other test cases.

Steps can also be added by hand: click **Actions** from the dropdown on the Test Case Details page, select the action, and select a captured element. Testsigma suggests actions based on the element's type, and the other step types are available too.

### Capture the elements

SAP uses the same Element Recorder, opened through a dialog of its own. Go to **Create Tests > Elements**, click **Record**, select **Selective Element Recorder** or **Batch Element Recorder** in the **Desktop Element Recorder** dialog, and click **Launch**. Then choose the SAP application and click **Start Recording**. Capture and save as in the Element Recorder tab.

It adds requirements of its own. SAP Logon has to be installed with a working connection to your SAP system, and the SAP desktop application has to be open on the screen you want to record.

#### System and network requirements

| Component | Requirement |
|---|---|
| Memory | 8 GB, dedicated to the tests |
| Disk space | 20 GB, including space for screenshots and downloaded files |
| Processor | Dual-core or higher |

Your SAP connection needs a **Description**, the **System ID (SID)**, the **Instance Number**, and the **Application Server** as an IP address or hostname.

SAP systems commonly use ports 3200 and 5000, though this varies by configuration. Communication between the Testsigma Agent and the SAP system may need more ports opened, depending on your network.

Confirm the exact ports with your IT or network team. They depend on how your SAP system is configured.

### Create the test case

Recording captures each interaction as a test step and creates the elements it touches along the way, so you do not have to capture them first.

1. Go to **Create Tests > Test Cases** and open the test case to record into.
2. Click **Record** in the action panel.
3. Select the application in the **Select application** window, and click **Start recording**.

The Testsigma Recorder opens, the application comes to the foreground, and **Open application** is added as the first step with the application path.

4. Perform the actions you want as test steps. Each interaction becomes a step, and its elements are created automatically.
5. Click **Pause** to hold recording without ending the session, or **Stop** to end it.

To record an advanced action on an element, hold **Ctrl** and click it.

Elements created this way are saved under **Create Tests > Elements** and can be reused in other test cases.

Testsigma suggests the actions available for the element's type. See [SAP actions by element type](#sap-actions-by-element-type).

### Import the elements

Testsigma reads elements from a developer application model file, so this route starts in UFT One.

1. Create an object repository, a `.tsr` file, in UFT One and learn the objects your tests need. UFT One's object model and object spy capture them.
2. Convert it to `.tsrx`, which is the only format Testsigma imports.

#### Convert TSR to TSRx

1. Open a command prompt in the folder holding the `.tsr` files.
2. Enter the full path to UFT One's `OR2AppModelConverter.exe` utility.
3. Enter the name of the `.tsr` file, confirm it, append `x`, and press **Enter**.

The `.tsrx` file is saved in the same folder.

#### Import the file

1. Go to **Create Tests > Elements** and click **Import**.
2. Click **Browse file** and select the `.tsrx` file.
3. Under **How should we handle duplicates?**, select **Overwrite** to replace existing elements or **Ignore** to skip them.
4. Click **Import**.

![The element import dialog with a TSRx file selected and the duplicate handling choice](https://s3.amazonaws.com/website-static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/update_import_tsrx_4.png)

TSRx files are reusable, so one file serves every test case built against that application. To bring in a newer version, click **Update Elements** and repeat the steps.

### Create the test case

Steps are written against the imported elements rather than recorded, since the elements come from a file.

Click **Actions** from the dropdown on the Test Case Details page, select the action you want in the **Actions** overlay, and select a captured element for the step.

Testsigma suggests actions based on the element's type, and the other step types are available as well.

## Run the test case

1. Click **Run** on the Test Case Details page.

2. In the **Ad-Hoc Run** overlay, select the **Local Test Machine**, set any **Additional settings**, and click **Run Now**.

## Debug with Copilot

Copilot works on any Advanced technology. It runs the test case on the Windows machine and pauses where you tell it to, so you can inspect the application and record more steps without leaving the session.

1. Click **Copilot** in the action panel on the Test Case Details page.

2. Set **Set Initial Debug Point** and **Execute from Step** in the **Copilot** overlay, and configure the additional settings if needed.

3. Click **Launch**. Execution starts on the Windows test machine, and the Copilot panel opens beside the step results.

4. When execution pauses at a debug point or on a failure, inspect the application and use the execution controls.

5. Click **Rec** to record more steps by performing actions in the application.

6. Click **Resume** to continue the run.

The execution status sits at the bottom of the Copilot panel, reading **Execution paused** while it waits.

**Resume** continues from the next step rather than restarting, and **Rec** records additional steps into the test case during the session. **Pause**, **Step Over**, **Skip Over**, and **Restart Execution** are also available. See [Copilot](https://testsigma.com/docs/v2/atto/copilot/).

## SAP actions by element type

Every SAP element supports these 7 actions: `SetFocus`, `GetId`, `GetText`, `SetText`, `GetToolTip`, `GetName`, and `IsEnable`.

Each element type adds its own on top.

| Element type | Additional actions |
|---|---|
| Button | `Click` |
| Calendar | `GetDate`, `SetDateRange`, `setDate` |
| CheckBox | `Set`, `IsChecked` |
| ComboBox | `Select`, `SelectKey` |
| EditField | `setCursorPosition`, `GetDisplayedText`, `GetMaxLength`, `IsRequired`, `IsNumerical` |
| Editor | `DoubleClick`, `Select`, `SetUnprotectedTextPart` |
| Label | `GetMaxLength`, `IsNumerical`, `setCursorPosition` |
| Menubar | `Select` |
| OKCode | None beyond the 7 common actions |
| StatusBar | `GetMessageNumber`, `GetMessageId`, `IsMessageAsPopup` |
| TabControl | `GetSelectedTab`, `Select` |
| Table | `SelectCell`, `SelectRow`, `SelectRowRange`, `SelectColumn`, `SelectAllColumns`, `DeselectRow`, `DeselectRowRange`, `DeselectColumn`, `ActivateCell`, `IsValidRow`, `GetLength`, `GetTitle`, `Click`, `PressSettingsButton`, `OpenPossibleEntries` |
| Toolbar | `PressButton`, `PressContextButton`, `SelectMenuItem`, `SelectMenuItemById` |
| TreeView | `ActivateNode`, `GetSelectedItem`, `GetSelectedNodePath`, `OpenContextMenu`, `OpenHeaderContextMenu` |
| Window | `Close`, `Maximize`, `Resize`, `Restore`, `SendVKey`, `TabBackward`, `TabForward` |

`SAPElement` is the generic type and carries the 7 common actions only.

## When the application changes

Importing an updated TSRx file can leave elements, test cases, and step groups pointing at something that no longer matches. Testsigma flags them rather than letting the next run fail.

Errors surface in 2 places, each with a **View All** filter that narrows the list to the impacted items:

- On **Create Tests > Elements**, an impacted element carries a warning
- On **Create Tests > Test Cases**, an impacted test case shows a red underline on the element that no longer matches

To fix one:

1. Open the impacted test case.

2. Hover over the highlighted step to read the error.

3. Hover over the element and click **View/Edit element** to open **Element details**, which names the impacted elements.

4. Replace them with new elements, or disable or remove the step.

The same warnings and filters work at step group level.

## Frequently asked questions

### Why does the recorder fail to start?

Developer Mode is off on the Windows machine. Turn it on under **Settings > Privacy & security > For developers**, and click **Yes**.

If Developer Mode is already on, check the executable path. A wrong `.exe` path stops the recorder the same way.
