Creating a command to use a GeneXus Procedure

From GXtest Wiki
Jump to: navigation, search
Spanish.gif
English.gif
Japan.gif

Using a GeneXus Procedure from within a GXtest Test Case makes it possible to enter validation at the data level (implementing GeneXus logic to verify the expected state of a database) or to run whatever kind of action or calculation with GeneXus programs. They can have any number of input and output parameters.

Contents

Creating a GX Proc

First you’ll see how to create a GX Proc in GeneXus so that it is exposed as a Web Service and then how to load it into GXtest.

Defining a Procedure as a GeneXus Web Service

Here is an example of how to create an addition procedure. This can be used to have GXtest add together two numbers in a Test Case.

Definition of the procedure:

Rules

Parm(in:&NumA, in:&NumB,
     out:&ResultSum,out:&OtherVariable);

In the example there are two outputs, the result of the addition and another value, which are included only to show that it is possible to manage several output parameters at the GXtest level.

Source

&ResultSum = &NumA+&NumB
&OtherVariable = 4

Properties

  • Call Protocol: SOAP
  • Main Program: True

Loading the Procedure into GXtest

Open the menu to create the GX Proc.

AccesoProcGX.jpg

Then click on Add GX Proc that will bring up a window where you can load the GeneXus Procedure:

DefinirProcGX.jpg

Here you can enter the URL to the GeneXus Procedure’s WSDL and click BotonRefresh.jpg.

Once done it will have loaded the procedure's definition and you can see then name and the input and output parameters for the procedure. In the addition example you can see in the following image how the parameters are displayed.

ProcSuma.jpg

Here you can edit the name that will refer to the command, the description and whether you will use Action or Validation.

Using a GX Proc

Once you have created the GX Proc it is ready to be used by GXtest the same way as any other native command, allowing you to add it and edit it manually.

UsarProgGX.jpg

Note that you can load the output parameters into variables and the input parameters can be come from a variable, fixed values and Data Pools.

Adding procedures used like validations

Sometimes you need to use a GX Procedure to evaluate a condition in your database. This kind of procedures, could only have one output value: The True/False response.


This output could be "T" for True conditions, and any other string, to False ones.

For example:

If you build a procedure named ExistClient (in: idClient) The returned value "T" will mean that client with id = idClient exist, otherwise, you can return a text like "The client doesn't exists", and GXtest will assume that is a False response.