Logo QF-Test

Tutorial as a practical
introduction to QF-Test

 

Free Trial  Download  Buy

Yann Spöri, QF-Test development & support

The QF-Test examples, demos and practical exercises give you a quick start.

Yann Spöri,
Software Engineer, QFS

Uwe Klüh, Senior Sales Manager, QFS

Search for the information you need in the whole documentation (Manual, Tutorial, Mailing list, Standard library) by using the onsite-search.

Uwe Klüh, Sr. Sales Manager, QFS

Tutorial

11
Creating a Test-suite [45-60 min]
11.1
Introduction

This chapter will take you through the steps necessary for creating your first test-suite:

  • Starting the SUT from within QF-Test.
  • Recording some actions and organizing your test-suite.
  • Creation of tests which checks real functionality within the SUT.
11.2
Starting the Application

Open a new (empty) test-suite from QF-Test with the »File«-»New Test-suite...« menu option. Please be aware the "old" test-suite remains open as a different window.

Make sure that the detailed view is turned on, it can be toggled with the »View«-»Show Details« menu option. You now see the divided window with a tree on the left-hand side and a pane on the right-hand side representing the details of a selected node. Using the tree you can navigate through the test-suite's nodes; when you select a node, you'll see its properties appear within the details pane on the right.

At the beginning the application to be tested needs to be started from QF-Test. In this case it will be the browser showing the "Web demo" page which is already known from the previous chapter. The QF-Test Quickstart Wizard will help us to create an appropriate setup sequence.

Please open the Quickstart Wizard via the »Extras« menu. He should welcome you as shown in the figure below. After saying a short hello please press the "Next" button.

Figure 11.1:  The Quickstart Wizard

Next you can choose the type of application to be tested. Please select "A web page in a browser" and continue.

Figure 11.2:  Select type of SUT

Now you are asked about the URL of the web page to be tested which will be the "Web demo" page. The simplest way to enter it is to open the file browser by clicking the Select web page button on the right side of the text field and navigate to the qftest-x.y.z version specific directory and from there to .../doc/tutorial/web/en where you can select the index.html file. Afterwards please proceed to the next wizard step.

Figure 11.3:  Specification of the URL.

On the next pane you are asked whether your web application to be tested is based on an AJAX toolkit. Our demo does not use one of those toolkits but we can simply keep the recommended auto detection and proceed to the next wizard step.

Figure 11.4:  AJAX toolkit.

It's time now to select the browser to use. On Windows it's most likely the Internet Explorer which is already preselected and we will choose that one for our first own test. On Linux you may chose Firefox.

Figure 11.5:  Browser selection.

On this pane we have the option to specify a special Internet Explorer compatibilty mode in case the web page to be tested only works properly with a special IE version. As this is not necessary in our case we simply proceed to the next wizard step. (If you had Firefox selected, you will see a different pane where you need to provide the installation directory of the Firefox you want to use.)

Figure 11.6:  Internet Explorer compatibility mode.

The next step provides the option to start the browser wrapper by use of a dedicated Java version. This may be necessary in case you have multiple Java versions installed on your machine (i.e. 32bit and 64bit) or if Java applets are involved. In most cases you might simply be able to continue with the default value.

Figure 11.7:  Java executable for starting the Browser wrapper.

This step gives us the option for some basic browser settings. You can simply keep the proposed settings and continue.

Figure 11.8:  Browser settings

As we only want to work with one browser window, you can also continue at the next step without any change.

Figure 11.9:  Browser window name

It's nearly done. We have just to assign a name to our client as a reference. Let's simple call it "web". Please let the check box on the page untouched empty and press "Next".

Figure 11.10:  Client name

Finally some information is given about what to expect when the wizard finishes its task of creating a setup sequence and where to find help in case of troubles. Please disable the "Start automatically" option, as we first want to take a look at the generated setup sequence and start it by hand. Now please press "Finish".

Figure 11.11:  Final Information

The generated setup sequence appearing under the "Extras" contains five main steps:

  1. Set global variables
  2. Start browser without window
  3. Perform browser settings
  4. Open browser window with URL
  5. Install CustomWebResolver
Figure 11.12:  Generated Setup Sequence

You already know the first four steps from the previous chapter. The last step is new and starts the automatic detection for Ajax toolkits to activate respective resolvers.

You can have a look at the details of some of the nodes if you like. Basically you will find the values you provided during the Wizard steps assigned to the respective node attributes.

Now we want to see some action. Please ensure the "Setup" node is selected. Then click the Play replay button or simply hit "Enter".

After a few second the browser window is expected to appear showing the web demo page similar to figure 10.4 from the previous chapter:

11.3
Adding a Clickstream Test

You're now ready to add a simple clickstream test.

  • We want to start the recording from the "Welcome" page. Please ensure it is selected.
  • In QF-Test now press the "Start recording" button Record and switch to the browser window. From now on every mouse and keyboard action performed within the SUT window will be recorded.
  • Now please change in the browser to the "Radio buttons & check boxes" page (see figure 10.14 in previous chapter) and perform some actions there and conclude by pressing the "submit" button.
  • Finally switch back to your QF-Test test-suite window. Press "Stop recording" Stop. You'll find the recorded sequence placed under "Extras" node on the left side of the main window, as seen below:
Figure 11.13:  The Recorded Clickstream

The name of the recorded sequence will be entered in a standard fashion by QF-Test as the time and date of the recording. You can change this name as you see fit by simply clicking on the node and changing its properties in the details view on the right.

Inside the sequence, beside "Mouse click" nodes there are also two "Wait for document to load" nodes. QF-Test creates such automatically when a new document gets loaded. In our case that's on the initial change to the "Radio buttons & check boxes" page and after pressing the "submit" button, which also cause a reload.

We want to replay the newly created sequence right away for verification. In advance we may not forget to change to the "Welcome" page as this was the starting point of the recording. Then we select the sequence node and execute it using the Play button. You should now see your exact sequence of mouse and keyboard events replayed within the browser window.

Before creating a more complex test we will first structure the recorded sequences into a test-suite.

11.4
Building a Test-suite

So far we have worked in the "Extras", which is a kind of sandbox for experimenting. Now we want to create a real test-suite.

At first please select the "Test-set" node an change its name to e.g. "Webdemo". Next expand the node and change the name to the enclosed "Test-case" node e.g. to "Clickstream".

Then we need to move the setup sequence from the "Extras" into the test-set, at the first position to be more specific, that means before the "Clickstream" test-case. Moving the "Setup" node can be accomplished with mouse (Drag&Drop), context-menu (use a click of the right mouse-button) or with the [Control-X] (cut) and [Control-V] (paste) keyboard commands.

Note When using Drag&Drop a target node can be expanded by having the mouse cursor hovered above the "+" left of the target node.

Now it's time to move your recorded Clickstream sequence from the "Extras" node up into the "Clickstream" test-case node. If the sequence still has the time stamp as name, you might want to turn it into something more meaningful.

Lastly you can create a "Cleanup" sequence to stop the application. This sequence contains two nodes: One to stop the client and one to ensure that it actually terminated. From the figure below, you should be able to see what nodes are necessary to carry out this little exercise (you might want to look under "Dependencies" and "Process nodes").

Figure 11.14:  The Organization of your Test-suite

Now you've completed the most important steps of structuring a test-suite. In the following section you'll extend your test-suite by introducing a check of a specific text-field.

11.5
Adding a Text Check

Let's create a little more complex test in which we will fill a form and check the result string.

  • In case the browser isn't running please execute the setup sequence. Otherwise switch back to the "Welcome" page to have a proper initial state. In QF-Test now press the "Start recording" button Record and switch back to the browser window.
  • Select the "Input text" page via the menu bar. We know the page from chapter section 10.5.
  • Then please fill in the form with some data and press the "submit" button. A string is printed in the text field at the bottom of the page, containing a summary of the given data.
  • We want to record a check for the result string. For this please click in QF-Test the "Record a check" Record a check button and switch to the browser window. Now when you move your mouse over the components they get highlighted by a frame. To record the check, move to the respective text area at the bottom and right-click. You'll then see a popup menu appear which gives you the choice of several checks, starting with "Text", as seen below:
Figure 11.15:  Recording a Text Check
  • Choose "Text" from the popup menu, return to your test-suite window and stop recording using the Stop button.

    Note Instead of returning to the test-suite to activate the check mode by pressing the Record a check button, you can also utilize [F12] while remaining in the SUT. This hotkey activates/deactivates the record check mode.

You should now have the know-how to organize the recorded sequences into a test-case. You can compare your results with the way we organized the suite and renamed the sequences. Additionally we transformed sequences into "Test-step" nodes which specify them more clearly and make them also visible in the test report.

Figure 11.16:  The Text-Check Test Organized into the Tree Structure

Note Transformation of nodes can be easily done via menu »Operations«»Transform node into« or also a nodes context menu.

At this point, you can give your new test a shakedown run. Stop the SUT client now if it is running, click on the root test-node, and start execution by hitting the Play replay button. Does anything work as expected?

The result of the test-run is stored in the run-log. To view it just make use of the error dialogs "Open run-log" button or use the »Run«-»1. ...« menu option or take the short-cut [Control-L].

Figure 11.17:   The Run-Log of Your Test

Within the run-log you see that the "Setup"/"Cleanup" pair is executed before and after each test-case.

Note Starting and stopping the SUT before and after each test-case is a safe way for a proper state but a time consuming one. Typically you will try to start the SUT only once and use others methods for resetting it to a defined status.

In this test there were no errors or exceptions in the test-run. But you can see yellow frames around some nodes, which indicate warnings. In case of the webdemo they are caused by components which have no name assigned. We will not dicuss those warnings here any further, but you will find detailed information on the importance of component names in the user manual.

Upon closing the run-log window you will be prompted if you want to save the run-log (since it will only be available until QF-Test ends).

Let's modify the test now so that we cause an error in the text-check. Click on your "Check Text" node so that you see its details displayed:

Figure 11.18:  Properties of the "Check Text" Node

In the "Text" field you see the value that QF-Test expects. Change this text to some other arbitrary value and re-run the test.

Now when you replay the test, a dialog box appears at the end indicating that there was an error."

If you open the run-log, you'll see that red-fields now enclose certain nodes, indicating that some error occurred inside the child-nodes. You can use the run-log menu option »Edit«-»Find next error« to jump directly to the node which caused the error or use the [Control-N] keyboard shortcut.

To correct your check node again you can use a helpful feature in QF-Test. In the run-log simply click right on the node indicating the mismatch and select "Update check nod with current data" from the context menu.

We did it. Your first test-suite is completed. Finally you might want to save it.

Videos Downloads Documentation Buy Free Trial