Difference between revisions of "Creating a Test Case with Bifurcation"

From GXtest Wiki
Jump to: navigation, search
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{Idiomas|Crear un Caso de Prueba con Bifurcación| Creating a Test Case with Bifurcation|分岐を使用するテストケースの作成}}
 
[[category:GXtest Guides]]
 
[[category:GXtest Guides]]
  
 
There are times when it is necessary to perform actions according to the state of an application or the response generated by it. For these scenarios you can use the Decision constructor.
 
There are times when it is necessary to perform actions according to the state of an application or the response generated by it. For these scenarios you can use the Decision constructor.
  
In this case you will create the Test Case called SeeClienteWithCondition. This Test Case consists of entering Clients and looking for a specific client. If the client is Abstracta it will be viewed but if it is not you will go to the modification page.
+
In this case you will create the Test Case called ViewClientWithCondition. This Test Case consists of entering Clients and looking for a specific client. If the client is Abstracta it will be viewed but if it is not you will go to the modification page.
 
In order to make this kind of Test Case you need to first follow the steps described in Creating a Test Case with Data Pools and the the Test Case should be called SeeClientWithCondition.  
 
In order to make this kind of Test Case you need to first follow the steps described in Creating a Test Case with Data Pools and the the Test Case should be called SeeClientWithCondition.  
  
 
Then drag from the Objects panel the Decision constructor. After that drag a Page element to the diagram.  The Test Case ought to look like the following:  
 
Then drag from the Objects panel the Decision constructor. After that drag a Page element to the diagram.  The Test Case ought to look like the following:  
  
 +
[[Image:Decision.jpg |center]]
  
Hay ocasiones que es necesario realizar acciones distintas de acuerdo al estado de la aplicación o a la respuesta que obtuvimos de la misma. Para ese tipo de escenarios se utiliza el constructor Decision. <br>
+
Then connect the False edge line to the added page on the diagram and edit the properties of the page making the name (Update Client), the KB (GX9 - AjaxSample) and the GeneXus object (transaction, Client).  
En este caso realizaremos el caso de prueba denominado VerClienteConCondición. Este caso de prueba consiste en entrar a trabajar con clientes y luego buscar un cliente, si el mismo es Abstracta entonces se visualizará y en cualquier otro caso se entrará a la página de modificación.
+
  
Para realizar este caso de prueba primero se deben seguir los pasos descritos en [[Crear un Caso de Prueba con DataPools]] nada más que al caso de prueba se le debe llamar VerClienteConCondición.
+
[[Image:editPageProperties.jpg|center]]
  
Luego se debe arrastrar desde el panel de objetos el constructor de Decision. Posteriormente arrastrar un elemento del tipo Page. El modelo debe quedar como se muestra a continuación:
+
Then create a new edge line that connects the Work With Clients Page with the Decision object. To do so drag one Edge Line from the objects panel and connect it to the edges of previously mentioned nodes. To this Edge Line you need to add a DummyEvent so you can move from the last Page to the Decision without performing an action. The model ought to look like the following:  
  
[[Imagen:Decision.jpg |center]]
+
[[Image:EdgeWithDummyEvent.jpg|center]]
  
Posteriormente se debe unir la arista False con la Page agregada al diagrama y editar las propiedades de esta Page para ingresarle el nombre (Update Client) la KB (GXAjaxSample), y el objeto genexus (transacción, Client).
+
Then you need to tell it to perform a validation by right clicking on the condition and then clicking Add Condition.  
  
[[Imagen:editPageProperties.jpg|center]]
+
[[Image:AddCommandMenuInDecision.jpg|center]]
  
Luego de esto se debe agregar una arista que una la Page Work With Cities con el objeto Decision. Para esto se arrastra una Edge desde el panel de objetos y se unen los dos extremos a los nodos mencionados anteriormente. A dicha Edge se le debe agregar un evento del tipo DumyEvent para transitar desde la última Page a la Decision sin ejecutar ningun acción.  
+
In this case you will add an AppearText validation using Abstracta as the value to be checked for. Then double click on the command to enter a name. In this case you will put "Is it Abstracta?" referring to whether or not the client is Abstracta.  
El modelo debe quedar como se muestra en la siguiente imagen:
+
  
[[Imagen:EdgeWithDummyEvent.jpg|center]]
+
Now you need to assign to the actions to be taken if the client is Abstracta (Edge Line True) or if they are not (Edge Line False). If the client is Abstracta, the Edge Line ought to have the same commands as the ClickTable Edge Line that goes from the Work With Clients Page to View Client, so that if the client is Abstracta you can view their data.  To take advantage of the commands that were generated when recording the Test Case you can Drag & Drop between the ClickTable Edge Line and the True Edge Line of the Decision. Then you just delete the Click Table Edge Line and join the True Edge Line with the View Client Page.  
  
Luego se debe indicar la validación a realizar en la condición para eso se hace click con el botón derecho sobre la condición y se presiona AddCommand.
+
[[Image:EdgeTrue.jpg|center]]
  
[[Imagen:AddCommandMenuInDecision.jpg|center]]
+
Now you just have to model the False Edge Line, the Test Case with a condition will be ready. First you need to add to the Edge Line a command that says click the Update Button in the client grid.  To do so, right click on the Edge Line and then click Add Command. This will bring up a window where you can add the command. Add an Event command and then choose the ClickTable command.
  
En este caso vamos agregar una validación del tipo AppearText pasandole por parámetro el texto abstracta. Luego que agregamos el comando damos doble clic sobre la decisión para indicarle un nombre. En este caso le pondremos 'Es Abstracta?' haciendo referencia a si el cliente involucrado es abstracta o no.
+
Once this is done you have to fill in the command's parameters. In the Table parameter enter AjaxSample as the KB, WWClient as the object and Grid1 as the control.
  
Bien, ahora queda indicar las acciones a tomar cuando el cliente es abstracta (arista True) y cuando no es Abstracta (arista False). En el caso de que el cliente es Abstracta, la arista debe tener los mismos comandos que tiene la arista ClickTable que va desde la página Work With Clients a View Client, ya que queremos que en caso de que efectivamente sea Abstracta entonces visualizar los datos del mismo. Para aprovechar los comandos que se generaron al grabar el caso de prueba podemos hacer drag&drop entre la arista ClickTable y la arista True de la Decision. Luego de esto simplemente borramos la arista ClickTable en cuestión y unimos la arista True con la página View Client.
+
For the SelectionRule parameter select ByRow as the type of comparision (this is the default choice) and then type 1 in the Value field.
  
[[Imagen:EdgeTrue.jpg|center]]
+
Now you just need to enter the name of the column in the last parameter. You will put AjaxSample as the KB, WWClient as the object
 +
and Update as the control.
  
Ahora solo falta modelar la arista False y queda listo el caso de prueba con condición. Para eso tenemos que agregar un comando en dicha arista que indique que se presione el botón update dentro de la grilla de clientes. Con este fin, hacemos clic con el botón derecho sobre la arista y ponemos Add Command. Esto nos desplegará una ventana para agregar el comando. Indicamos que es un comando del tipo Evento y luego seleccionamos el comando ClicTable.<br>
+
The command should then look like this:  
Una vez que se haya realizado esto se deben llenar los distintos parámetros del comando.
+
En el parámetro Table indicar (mediante el prompt), la KB AjaXsample, el objeto WWClient y el control Grid1.<br>
+
Para el parámetro Selection Rule indicar que el tipo de comparación de ByRow (es el que viene por defecto) y luego en el criterio ingresar un 1 en el campo Value.<br>
+
Ahora solo falta indicar el último parámetro el cual es el nombre de la columna. Por ese motivo indicamos la KB AjaxSample, el objeto WWClient y el control Update.<br>
+
El comando tiene que mostrarse entonces de la siguiente manera:
+
  
 
[[Image:EventCLT.jpg|center]]
 
[[Image:EventCLT.jpg|center]]
  
Bien, ha quedado finalizado el caso de prueba, ahora a probarlo!
+
The Test Case is now finished and you only need to test it. Run it three times by pressing (Shift+F7) and watch closely. Notice that you are able to view the Abstracta client while the Artech and Artech client goes to the modifcation page.
Para eso ponemos ejecutar 3 veces (Shift+F7) y miramos con atención. Par  el cliente Abstracta va a visualizarlo mientras que para el cliente Artech y Artech ss va a entrar a la página de modificación
+
  
== Véase también ==
+
== See also ==
* [[Crear un Caso de Prueba Anidado]]
+
* [[Creating an Embedded Test Case]]
* [[Crear un Caso de Prueba con Variables]]
+
* [[Creating a Test Case with Variables]]

Latest revision as of 20:09, 20 February 2014

Spanish.gif
English.gif
Japan.gif

There are times when it is necessary to perform actions according to the state of an application or the response generated by it. For these scenarios you can use the Decision constructor.

In this case you will create the Test Case called ViewClientWithCondition. This Test Case consists of entering Clients and looking for a specific client. If the client is Abstracta it will be viewed but if it is not you will go to the modification page. In order to make this kind of Test Case you need to first follow the steps described in Creating a Test Case with Data Pools and the the Test Case should be called SeeClientWithCondition.

Then drag from the Objects panel the Decision constructor. After that drag a Page element to the diagram. The Test Case ought to look like the following:

Decision.jpg

Then connect the False edge line to the added page on the diagram and edit the properties of the page making the name (Update Client), the KB (GX9 - AjaxSample) and the GeneXus object (transaction, Client).

EditPageProperties.jpg

Then create a new edge line that connects the Work With Clients Page with the Decision object. To do so drag one Edge Line from the objects panel and connect it to the edges of previously mentioned nodes. To this Edge Line you need to add a DummyEvent so you can move from the last Page to the Decision without performing an action. The model ought to look like the following:

EdgeWithDummyEvent.jpg

Then you need to tell it to perform a validation by right clicking on the condition and then clicking Add Condition.

AddCommandMenuInDecision.jpg

In this case you will add an AppearText validation using Abstracta as the value to be checked for. Then double click on the command to enter a name. In this case you will put "Is it Abstracta?" referring to whether or not the client is Abstracta.

Now you need to assign to the actions to be taken if the client is Abstracta (Edge Line True) or if they are not (Edge Line False). If the client is Abstracta, the Edge Line ought to have the same commands as the ClickTable Edge Line that goes from the Work With Clients Page to View Client, so that if the client is Abstracta you can view their data. To take advantage of the commands that were generated when recording the Test Case you can Drag & Drop between the ClickTable Edge Line and the True Edge Line of the Decision. Then you just delete the Click Table Edge Line and join the True Edge Line with the View Client Page.

EdgeTrue.jpg

Now you just have to model the False Edge Line, the Test Case with a condition will be ready. First you need to add to the Edge Line a command that says click the Update Button in the client grid. To do so, right click on the Edge Line and then click Add Command. This will bring up a window where you can add the command. Add an Event command and then choose the ClickTable command.

Once this is done you have to fill in the command's parameters. In the Table parameter enter AjaxSample as the KB, WWClient as the object and Grid1 as the control.

For the SelectionRule parameter select ByRow as the type of comparision (this is the default choice) and then type 1 in the Value field.

Now you just need to enter the name of the column in the last parameter. You will put AjaxSample as the KB, WWClient as the object and Update as the control.

The command should then look like this:

EventCLT.jpg

The Test Case is now finished and you only need to test it. Run it three times by pressing (Shift+F7) and watch closely. Notice that you are able to view the Abstracta client while the Artech and Artech client goes to the modifcation page.

See also