Business-related Procedures

As stated in the previous section business-related procedures represent a real business workflow in your application. You can find a sample at qftest-7.1.2/demo/keywords/simple_business/SimpleKeywords.qft. The respective test-plan can be found at qftest-7.1.2/demo/keywords/simple_business/simple_keywords.xlsx. Please take care to copy the demo folder to a project-related folder first and modify them there.

The sample shows the "Create vehicle" test case of the QF-Test CarConfigurator. It consists of following test steps:

  1. Launch SUT, if necessary
  2. Open vehicles dialog via Options -> Vehicles
  3. Enter data (name and price)
  4. Press new in order to create the vehicle
  5. Press OK in order to close the dialog
  6. Check creation of vehicle in table

Let's take a look at the Excel file now:

Figure 29.1:  Excel file business-related keywords

As QF-Test can read excel files row by row, we have decided to go for that excel structure. Reading that file follows the data-driven concept (see section 40.4). It's also possible to use another structure of the excel file, but then we lose the advantage of using the QF-Test functionality directly without any scripts or if-conditions.

In the first row we find the values teststep, value1 and value2. That row will be interpreted as variable names by QF-Test. Every subsequent row will then contain respective values for those variables. This mechanism allows QF-Test to walk through that Excel file in order to execute the planned test steps.

Now let's take a look at the test suite SimpleKeywords.qft. The test suite looks like this:

Figure 29.2:  Test suite business-related keywords
NodePurpose
Test set "Scenario" Represents the container node for the test execution. This node could be omitted theoretically.
Dependency reference dependencies.sutStarted The concept of dependencies allows QF-Test to manage the starting and stopping process of your application in an intelligent way. Dependencies can contain a strategy in case of any unexpected behavior during test run. See section 40.3 for details.
Test case "Create vehicle" This node represents the implemented test case.
Teststep "Walk through test steps" This node is required to read the excel file with a data driver node.
Data driver "steps from excel" A data driver reads the content of the Excel file row by row.
Excel file "steps from excel" Points to the Excel file.
Test step "Generic test step" This node will be filled with the current test step name from Excel during execution. This approach will create a readable report.
Call procedure "business.$(teststep)" Here the respective procedure defined in Excel is called. The variable teststep will be filled with the planned data of Excel because of the data driver mechanism.
Table 29.5:  Structure of SimpleKeywords.qft

All required procedures are implemented in the package business. In order to allow a simple variable definition any steps in Excel use the variables value1 and value2. Every procedure maps those generic names to the specific parameters of the procedure itself.

Figure 29.3:  Procedure fillDialog

This concept requires that any used keyword has to be implemented in QF-Test already before using it. If your steps require more than two parameters you need to extend the excel file with more columns. In addition you need one test case node in QF-Test per test case in Excel. You can make this more flexible, see section 29.5.