Keyword Driven Testing - ALL4TEC



Keyword Driven Testing

Generated automation scripts are described with generic keywords immediately usable in most automation tools (QTP, Selenium, TestStand…). They describe all input contexts and expected results needed. The execution of instantiated scripts drives the System or Software Under Test and automatically generates test reports.

Keyword Driven Testing

Test functions are associated to the transitions simply by a drag/drop action. After that, the user has just to do the mapping of the transition’s parameter(s) with the test function parameter.

 

Overview

In MaTeLo, you can automate the generation and execution of test script based on usage model. The Testor view creates the primitives of its testing environment and their implementation. Then it associates the primitives to transitions of its usage model using the Editor view. After generating one or more test cases with MaTeLo, the user can chose to record these test cases in a proprietary format: the proprietary format is actually the concatenation of all the implementations call of primitives test-configured in compliance with the test case.

Then, the user can run the generated scripts on the test platform using his own executive testing environment.

Define the Test Platform

To define a test platform in MaTeLo, select in the library the sheet Test Platforms and on the folder Test platforms library by a right click on select Scripting.

Within MaTeLo, a Proprietary Test Bench is divided into four groups (used like folders):

  • Setting

It contains the script function and its parameters used to stimulate in the testing environment.

  • Measurement

It contains the script function and its parameters used to perform check in the testing environment.

There are two ways to define a Test Bench:

  • By importing a set of functions definitions from an existing proprietary test bench file of another MaTeLo project.

Select File > Import > Test Platform > Scripting File.

  • By creating manually each function definition through the Usage Model Editor GUI.

Right click on the folder Setting > Select Operation or Test Sequence

 

When you have created an operation, select edit script to define the function for your testing environment.

 

 

The Usage Model Editor launches the Setting or Measurement Function Definition window, which allows you to define all the characteristics of the function.

To define the parameters of the script function, select by a right click on the function created New Child then Parameter.

In the Properties windows under the library, we can modify the default type and name given for the new parameters.

The different parameters properties to be defined are the following:

  • Name – The name of the parameter, as declared in the function prototype or in the subsequence.
  • Data Type– The parameter’s data type. The allowed types are:
  • Default Value – The default value of the parameter.
    • Decimal, String or Integer

 

 

 

Name – The Name of the primitive. It is not possible to have multiple primitives with the same name.

Output File – The output file on which this primitive will be concatenated.

Script Path – The path to the file containing the code displayed and editable in the Body Function area. This path is the path of the backup file.

 

In the script editor that appears on the center, write the operation in compliance with the testing language.

 

Function Body – The implementation of the test function. This field is a text area with syntax highlighting key words "classic programming". There are also syntax highlighting of the parameters used in the primitive and keywords MaTeLo.

You have then to define the function parameters as to be able to pass data to the step, using the Parameter Definition done in the library. The Parameter must defined to be correctly considered with the character $ before. Once a parameter is selected, the Parameter appears in red, is updated and presents its properties, as shown below.

The parameters will be replaced directly into the body of the implementation of the associated primitive by the input value, OUTPUT value or constants associated transition during the test case export to the file script.

 

 

Associating Proprietary Test platform Functions to the Usage Model

 

Once the Test Platform functions are defined, you have to associate some of them to some transitions of the usage model. Each associated function of each visited transition during a test case produces a call of this function in the generated script.

We describe here how to associate the functions to transitions using Usage Model Editor.

By “associating functions to transitions” we mean:

On a transition of the usage model, setting one or more references to Proprietary Test platform functions in a particular order, and giving values to their parameters. These parameters can be valued.

 

Each Parameter has to be valuated, so that MaTeLo can set the value to the step function.

 

The parameters are presented on a line, in a 3-column table presenting:

  • The Parameter Name – The name of the parameter as set in the function definition. This field is not editable.
  • The Value Category– The way to value the parameter. Assuming that one or more Outputs and an Input are created on the transition, you can choose to pass 3 types of value to the parameter:
    • Input – The value of the chosen input is passed to the parameter.
    • Output – The value of the chosen OUTPUT is passed to the parameter.
    • Value – The parameter is set to a fixed value
  • The Value from– Depending on the chosen parameter type, a text field or a comboBox allows to set the value to pass to the parameter:
    • If the chosen parameter type is Input, a comboBox presents a list of the input or sub-elements of the input (if the input is a sequence) that are compatible with the parameter data type. (Table below presents the compatibilities between MaTeLo and proprietary test bench parameters data types).
    • If the chosen parameter type is Output, a comboBox presents a list of all the Outputs or sub-elements of the Outputs (if the OUTPUT is a sequence) that are compatible with the parameter data type.
    • If the chosen parameter type is Value, a text field allows for filling the fixed value. If the parameter is a Boolean, a comboBox allows choosing “true” or “false”.

Notes:

By Default, the parameter type is set to “Value” and the Value is set to the default Value set in the function definition.

 

Generating Script Files

 

This part explains how to generate the test script from the test case associated to the project. It supposes that you have generated and added the test case to the project. To add a test case to the project, proceed as explained hereafter:

In the Generation perspective, Right click on the test case that you want to keep and click on Add to project.

The test case(s) appears in the Project explorer window in the Test Cases corresponding to your project.

 

Select in the toolbar: File -> Export -> Test Case -> Export test case(s) to script.

 

Specify the destination folder if you want to avoid the default path.

Select the test case (s).

Select the test platform corresponding to the current model (you can manage many platforms for one test model).

Click on Finish.