Efficient working techniques

This chapter will help you in optimizing your working techniques and avoid unnecessary steps when working with QF-Test.

Using QF-Test projects

The previous chapter describes the creation of several test suites. As you can image the amount of test suites will increase over time. You can get a better overview over them using a QF-Test project.

QF-Test projects show all involved test suites in a very nice way. Furthermore projects automatically take care of propagating modifications to referring test suites. You can find more information about projects at chapter 9.

Creating test suites from scratch

In the previous chapter we described the concept of creating maintainable test suites by utilizing procedures and variables within QF-Test. Normally people start recording very long sequences and splitting those into smaller parts or even procedures later. It is very hard to split up long sequences as you have really to walk through the whole one to find proper boundaries. Another disadvantage is that you cannot see parts which have already been implemented in existing test cases or procedures.

Instead of that described workflow we recommend to plan the tests and their test steps including procedures first. Then you can start recording procedure by procedure. We came to the conclusion that anticipatory recording and creation is very helpful especially for working in bigger teams. A typical workflow for creating those procedures looks like this:

  1. Plan the required procedures first.
  2. Also plan the required package structure first.
  3. Record every procedure as a separate sequence.
  4. Rename the recorded sequence like the procedure should be called.
  5. Transform the recorded sequence into a 'Procedure', using the »Transform node into...« action from the context-menu of QF-Test.
  6. Move the 'Procedure' to the correct location.
  7. Replace test data with variables, either manually or by using the parameterizer (see subsection 8.5.4)
  8. Add the variables to the 'Variable definitions' of the 'Procedure' node, possibly specifying default values.
  9. Describe the procedure in its 'Comment' attribute, see section 8.7.

An alternative approach of creating procedures is the automated creation provided by QF-Test. This concept is described in chapter 25.

The standard library qfs.qft

QF-Test provides the standard library qfs.qft which is included per default in every test suite.

This suite contains many useful procedures for accessing components, the file system or a database. Please take a look at that library before you begin implementing something that has already been solved by us.

Component storage

QF-Test records new components in the test suite where you press the 'Stop recording' button. Therefore it could happen that you record components in the wrong test suite.

If you want to move those components into another test suite you must always use »File«-»Import« from the target suite. Take care to ensure that both suites belong to the same project or to specify correct ''Include files''/''Dependencies' relations in those test suites. This workflow is described in detail in section 24.2.

3.1+ For cleaning your component structure in a test suite you can first import the test suite into itself. Then you can select the 'Windows and components' step, open the context menu via a right mouse-click and click at »Mark unused components...«. You will get a list of all components which are not used in the project. If you are sure that those components can be removed, then select the »Remove unused components« in the context menu of the 'Windows and components' step.

Note As soon as a Component's comment contains any text it is considered used, even if it has no references.

Extending test suites

Several workflows can be followed to extend existing test suites:

  1. Simply record and extend the target test suite directly.
  2. Work with a scratch suite as described in chapter 24.

If you extend testsuites directly via clicking at 'Stop recording' in that suite, then you have to care about the recorded components. In case you have changed the recorded component hierarchy under 'Windows and components' the newly recorded components will be recorded in the normal hierarchy again and you have to move the new components to the optimized hierarchy. Another aspect is that it could become very difficult for moving single components into another test suite under the right location there.

If you work in a scratch suite you can create the new test steps temporarily in a completely new test suite and import the recorded components and the created procedures and test cases into the target suites together.

A detailed workflow for extending a test suite from level 1 (from section 35.4) could look as follows:

  1. Create a new test suite.
  2. Add the test suite to be extended to the 'Include files' area of the new one.
  3. Save the new test suite.
  4. Ensure that both test suites belong to the same project or add the new test suite to the 'Dependencies' area of the test suite to extend.
  5. Record the new test steps in the scratch suite. Also create 'Procedures', if required.
  6. Then import the components, procedures and tests into the target test suite as described in section 36.4 and section 24.3.

A more detailed description of working in multiple test suite can be found in chapter 24.

Working in the script editor

The script editor of QF-Test contains some fancy features to avoid too much typing actions.

If you want to call methods of the run context rc, you can simply type rc. and press [Ctrl-Space], then you will get a list of all available methods.

The autocompletion is also working for several variable names, which are:

doc Methods of a DocumentNode.
frame Methods of a FrameNode.
iw Methods of the ImageWrapper.
node Methods of a DOMNode.
Options The keys and values of QF-Test options to set.
qf Methods of the qf module.
rc Methods of the Run context.
resolvers Methods of the Resolvers module.
Just press [Ctrl-Space] without typing anything A list of all variables with autocompletion.
Table 36.1:  List of variables with autocompletion.