Steer WinForms Controls
WinForms Modules are created by using Tosca XScan.
Right-click onto a Modules folder or use the dynamic menu Modules in Tosca Commander and select Scan ->Application. For further details on how to proceed from here, see also chapter "Scan Modules".
The following standard controls can be steered as described in chapter "Steering Controls":
This chapter describes how to steer WinForms specific controls in greater detail.
Context menu
You can steer WinForms context menus with the Module WinForms Context Menu.
This Module is part of the Standard subset. You can find it under Standard modules->TBox XEngines->DotNet.
To use the Module WinForms Context Menu, you must manually open the context menu that you want to steer so Tricentis Tosca can detect it. |
In this example, you select the entry Insert->New Image of a context menu which is currently open. It does so in two different ways:
Different ways to steer a WinForms context menu |
DataGrid
DataGrids are steered like tables. For further details on table steering, please refer to chapter "Table".
To enter text into cells you have to use embedded TextBox controls. If you would like to select a CheckBox, you have to create an embedded CheckBox control (see chapter "Defining controls in cells").
The example below verifies whether the value of the ID is 1 in the second row of the ID column:
DataGrid: verifying a value In this example the engine writes the value Test into the first row of the first column:
DataGrid: inputting text In the example below, the engine selects the CheckBox that is located in the second row of the Selected column:
DataGrid: selecting a checkbox |
DataGridView
DataGrids are steered like tables. For further details on table steering, please refer to chapter "Table".
To enter text into cells you have to use embedded controls (see chapter "Defining controls in cells").
Input type |
Embedded control |
---|---|
Selecting a button |
Button |
Selecting a CheckBox |
CheckBox |
Selecting a ComboBox entry |
ComboBox |
Entering text |
TextBox |
Opening a link |
Button |
In the example below the engine selects the value Combo02 from the first row of the Combo1 column of the ComboBox:
Selecting a ComboBox entry from a cell |
GroupBox
Controls that are located in GroupBoxes, can be scanned and steered with Tosca.
For further details on control steering, please see also chapter "Control types".
ListView
Tosca XScan identifies ListView types such as LargeIcon, List, SmallIcon or Tile as ListBox, and they can be steered as described in chapter "Listbox".
ListViews of the type Details are identified as Table and can be steered as described in chapter "Table".
The following properties can additionally be verified:
Property |
Description |
---|---|
Selected |
Verifies whether the entry is selected. |
Focused |
Verifies whether the entry is focused. |
This example verifies whether the entry Communications Device is selected in the ListView type LargeIcon:
ListView: verifying an entry |
RichTextBox
WinForms RichTextBoxes can be scanned with Tosca XScan and they are identified as TextBoxes. RichTextBoxes are steered as described in chapter "TextBox".
In the example below the engine writes the value Test into the TextBox:
RichTextBox: inputting text |
TabControl
WinForms TabControls can be scanned with Tosca XScan and they are steered as described in chapter "TabControl".
The following properties can additionally be verified:
Property |
Description |
---|---|
SelectedTab |
Verifies the name of the selected tab. |
TabCount |
Verifies the number of tabs. |
SelectedIndex |
Verifies the index of the selected tab. |
In the example below the engine writes the number of tabs of the TabControl tabControlMain to the buffer called Number of Tabs:
Buffering the TabCount |
The following properties can additionally be verified in TabControls for Tab Items:
Property |
Description |
---|---|
Name |
Verifies the tab name. |
Selected |
Verifies whether the tab is selected (boolean). |
TabIndex |
Verifies the tab index. |
In this example the engine verifies whether the index value of the tabPage3 tab is 2:
Verifying the tab index |
Toolbar
WinForms ToolBars can be scanned with Tosca XScan and are identified as Menu. Controls in a toolbar are identified as MenuItems and can be steered by specifying either the path or by selecting the menu item directly. If you enter the path, separate the nodes by using ->. If you select the control, enter x, X, or no value.
Use the property Pushed to verify whether a toolbar button is selected.
In this example the engine selects a button with the value -1- from the toolbar toolBar1:
Selecting a control from a toolbar This example verifies whether the status of the button -2- in the toolbar toolBar1 is Pushed:
Verifying a control in the toolbar |
ToolStrip
ToolStrips are treated as containers that contain an arbitrary number of controls. You can steer controls inside the ToolStrip as described in chapter "Steering Controls".