Creating a Test Case with Variables

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

Introduction

Sometimes it is necessary to take values returned from an application and use them in a different part of a Test Case. To accomplish this you can use variables. In this tutorial you will create an example called DuplicateClient. The Test Case's objective is that no two clients are allowed to enter with the same ID. This can be done be making a Test Case using the following steps:

  1. Go to the Work With Clients Page.
  2. Load into the variable the ID of the first client on the list
  3. Click the button that allows you to create a new client
  4. Enter the value captured before for ID of the client and then enter a name
  5. Click Accept and make sure that the application brings up a window that says that this ID already exists

Creating the Test Case

Now you'll see the steps to be followed in GXtest Designer and GXtest Recorder. First open the GXAjaxSample90 project from where you were working with GXAjaxSample and tell GXtest Designer that you want to record a new Test Case that will be called DuplicateClient. Then press Enter which will open a browser window. Once you are on the Start page, click on the Work With Clients link. Now you need to get the value returned for the ID of the first client (in this case 5) by selecting it with the mouse and then clicking on the button ButtonTake.jpg as seen in the following image:

ButtonTake2.jpg

Upon clicking, a new window will appear where you can enter the name of the variable (in this case ExistingClientId) and the criteria that says you want the first row (in this case you will leave the Row Number value as 1).


CaputreValueWindow.jpg

Then click the + Button to enter a new client. Once the screen opens put 5 as the value in the ID field and enter a name. Now click Accept to discharge the client and open the following window:

VariableWindow.jpg

This window asks you if you want to use the saved value instead of the fixed value of 5. In the case this is exactly what you want to happen so click Yes.

Click the Accept button again on the discharge screen and a red warning that says: "Record already exists"

Select the text that appears and add an AppearText validation by clicking the button ButtonValidations.jpg.

Then close the window to stop recording. The Test Case that you obtain ought to look like the following:

ClienteDuplicado1.jpg

Looking at the Click “Insert” Edge Line, it is using the GetValueTable command to indicate the value that it ought to take from the screen and the name that it ought to assign.

Then if you select the Client Node you can see that the FillInput command goes to the pre-defined variable.

Testing the Test Case

Now you can run the Test Case and see that the system doesn’t allow you to enter repeated IDs. If you have the test to delete the first client (the one you used when recording) and run the test again you will see that the Test Case still works even though the data from the test are not there.