Listbox

There are two different ways to display ListBoxes in Tosca Commanderâ„¢, namely in single-line view and multiline view. The creation of Modules varies for both views.

Single-line view

Single-line ListBoxes are automatically created upon scanning with Tosca XScan.

ActionMode

Value

Description

Input

<value>

Selecting an entry with this value

Verify

<value>

Verifying, if an entry with this value has been selected. If you select multiple entries, please separate all values by semicolons.

Buffer

<buffer name>

This writes the selected entry to a buffer of the specified name. If multiple entries are selected, Tosca will buffer all elements with list separators separately.

The value Courtesy Car is selected from the ListBox Courtesy car option.

ListBox - single-line view (Input)

The system verifies whether the value Courtesy Car is selected in the ListBox Courtesy car option.

ListBox - single-line view (Verify)

Multiline view

Multiline ListBoxes are scanned with Tosca XScan just like ComboBoxes (see "Multiline view").

Creating generic list items

This creates a ListItem which can be used repeatedly, depending on the number of ListItems required.

ListItems can for instance be used to select or verify ListBox entries.

  1. Scan the ListBox using Scan Modules.

  2. Right click onto the ListBox and select Create Generic List Item from the context menu to create a new list entry.

Creating a generic list item

A new ListItem called <Item> of the BusinessType ListItem is created.

Created list items

Control steering in the TestCase

When a ListBox is steered with multiline view, the ActionMode of the ListBox must be set to Select.

The following properties can be verified with ListBox entries in addition to the general properties:

Property

Description

Selected

Indicates if the entry is selected or deselected.

Text

Entry name

The following functions are available for the ListBox entry. If you do not enter a property in the TestStepValue, the property from the Default property column is used:

ActionMode

Value

Default property

Description

Input

 

Selected

Selecting an entry

Verify

True, False, <property>

Selected

Verifying a value or a property

Buffer

<buffer name>

Selected

This saves the value true if the entry is selected. If not, false is saved.

In the example below, the item No Courtesy Car is used to select the ListBox entry No Courtesy Car in the ListBox Courtesy car option.

Multiline ListBox - Input

The property Selected is used to verify whether the item Courtesy Car is selected in the ListBox Courtesy car option.

Multiline ListBox - Verify and Selected

Manipulating ListBox items

To be able to modify the name of a multiline ListBox item, the configuration parameter ExplicitName with the value True must be added to the ModuleAttribute of the required ListBox item (see chapter "Configuration Param").

You can use date and time expressions, regular expressions and random values for defining the items.

Deselecting ListBox items

Tosca allows you to deselect all ListBox items shown in single-line and multiline view simultaneously and to clear your selection in the ListBox.

For this purpose, define the dynamic expression {Clearselection} for the ListBox in the according TestStep and set the ActionMode to Input.

The example below deselects all selected items of the ListBox cars by using the expression {Clearselection}.

Deselecting ListBox items