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 a connection being specified directly. Instead, they use the connection that is available. However, when running a testplan, several 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. Which connection to use can be set by an entry there. Usually this is done automatically on connect and can be modified by appropriate blocks. This option typically takes effect within 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 several connections are used in parallel, the variable environment can be used to specify which connection should be used. Each technology has its own fixed name by which a so-called test runner is stored in the environment and another name by which the current connection is stored. The test runner has a mapping between connection names and the respective actual connection. For each used technology, an appropriate test runner will be created if required and will stored in the variable environment, so it can be found there 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. They write the connection name in the variable environment. A normal action block will now retrieve the name of the active connection and the test runner it belongs to from the environment and knows like this which connection to use. If there is no information about this in the environment, it will use instead the connection that was last selected in the GUI browser. Disconnecting by name also is 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 created automatically in the executor environment, so they are present for the whole execution, but are gone as well, after the execution finished. Alternatively you can define one of those variables in the environment of a testplan or block. In this case the variable there will be used. This makes it easier to use two connections in parallel in one execution.

Example 1: Execute the same sequence on two connections in parallel
In each of two blocks set the environment variable for the active connection. Then set a different active connection for each of them and after that add the same block containing the desired sequence. 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 as well use several test runners. In this case, define the environment variable for the test runner for your test. If 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]

When creating or editing testsuites, the GUI browser is very helpful. You can use it to create new connections, all active connections are displayed there and you can create or edit test sequences, for example by using the respective recorder of the appropriate technology.

In the GUI browser you can execute single blocks. For them the connection that is selected on the left side will be used. Generally, when selecting a connected connection in the GUI browser, it is set as current connection and will be used, if there is no different information in the environment of an executed block.

Common UI Blocks[Bearbeiten]

There are blocks that can theoretically be used with each technology, though some functionalities might not be supported. You find them in the Common GUI Library. They use their own Test Runner, which know all connections. 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, there is no difference whether you use a Common UI block or a technology block. With multiple connections however you must be careful! Because it is not known at the Common UI blocks which technology is to be used, you must also ensure that the correct connection is set when using two different technologies in parallel. If you use technology blocks, you have no problems here, because different Test Runners and environment variables are used for the different technologies.



Copyright © 2014-2024 eXept Software AG