| Version 3.4.7 |
| Distributed test development |
The previous chapters all focused on creating and organizing sets of reliable tests in a single test-suite. However, when testing a large application, a single suite may not be enough. There are at least two scenarios where splitting tests into multiple test-suites becomes essential:
QF-Test provides a set of advanced features that make it possible to split and arrange tests across a set of test-suites. Multiple developers can work on separate parts of a test, then coordinate their efforts, merge the 'Components' of their suites and create libraries of shared 'Procedures'.
This chapter first explains the various mechanisms for distributed test development and how they interact. The final section then summarizes these in concise step-by-step instructions on how to approach large testing efforts with QF-Test.
| Referencing nodes in another test-suite |
It is possible to reference 'Procedures' and 'Components' in a test-suite other than the current one. These references can be explicit or implicit through included files:
packagepath.procedure becomes
suite#packagepath.procedure.
While implicit references are more convenient in most cases, they can make tests harder to understand because it is not immediately obvious where the 'Procedure' or 'Component' referenced by some node is actually located. One possibility to find out is to select "Locate procedure" ([Ctrl-P]) or "Locate component" ([Ctrl-W]) from the context menu. Additionally, QF-Test provides the menu items »Extras«-»Make references absolute« and »Extras«-»Make references implicit« which let you toggle quickly between the two modes without changing the actually referenced nodes.
In both cases, the referenced suite can either be given a relative or absolute filename. Relative filenames will be resolved relatively to the directory of current suite, or - if that fails - relatively to the directories on the library path (see option Directories holding test-suite libraries). Always use the forward '/' as the directory separator, even under Windows. QF-Test will map it to the correct character for the system it runs on. This keeps your test-suites independent from the operating system.
Note Your 'Package' and 'Procedure' names as well as 'Component' 'Ids' should not contain any '\' or '#' characters. If they do, you need to include an escape character in the 'Procedure call' or the 'Component id' id attribute. See section 36.6 for details about escaping and quoting special characters.
When choosing the 'Procedure' for a 'Procedure call' or the 'Component' for some event in the dialog, QF-Test offers a selection of all currently opened test-suites. If a 'Procedure' or 'Component' from another test-suite is selected, QF-Test automatically creates the correct reference, taking included suites into account. When the test is run at a later time, the referenced test-suite is loaded automatically if necessary.
During execution QF-Test keeps a stack of currently executing suites. Whenever a 'Procedure' is called in another suite, the called suite is pushed on to the top of this stack and removed when execution returns to the calling suite. Whenever during the execution of a 'Procedure' a 'Window' or 'Component' is referenced by its id, QF-Test searches through this stack of suites from the top to the bottom, i.e. first in the test-suite of the called 'Procedure' and then in the calling suite, always checking any included files along the way. This process is quite complicated and you should take care to keep your include hierarchies simple. In case you encounter problems anyway, a detailed explanation is given in section 36.7.
| Managing 'Components' |
As we have emphasized in chapter 6, the 'Components' are the essential part of a test-suite. If the SUT changes between releases, these will likely be affected most. If changes are so massive that QF-Test cannot adapt automatically, the 'Components' will have to be updated manually. This is why you should try to avoid redundancy in the 'Component' hierarchy of your tests more than in any other part.
Therefore, when splitting your tests across multiple test-suites you should try to keep the 'Components' together in one central test-suite and include this suite from the other suites. For very large applications you may want to split the 'Component' hierarchy into parts, each related to a separate part of the SUT's GUI.
Maintaining this central 'Component' library is not trivial. The problems that will arise can be resolved with QF-Test as follows:
| Merging test-suites |
Test-suites can be merged by importing one test-suite into another with the »File«-»Import...« menu item.
You can select the areas of the test-suite, which should be imported.
You have to take care about a correct Include/Reverse-Include of your test-suites to ensure, that all calls and component references are still valid. See chapter 25 for details.
| Importing Components |
During import, all 'Windows' and 'Components' of the imported test-suite are integrated into the component hierarchy of the importing suite. 'Components' that already exist are not copied. An 'Id' conflict (identical components with different 'Ids' or differing components with identical 'Ids') is resolved automatically by changing the 'Id' of the imported component.
Afterwards, all 'Windows' and 'Components' are removed from the imported suite. All nodes in the imported suite that referred to these 'Components' are updated accordingly. Ideally, the imported suite should include the importing suite so no explicit suite references will have to be created.
| Importing Procedures and Testcases |
As you can import 'Components' QF-Test also allows to import 'Procedures', 'Packages', 'Dependencies' and 'Test-cases' as well as 'Test-sets' by choosing 'Procedures' or 'Tests' in the import dialog. You should take care about keeping all calls consistent, e.g. in most cases it does not make sense to import 'Procedures' without their required 'Components'.
In case you only want to import one dedicated 'Procedure' or 'Test-case' you can use the button 'Detailimport' on the importdialog. Here you can choose any node you want to import separately.
| Strategies for distributed development |
There is no single best way of test development or organization, but one approach that works well is the following:
setName() and that unique names
are assigned consistently where needed. Where setName()
is not an option, try to implement
ComponentNameResolvers to achieve this (see section 39.1). You should be able to record and replay
sequences without much ado and without "polluting" the
'Component' hierarchy after trivial changes in the user
interface.
Of course, the above scheme can be extended to have several master suites for testing different parts or aspects of an application. It may be a good idea to ensure that the component hierarchies in these suites don't overlap too much though. This will save you the effort of maintaining all these hierarchies in case the user interface of the SUT changes significantly.
| Last update: 04/23/2012 Copyright © 1999-2012 Quality First Software GmbH |