Difference between revisions of "GXtest Designer User's Manual 1.0"

From GXtest Wiki
Jump to: navigation, search
(Variable Parameter)

Revision as of 10:19, 18 December 2009

This page discusses the main features of GXtest Designer.

Contents

Introduction

The objective of GXtest Designer is to easily model a Test Case and do the same for application made with GeneXus on different platforms and with different versions of GeneXus.

Test Cases are modeled on an as a diagram made up of a cluster of Nodes and Edge Lines, where the nodes represent the pages of an application and the edge lines represent the events that happen going from one Page to another. These elements (pages and events) can have commands associated with them. There are three types of commands: actions, validations and events. The three types are explained in more detail in the Commands section. In addition, you can include embedded Test Cases in a model to create modules that can be reused. You can also include Decision nodes that choose which action to be taken depending on the result of a Validation. All of these concepts will be explained in more detail in the manual.

GXtest Designer GUI

The image below shows the different parts of the GXtest Designer GUI.

Gxtest full view.jpg
  • Main Panel: the main panel displays the Test Cases and the results of their execution. It is the program main work area.
  • Projects: This panel contains all project elements such as Test Cases and Data Pools.
  • Elements: This panel contains all elements of a Test Case. The elements can be dragged to the main panel in order to build Test Cases.
  • Commands: This panel displays the commands (actions, validations and events) of each element of a Test Case .

Besides these four main panels, the image also shows a toolbar used to help build Test Cases as well as the Pan & Zoom feature that allows navigation and zooming within the Test Case.

Login / Connections

When the GXtest program is run it brings up the following screen:
Imagen:login.jpg

Here it is possible to choose which database GXtest will connect to and with which user you will connect. If user accounts don’t exist in the specified database it is possible to connect with the username Guest.

Connection Management

In the same Login screen, next to the list of databases there are two buttons, the first is used to edit connections and the second adds a new connection. Pressing the + button brings up the following window:
Imagen:AddConnection.jpg

In this window you can indicate:

  • The name of the new connection
  • The instance of the SQL Server that will be used to connect
  • The name of the database
  • The authentication mode used to access the Database

Once you have added the connection it will appear in the Login window allowing users to work with different project repositories and Test Cases directly from their machine.

Projects

The first step to begin using GXtest is to create a project. To do this click on Project > New Project. In the new window you can specify the project’s properties.

  • Name of the project
  • The KBs associated with the project (see also how to import a GeneXus KB)
  • Default Browser
  • Default URL
CreateNewProject.jpg

The name entered will identify the project. The KBs (Knowledge Bases – GeneXus source code) are the applications to be tested. You can choose a several KBs when an application is made up of more than one for example applications that use GXportal o GXflow. A KB imported into GXtest can only be used in one project and cannot be shared. The default browser that will be used (this version allows you just to use Internet Explorer). The default URL has two functions:

  • First it is used when you begin to record a Test Case, the browser will suggest this URL.
  • Second, if a Test Case uses the variable urlHome, (which will be used in tasks done by GXtest Manager), the default URL will be used for this variable. For more information about this property in GXtest Manager see the GXtest Manager Manual.

You can open a project by going to Project > Open Project. If you decide to delete the open project, go to Project > Delete Project. Remember that this will not delete the KBs associated with the project.

Exporting and Importing a project

GXtest allows you to export all the Test Cases of a project and its Data Pools. This allows you to duplicate a project if it is necessary. It is important to remember that the export will not export the KBs associated with the project. In order to duplicate a project you must export it and then import it using the following steps:

  1. To export a project go to Project > Import & Export > Export Project. Here you can choose the project to be exported and where you would like to export the file that contains the exported project. GXtest then opens a new window displaying the test cases and Data Pools that were exported.
  2. Creating a new project: Create a project and associate it with the same KBs as the project exported in step 1.
  3. To import the project go to Project > Import & Export > Import Project and select the project created in step 2. GXtest will then ask you to choose the ZIP file that contains the data from the project exported in step 1. When finished, GXtest will display the results of the import.

GXtest and GeneXus KBs

GXtest automates applications by relating user’s actions with the KB’s objects instead of HTML objects like traditional testing tools do. This allows it to have traceability between Test Cases and to use the Test Cases independently of the technology used similar to using GeneXus.

Important: Each KB that is imported into GXtest can be associated with only one project, that being so if you create a new project you will only be able to associate with it KBs that are not being used by any other project.

Importing a GeneXus KB into GXtest

To work with GXtest you need to import the information from the KB or KBs into the application to be tested. The information needed from the KB are the WebForm controls for Transactions and WebPanels. It doesn’t use anything else related to the programming, events or anything else.

Just go to KB > Add KB. Imagen:ImportarKB.jpg

If you don’t want to import an entire XPZ, you can use the convert function to send only the data needed by GXtest. To do this go to KB > Convert to GXtest.

Note: It is recommended that when importing KBs they should be accessed locally because network access creates a large increase in the response time.

Importing a KB from GeneXus 8 or 9

These kinds of KBs can be imported into GXtest by using an XPZ or GXPublic.

If you want to import it using an XPZ, select File in the Type dropdown box and then choose the location of the file. Imagen:ImportKBFile.jpg

If you want to import using GXPublic, select GX Public from the same drop-down box and then choose the location of the file. Imagen:importKBGXPublic.jpg

Once you have selected the location, the models in the KB are shown and you can select which ones you want to work with.

Importing a KB from GeneXus X or GeneXus X Ev1

If you are working with GeneXus X you must install the GXtest Extension and use it to export a KB. The extension will only export an GXT extension file with the necessary information to be used in GXtest. After this is done the file must be imported into GXtest.

GXtest Extension

GXtest Extension is a GeneXus X extension that allows you to export KBs in GXT format. To install, copy the file GXtest Extension.dll for GeneXus U4 (if you need an extension for a different version of GeneXus please contact technical support) into the Packages folder in the GeneXus program files. After restarting GeneXus, open the KB and then go to Extensions > GXtest. The export will begin and when it is finished it will ask you where you would like to save the exported file.

Updating a KB: Impacting the KB’s change on Test Cases

On you automate a set of tests, the development team will continue developing and changing an application. Therefore it may be necessary to update the information in the KB that GXtest is working with and impact the Test Case. Just go to KB > Refresh.

Choosing a KB

This will open the following window. Imagen:ImpactKB_Paso1.jpg

In this window choose the KB that you want to update of the list of KBs associated with the project.

After you choose the KB press the Next button.

List of objects to be deleted

Imagen:ImpactKB_Paso2.jpg

This window displays all of the objects that are to be deleted because they aren't found in the current KB. These objects aren’t part of any Test Case and therefore can be deleted without any negative effect. These objects may have been deleted or renamed. After review the list click Next.

Object Level Impact

Imagen:ImpactKB_Paso3.jpg

In this window there are four sections:

  • Conflicted objects: This is a list of objects that are used en a Test Case but that cannot be found in the new Test Case. Therefore there are considered to be have a conflict. It is a good idea to match any available objects with objects that have conflicts..
  • Suggested objects: when you select a conflicted object it will suggest a list of possible objects
  • Resolved conflicts: when you match a conflicted object with a new object the conflicted object will be removed form the list of Conflicted objects and will move to the Resolved conflicts list. As well the available object will be removed from the list of available objects.
  • Available objects: Displays a list of the available objects (new objects that have not been matched with a conflicted object)

To match up a conflicted object to an available object, select the conflicted object from the list and then an available or suggested object from the list. Then click Resolved.

Once you have resolved all of the conflicts click the Next button. After clicking Next, all objects that remain in the list of conflicted objects will be deleted. The Test Cases will make reference to a “special" object called MissingObject.

Control Level Impact

Imagen:ImpactKB_Paso4.jpg

This windows displays the objects that have been affected by the changes made. At the top of the window it is possible to navigate through the different objects using the arrow buttons.

Each object has a similar layout to the previous window where you can choose which controls have been renamed o substituted for others.

The controls that remain in the list of Conflicted Controls will be replaced in the Test Cases with the control MissingControl upon clicking the Next button. These Test Cases with missing controls will not be run.

Report

Imagen:ImpactKB_Paso5.jpg

Lastly the report screen displays the results of the changes made.

Test Cases

Within each project there are the Test Cases for the application to be tested. Each Test Case is an automated workflow for an application, which can be used to automate regression tests. See also Advice for when to automate.

Test Case Objects

Page

A Page refers to a page of an application and can have a list of actions and a list of validations.

Each page can be associated with a GeneXus object. Test Cases generated with the Recorder will always have the GeneXus object associated and even when you do it manually it is not always necessary to select the object. When there are more than one frame in the same window or when there are more than one window (for example a popup) at the time of running a command, in those cases you must select the object.

Edge Line

Each Edge Line represents the transition from one page to the next. Each one has exactly one event. It can also have a list of actions and a list of validations.

One peculiarity about edge lines is that they have a specific order. Each Edge Line has a letter that indicates the order in case there is more than one Edge Line for a node. Take for example the folloing case: center

The first time you go to the Home page you will follow the edge line ClickLinkTable, but when you return to that same page a second time you will follow the edge line ClickButton.

Test Case (Inclusion)

A Test Case object allows you to embed a Test Case within another Test Case (modularize). This allows you to reuse Test Case models. To see and example of an embedded Test Case consult the following article. When embedding an Test Case within another Test Case you can tell GXtest how many times you want to run the embedded Test Case. This value can be a specific number or it can be taken from a Data Pool. When it is taken from a Data Pool you are able to, for example, vary the quantity of items in a invoice depending on the Data Pool.

Decision

A decision object allows you to follow two different workflows within an application based on certain conditions. For example, if our Test Case sends a notification to a client if he/she is from Uruguay, but sends nothing if the client is from another country, we can use a Decision to follow one workflow or another depending on where the client is from.

To see an example using Decision see Creating a Test Case with Bifurcation

Creating a Test Case

A Test Case can be created many ways. It can be done manually or by recording it with GXtest Recorder. GXtest Recorder can record a Test Case two ways: on-line and off-line.

Creating a Test Case manually

To create a Test Case manually, select Add Test Case from the Test Case menu in the project panel.

This creates a Test Case that will remain open in the Models panel. In this new blank page you can begin to model the Test Case. To do so you must draw the workflow to be automated by creating the pages to be visited and connecting them with Edge Lines.

Once the workflow is ready, you must define the commands that will be run for each Edge Line and each Page.

See also list of available commands.

The Drag and Drop commands allow for easy construction of Test Cases in the Model editor, it is possible to simply drag and drop commands between different components (Edge Lines and Pages). This allows you to move or copy if you hold down the Control key.

Creating a Test Case with GXtest Recorder

The difference between On-Line and Off-Line is that the former uses GXtest Recorder together with GXtest Designer so that when you record a Test Case it remains in GXtest Designer ready to use. Whereas using the Off-Line method, GXtest Recorder works separately from GXtest designers and generates a file that later must be imported into GXtext Designer.

On-line Method

To record a Test Case using the On-Line method select Record New Test Case form the Test Cases menu. center

This will open a window that allows you to enter a name for the Test Case and the URL where you want to begin to record. Once you click the Record button a new browser window will open where you can begin to perform the necessary actions. Once you have finished the workflow that you want ot automate simply close the browser window.

Off-line Method

As explained before the Off-Line method allows you to create a Test Case without having to have GXtest Designer installed. This will create a ZIP file that can be imported into GXtest Designer.

Once the ZIP file is created you must create a new Test Case by selecting Add Recorded Test Case from the Test Cases menu (in the project Panel).

Then choose the ZIP file created previously.

The advantage to this method is that it is not necessary to have GXtest Designer installed in order to automate, you only have to install the extension in Internet Explorer. This also makes it easier for any user to record a workflow for an application if they need technical support or if they are defining acceptance tests etc. For more details see GXtest Recorder User's Manual.

Test Case Validation

Before running a Test Case you should perform a validation. If a Test Case does not meet all the conditions to run it will not be run. Some of the possible causes for a Test Case to not be able to run are that there are no events on a certain Edge Line or that a connection is missing. To validate a Test Case press Shift+F6 or click the following button in GXtest: BotonValidarTC.jpg

Running a Test Case

In GXtest Designer there a several ways of running a Test Case which are described below.

Simple Running of a Test Case

You can run Test Case once by pressing Shift+F5 or clicking the button shown below center

This will run the open Test Case one time.

Running a Test Case repeatedly

This allows you to run a Test Case as many times as you decide which allows you, for example, to use Data Pools. To repeatedly run a Test Case press Shift+F7 or click the button shown below: BotonEjecutarN.jpg

Running a Test Case in an open browser window

This allows you to run a Test Case in a browser window that is already open. To run a Test Case in an open browser press Ctrl+F5 or click the following button: BotonPlayInIE.jpg

Advice for working with Test Cases

The following lists a couple pieces of advice concerning editing Test Cases.

  • Copy and Paste commands with Drag&Drop: in GXtest its possible to move commands from one element to another by simply dragging them and dropping them. You can also copy commands by holding down the Ctrl key while dragging and dropping.
  • Changing the order an element’s associated commands: click on the element in the commands panel and drag the commands placing them in the desired order.

Exporting and Importing a Test Case

This article shows the specific steps for importing and exporting a Test Case. If you would like more detailed information about XML generators and exporting Test Cases you can consult this article.

Sending and Recieving Test Cases between databases

As mentioned in the Login / Connections section, in GXtest it is possible to configure several connections. This allows:

  • an easy exchange of Test Cases between databases
  • exchange of Test Cases between workstations and the GXtest Manager database
It is important to keep in mind that the names of the projects that contain the Test Cases that are to be transferred ought to be the same.

Internally what happens is an export and then an import of the Test Cases into the corresponding databases. To send a Test Case follow these steps:

  1. Open GXtest using the connection for the original database
  2. Open the project
  3. Go to Test Cases > Send & Receive > Send To
  4. Select the Test Case that you want to send
  5. Choose the data that you want to send it to
  6. It will now show the export options (they include Data Pools, recurring Test Cases, etc.) Then click OK
  7. It will now show the results of the export. Close the results window when finished.
  8. It will now show the results of the import.

To receive a Test Case follow these steps:

  1. Open GXtest using the connection for the original database
  2. Open the project
  3. Go to Test Cases > Send & Receive > Receive From
  4. Choose the database that is going to receive the Test Case
  5. Then choose the Test Case that is going to be received and the options that you want.
  6. You will then see the results of the export and then the results of the import in the local database.

Commands

Commands allow you to express the interactions that you want an application to perform as well as validations of the expected state of an application after each of the interactions. Commands can be actions, validations and events. Each of these can have parameters that indicate when they should run within an application.

Actions are done by a user within a webpage and don’t move you to another page. Some examples of actions are FillInput (to insert a value into a field on the page) and Check (to tick a checkbox).

There are also events that are interactions that cause you to move from one page to another. Some example of events are Go (the same as typing a URL into a browser), ClickLink (used to click a link within a page) and ClickButton (used to click a specific button).

Lastly there are validations which are used to validate that the resulting state of an application is what was expected. Some examples of validations are AppearText (checks if a text is present or not) or VerifyControlText (compares the value of a control on the screen with a reference value). Validations always have two mandatory parameters in addition to their other parameters.

  • Error Description Parameter: this is shown if a validation fails and describe why the failure occurred.
  • Negation Description Parameter: this shows that the expected result is the negation of the validation. For example if you negate the validation AppearText it says that you don’t want a certain text to appear.

Parameters

Each command recieves a list of parameters. The kinds of parameters that a command can have are described below:

Control Parameter

This kind of parameter is used to create a control within a GeneXus object. Transaction and WebPanel objects in GeneXus have an associated WebForm, this WebForm has an associated set of controls that specify the information to be shown and the interaction that the user can have with the object. For example, a button or a field where you can enter values are controls within a WebForm object.

Value Parameter

Value parameters refer to a fixed value, be it text or a number, that you want to use in a command.

Variable Parameter

GXtest allows you to capture values returned by an application and store them as variables. These variables are then used in other commands. (See Creating a Test Case with Variables for more information.) There is a standard variable called urlHome that uses the value defined in the project’s URL property when the Test Case is ran with GXtest Designer or that uses the value defined by the URL property associated with the task when it is run with GXtest Manager.

Data Pool Parameter

Data Pools allow you to use external data in a Test Case. Data Pool parameters allow you to tell a command to take values from a specific data source.

SelectionByRow Parameter

Commands that are run within tables have a parameter the tells them which row within a table they should use to run an action. This parameter referred to generically as SelectionRule can actually be two types SelectionByRow or SelectionByControl. SelectionByRow is used to specify the row where the action will take place and is indicated by the row number. In this way you can model in GXtest actions such as “Click on the first row of the grid.” Because of this the parameter has a Data Pool subparameter, value or variable.

SelectionByControl Parameter

The SelectionByControl parameter is used to specify the row in table to be used based on a value in one of its columns. For example you can tell GXtest to select the row which contains Employee Number 59. GXtest will search the table and select the row with the first instance that matches the established criteria. This parameter has two subparameters:

  • Control Type Parameter indicates the column where GXtest will begin to search for the established criteria
  • Type of Comparison and comparer indicates if what is to be compared is text or a number and the comparison that will be used (equal to, more then, less than, contains, etc.)
  • Variable Type Parameter, Data Pool or Value: it’s the value that is going to be compared.

List of Commands

Actions
Check Allows you to tick or check a CheckBox
CheckTable Same as Check but used for controls that are located in tables
Choose Allows you to select an option from a RadioButton
FillInput Used to insert a value into a field
FillInputTable Used to insert a value into a field within a table
GetValue Allows you to obtain a value returned from an application and store it in a variable to later be used in another command
GetValueTable Same as GetValue but used for values that are located in tables
Select Allows you to select a value from a list of values (combobox)
SelectTable Allows you to select a value from a list of values (combobox) that are found within a table
SelectRow Allows you to select a row in a table
UnCheck Allows you to uncheck a CheckBox
UnCheckTable Same as UnCheck but used for controls that are located in tables
DPNext Move to the next row of a Data Pool. You should always use DPNext before you begin to use a Data Pool. If this command should happen to a Data Pool and a column, the column will have no effect on the command’s behavior
DPReset Returns to the beginning of a Data Pool. If this command should happen to a Data Pool and a column, the column will have no effect on the command’s behavior
Events
Back The same as clicking the Back button in a browser
Go The same as typing a web address (URL) into a browser
GoAndLogin The same as the Go command except that it allows you to enter a username and password for applications that require it
PressKey Simulates a keystroke made by a user. For more information on how to specify different keys see the following reference
Click Clicks on a GeneXus control
ClickLinkByCaption Clicks on a link. The difference between this event and the previous is that sometimes because of how an application is constructed the same control has more than one name. In these cases ClickLinkByCaption is used to specify the name of the link to be controlled
ClickInTable Allows you to click on a control that is located in a table
ClickPrompt Allows you to open a prompt to select values from a list
ClickPromptInTable The same as the above except for fields that are located in a table
ClickPortalMenu Allows you to open a specific menu of an application developed with GXPortal
ClickToolbarButton Allows you to click on a toolbar button in an application made with GeneXus X and that uses a User Control with ExtJS
LoginPortal Allows you to login to an application that uses GXPortal for security
ClickTreeMenu Allows you to open a menu developed with ExtJS TreeMenu (in an application made with GeneXus X and that uses a User Control with ExtJS)
Close Closes a window
DummyEvent Does nothing. Used to go form one page to another without performing an event
Validationes
AppearText Checks if a specific text is or is not on the screen. It can also be used for validations performed by Ajax. If it indicates a GeneXus object associated with the node where the command is being run, it will search the text in the frame that contains this object. If it is not indicated then it will look in the main frame
TableOrderedBy Checks to see if a table is sorted by a given column
TableRowsNumber Checks the number of rows of a given table
VerifyControlEnable Verifies that a control is enabled
VerifyControlVisible Verifies that a control is visible
VerifyControlText Compares a value displayed by a control with another value
VerifyControlTable Same as VerifyControlText but used for controls that are found in a table
DPCompare Compares a value from a Data Pool with another value

A few considerations:

Data Pools

A Data Pool is a set of data that can be used in a Test Case. For example if we want to make a Test Case that enters into the system 100 new clients we can create a Data Pool called Clients that contains their name, ID number and telephone number. If you create a Test Case that uses the Data Pool to insert values into an application, every time that it is run the Test Case will use a different piece of data from the Data Pool. To see how to create a Data Pool and a Test Case that uses it see the page Creating a Test Case with Data Pools.

Data Pools are used in GXtest testing when working with data. They can be used not only to enter data into an application but also to validate the expected results of an application in order to choose which action to be performed.

Commands associated with Data Pools

The majority of the commands can have parameters from Data Pools but there are also certain commands specific for Data Pools which are the following:

  • DPNext Move to the next row of a Data Pool. You should always use DPNext before you begin to use a Data Pool. If this command should happen to a Data Pool and a column, the column will have no effect on the command’s behavior.
  • DPReset Returns to the beginning of a Data Pool. If this command should happen to a Data Pool and a column, the column will have no effect on the command’s behavior.
  • DPCompare: it is a validation type command that is used to compare a value from a Data Pool con another value

Scope of the data

An important concept within a Data Pool is the scope or the hierarchy of the data stored in a Data Pool. The scope can be of two types Global or by Test Case. For example you could have the following Data Pool:

Scope Name Password
Global pepe pepe
Case A juan juan

If you use a Data Pool in a Test Case that doesn’t have specific data assigned to it, you will use the global data (pepe in the example). Nevertheless if you assign specifc data to a Test Case then it will use that data.

Keeping in mind the previous Data Pool, imagine that in our Test Case we want to use different names and passwords to access a system. You can create a Data Pool called Users similar to the previous example. Assume now that the majority of the Test Cases use the username pepe and the password pepe and there is only one Test Case (Case A) that uses the username juan and the password juan. In order to resolve this issue you must enter the username pepe and the password pepe as global data and the username juan is entered as specifc to Case A.

If you use this Data Pool in Test Case Case B, it will return the value (pepe,pepe) which are the global values, but if you use it in Case A, it will return the value (juan,juan).

Important: if a Data Pool has N data for a Test Case and you perform N+1 iterations, then the Data Pool will begin again with the first piece of data.

Using related data (SETID)

Typically when you think of or design a Test Case, you do it conceptually and you do it in order to use data in the Test Case. Many times the different data sets are related, for example for a given country you want to enter it’s corresponding cities.

For example if you want to test the country, once you have the test case defined conceptually, you can decide to run the application with the following datasets:

  • Set 1: Country: Uruguay, Cities: Salto, Paisandú, Montevideo and Atlantida
  • Set 2: Country: Argentina, Cities: Rosario, Bariloche, Buenos Aires and Victoria

In this case it you need to tell GXtest that you are using a dataset in different yet related Data Pools and not using only one Data Pool.

This can be done using what is called SETID, set identifier. In this post there is an example of how to use this kind of Data Pool.

To perform this simply create two Data Pools, one named Countries and another named Cities, with the previous data and add to them a column called SETID. Then add another Data Pool called DATASETS that has only one column called SETID. Now when you add a related dataset you just add an identifier for the related dataset in the DATASETS Data Pool and then in each row of data in the Countries and Cities Data Pools you put the corresponding identifier in the SETID column.

Doing so you will get the following Data Pools with the following data:

DATASETS Country Cities
SETID SETID Country Name SETID City Name
1 1 Uruguay 1 Montevideo
2 2 Argentina 1 Salto
3 3 Brasil 1 Paysandú
1 Canelones
2 Buenos Aires
2 Rosario
2 Bariloche
3 Sao Paulo

Then if you use the DPNext command on the DATASETS Data Pool, it will filter the Data Pools by the set identifier (SETID) .

Technical Support

For technical support please email gxtestbeta@abstracta.com.uy. Any suggestions or errors that are reported will help us to better our products and thusly more fully satisfying our clients.