GUI Connection Management/en

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen

Introduction[Bearbeiten]

Blocks of a library for a GUI technology usually work without directly specifying a connection. Instead, they use the available connection. However, when running a test plan, multiple connections can be used. This page explains how to specify which connection to use when.

Expecco uses a two-level system to determine which connection to use. On the one hand there is the variable environment of the executed block. The connection to be used can be set by an entry there. Usually this is done automatically on connect and can be modified by appropriate blocks. This option is typically used in test runs where the connection setup is integrated. If there is no information in the variable environment, the last selected connection will be used. This can be controlled by the GUI browser and is used, for example, each time a single block is executed.

Variable Environment[Bearbeiten]

Especially when using multiple connections in parallel, the variable environment can be used to specify which connection should be used. Each technology has its own fixed name under which a so-called test runner is stored in the environment, and another name under which the current connection is stored. The test runner has a mapping between the connection names and the actual connection.

A test runner is created for each technology used and stored in the variable environment where it can be found for later use. When a connection is started using an appropriate connect block, this test-runner will remember the connection by its name.

To set the active connection, there are blocks in the libraries called Set Current Connection or Set Connection Scope or similar. These write the connection name to the environment. A normal action block will now retrieve the name of the active connection and the test-runner to which it belongs from the environment and thus know which connection to use. If there is no information in the environment, it will use the connection that was last selected in the GUI browser instead. Disconnecting by name is also done by the name mapping of the test-runner.

The names of the environment variables for each technology are:

Technology Variable for the Test Runner Variable for the Active Connection
Mobile Testing MOBILE_TESTING_TEST_RUNNER CURRENT_MOBILE_TESTING_CONNECTION
Java SWING_TEST_RUNNER CURRENT_SWING_CONNECTION
Selenium WebDriver SELENIUM_TEST_RUNNER CURRENT_SELENIUM_CONNECTION
WindowsAutomation2 WINDOWS_AUTOMATION_CONNECTION_MANAGER CURRENT_WINDOWS_AUTOMATION_CONNECTION

These variables are automatically created in the execution environment, so they are present throughout the execution, but also disappear when the execution is finished. Alternatively, you can define one of these variables in the environment of a test plan or block. In this case, a separate version of the variable is used there and in the subordinate blocks. This makes it easier to use two connections in parallel in one execution.

Example 1: Execute the same sequence on two connections in parallel
Set the environment variable for the active connection in each of the two blocks. Then set a different active connection for each and add the same block with the sequence you want. Both blocks can now be executed in parallel and each will take its own connection.
Example 1: TestSequence is the same block in both runs, but will use a different connection (name).


Example 2: Execute the same test multiple times in parallel
If starting and naming the connection is already part of the test sequence you want to run in parallel, you can also use multiple test runners. In this case, define the environment variable for the test runner for your test. When the test is now run in parallel, each will create its own test runner instance and there will be no conflict if the connection names are the same.
Example 2:TestSequence is the same block in both runs, but will use a different Test Runner with the same name for different connections.


GUI Browser[Bearbeiten]

The GUI browser is very useful when creating or editing test suites. You can use it to create new connections, view all active connections, and create or edit test sequences, for example using the appropriate technology recorder.

The GUI browser allows you to execute individual blocks. For these, the connection selected on the left-hand side is used. In general, when you select a connected connection in the GUI browser, it is set as the current connection and will be used if there is no information to the contrary in the environment of an executed block.

Common UI Blocks[Bearbeiten]

There are blocks that can theoretically be used with each technology, although some functionality may not be supported. You can find them in the Common GUI Library. They use their own test runner which knows the connections of all the technologies used. It uses the following environment variables:

Variable for the Test Runner Variable for the Active Connection
Master TestRunner MASTER_TEST_RUNNER CURRENT_MASTER_CONNECTION

Since expecco 22.2, the current connection of the Master Test Runner will be always set whenever a technology block changes the current connection. The same applies for selecting a connection in the GUI Browser.

Caution With Parallel Connections[Bearbeiten]

If your test uses only one connection, it makes no difference whether you use a Common UI block or a technology block. However, with multiple connections you need to be careful! Because the Common UI blocks do not know which technology to use, you must also ensure that the correct connection is set if you are using two different technologies in parallel. If you are using technology blocks, this is not a problem because different test runners and environment variables are used for the different technologies.



Copyright © 2014-2024 eXept Software AG