Difference between revisions of "Creating a test case for Smart Devices"

From GXtest Wiki
Jump to: navigation, search
(Created page with "{{Idiomas|Crear un caso de prueba para Smart Devices|Creating a test case for Smart Devices| Creating a test case for Smart Devices}} For creating our first GXtest test case ...")
 
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Idiomas|Crear un caso de prueba para Smart Devices|Creating a test case for Smart Devices| Creating a test case for Smart Devices}}
+
{{Idiomas|Crear un caso de prueba para Smart Devices|Creating a test case for Smart Devices| スマートデバイス用のテストケースの作成}}
  
 
For creating our first GXtest test case for Smart Devices, we will use the GeneXus sample Android application [http://wiki.gxtechnical.com/commwiki/servlet/hwiki?My+first+Android+Application, My first Android Application].  
 
For creating our first GXtest test case for Smart Devices, we will use the GeneXus sample Android application [http://wiki.gxtechnical.com/commwiki/servlet/hwiki?My+first+Android+Application, My first Android Application].  
Line 7: Line 7:
  
 
== Pre-requisites ==
 
== Pre-requisites ==
First of all, we will need to generate the Android application to test, so we need to complete the previous mentioned GeneXus tutorial.
+
First of all, we will need to generate the Android application that will be tested, so we need to complete the previous mentioned GeneXus tutorial.
  
 
After that, be sure to have fulfilled the [[Requirements for executing in Android]], for an emulator or a real device.
 
After that, be sure to have fulfilled the [[Requirements for executing in Android]], for an emulator or a real device.
  
 +
Also, we assume that you already done the creation of a GXtest project and the setup the KB for the project. For additional info, see [[GXtest Projects]] and [[GXtest and the GeneXus KB]] articles.
  
 
== Create a new test case for Smart Devices ==
 
== Create a new test case for Smart Devices ==
  
Antes de comenzar a diseñar el caso de prueba, es recomendable que realicemos un "Alta de empresa" en la app para familiarizarnos con el proceso y los pasos que vamos a automatizar a continuación. Para ejecutar la app en el emulador/dispositivo desde GXtest Designer, hacer clic en el botón "Launch application in device" de la barra  de herramientas, o también en el menú Smart Devices. Para agregar una nueva empresa, desde el menú principal de la app, ir a Companies, Insert, ingresar el nombre de la empresa y presionar Save. Eso nos llevará al listado de empresas y aparecerá la empresa creada.
+
Before we start designing the test case, it is recommended we manually follow the steps to create a new company in the mobile app, so we get to know the process and the steps we will automate later with GXtest. To run the app in the emulator/device from GXtest Designer, we can click in the "Launch application in device" button located in the toolbar, and also in the Smart Devices menu. In order to add a new company, from the main app menu we select the option "Work With Devices Company", tap on the button Insert, fill a company name and tap on Save. That will take us back to the company list, where we should see the company we just created.
  
  
Para comenzar a crear el nuevo caso de prueba, vamos al menú Test cases -> New, o desde el menú contextual de Test cases en el árbol de proyecto, Create New Test Case.
+
To start creating the new test case, we go to the menu Test cases -> New.
  
 
[[File:CreateNewSDTC.PNG|center]]
 
[[File:CreateNewSDTC.PNG|center]]
  
Al momento de seleccionar el nombre, le pondremos a este caso de prueba el nombre Insert Company SD, y allí debemos elegir que el caso de prueba es de tipo Smart Device.
+
At the time we need to choose a name, we also need to specify the main platform of the test case. In our case, we will choose 'Smart Device'
  
Ahora que tenemos nuestro caso de prueba vacío, vamos a agregarle una SDPage, que será la pantalla "principal" que se muestra cuando se abre la aplicación. El objeto GeneXus mostrado es el Menu. Entonces arrastramos un nuevo SDPage desde la barra de herramientas de objetos, y dando doble clic en el SDPage asignamos el objeto Menu.
 
  
Luego, conectamos el nodo Start con la SDPAge arrastrando la flecha, y agregamos en dicha arista un comando Go, que será el encargado de arrancar la ejecución de la aplicación en nuestro dispositivo. Para esto, necesitamos especificar el archivo apk de la app Android que se va a instalar/ejecutar en el dispositivo. Por suerte para nosotros, ya tenemos en la variable &apkPath la ruta al archivo, según lo configuramos [[Requerimientos para la ejecución en Android | aquí]], por lo que nuestro comando Go
+
Now that we have a new empty test case, we will drag and drop a new SDPage from the Objects toolbar. This SDPage will represent the first screen the application shows when we start the execution, and it will match with the GeneXus object called Menu. Once we have the SDPage in the test case, we double-click the SDPage and we choose the Menu object from the object selector window.
 +
 
 +
 
 +
After that, we must connect the start node to the Menu SDPage, so we drag the edge arrow to accomplish this. To make the application execute, we must add a Go command, as we do with the Web test cases to open the browser on a new URL. On a Smart Device test case, the Go command will install/launch the application in our device or emulator. So, we add a Go command on the first edge, and as the value parameter we must put the path to the APK file of the Android app in our computer.  Luckily, we already loaded this path in the &apkPath variable in the [[Requirements for executing in Android]].
  
 
[[File:GoApkPath.png | center]]
 
[[File:GoApkPath.png | center]]
  
En este punto, ya podemos ejecutar el caso de prueba y ver que la aplicación se inicie correctamente en el emulador o dispositivo. Si ejecutamos el caso de prueba, deberíamos ver al emulador iniciar la aplicación y mostrar el menú inicial de nuestra app.
+
At this ponint, we can execute the test case as it is, in order to check that the app launches on the selected emulator/device.  
  
  
Ahora agregaremos la sección donde agregamos una nueva Empresa. Para ello, agregamos una nueva SDPage, y una arista que vaya desde el Menu hasta el nuevo nodo. En la arista, agregaremos un nuevo evento TapText, para simular un Tap sobre el ítem Companies del Menú. Entonces en la arista tendremos un TapText("Companies"), y en la nueva SDPage, asignaremos el objeto CompanyList, que es el que aparece luego de hacer Tap en Companies-
+
Now we can continue with the test case design. We should add a new command TapText in the Menu SDPage, which taps on the "Work With Devices Company" item of the menu (so we will have a TapText("Work With Devices Company")). This tap should take us to the CompanyList page, so we must add another SDPage associated with the CompanyList GeneXus object, and connect the Menu SDPage to the latter one through a new edge.
  
  
Para poder agregar una nueva Empresa, necesitamos hacer tap en el botón "Insert" de la pantalla CompanyList. Por ello, debemos agregar un evento Tap(CompanyList.ButtonInsert) en la SDPage CompanyList.
+
Once in the CompanyList page, we must tap on the Insert button to go and create a new company, so we will add a new Tap command over this button, on the SDPage associated with CompanyList. The command should look like this: Tap(CompanyList.ButtonInsert)
  
  
Luego, agregaremos otro nuevo SDPage, y lo conectaremos con una arista que salga desde CompanyList. El nuevo SDPage, será CompanyGeneralSection, que es el objeto GeneXus que se muestra cuando entramos a editar, eliminar o agregar o una nueva Empresa (que es nuestro caso).  
+
After that, we will create a new SDPage, corresponding with the screen that allow us to create/edit/update a company. This page will be the CompanyGeneralSection GeneXus object, so we must assign this object to the SDPage, and connect the CompanyList node to this one.  
  
  
Finalmente, en la SDPage CompanyGeneralSection debemos escribir el nombre de la nueva empresa ("My Company") y presionar el botón "Save".
+
Finally, at the last SDPage (CompanyGeneralSection), we will write the name for the new company (for example "My Company"), and then press the "Save" button.
  
 
[[File:TCAddCompany.png | center]]
 
[[File:TCAddCompany.png | center]]
  
Para esto agregamos los siguientes comandos en CompanyGeneralSection:
+
In order to automate those two last steps, we will add the commands in the CompanyGeneralSection SDPage:
 
* FillInput(CompanyGeneralSection.CompanyName, "My Company")
 
* FillInput(CompanyGeneralSection.CompanyName, "My Company")
 
* Tap(CompanyGeneralSection.ButtonSave)
 
* Tap(CompanyGeneralSection.ButtonSave)
  
  
Con estos pasos ya estaríamos dando de alta la nueva empresa, pero sería bueno validar que la empresa efectivamente se registró. Para ello, agregaremos una última SDPage con el objeto CompanyList, que es la pantalla a la que nos lleva la aplicación, y allí agregaremos una validación AppearText("My Company").
+
At this point we completed the steps to create the new company, but it would be nice to verify on the same test case that the company has been successfully registered. So we will add one last SDPage associated to the CompanyList object, which is the page where we get after saving the new company. In this last page, we will add a validation that checks that the new company ("My Company") appears in the list. This is done with the AppearText("My Company") command.
  
  
Line 56: Line 59:
  
  
Ahora que ya tenemos el caso de prueba, le proponemos reemplazar los valores fijos (por ejemplo el nombre de la empresa "My Company") para que use datapools, y el caso de prueba sea más fácilmente mantenible y se puedan agregar nuevos juegos de datos.
+
Run the test case and check that all steps are successfully completed, including the last validation.
 +
 
 +
 
 +
Now that we have our first test case, we can change the fixed values we used in the test case flow and use [[Using Datapools | datapools]] instead. This makes our test cases easier to maintain and extend with new data.
  
== Extender el caso de prueba a la Web ==
+
== Extending the test case to the Web ==
  
Es posible crear un caso de prueba "híbrido", es decir, que ejecute una parte de la prueba sobre el dispositivo, y otra parte de la prueba sobre la web. Por ejemplo, luego de crear la empresa desde el dispositivo, me gustaría poder buscar la nueva empresa en la web de mi aplicación y validar que también aparece allí.
+
Is is possible to create an hybrid test case, which means that the test case can execute some steps on a mobile device, and other steps oven the Web application (in any order). For example, we may need to check on the Web version of the application if the new company appears, after we created it on the Smart device app.
  
  
Para esto, simplemente debemos incluir los casos de prueba que realizan estas tareas. Por ejemplo, si ya tenemos un caso de prueba "Search Company Web" que busque la empresa "My Company", es posible incluir ambos casos de prueba de esta forma y lograr lo que queremos:
+
To create this kind of test cases, we should include the test cases that automate the steps in one platform at a time. For example, suppose we already have a Web test case that searches "My Company" on the Web, and also the test case we already created for adding a new company on the Android app.
 +
So, we only need to include both test cases in a third test case, connecting them through an edge, like this:
  
 
[[File:MixedTC.PNG|center]]
 
[[File:MixedTC.PNG|center]]

Latest revision as of 20:18, 29 May 2015

Spanish.gif
English.gif
Japan.gif

For creating our first GXtest test case for Smart Devices, we will use the GeneXus sample Android application My first Android Application. This sample application, is a very simple app that stores Customer and Companies information.

We will create a new test case that adds a new company, and then verifies that the company was actually added to the app data.

Pre-requisites

First of all, we will need to generate the Android application that will be tested, so we need to complete the previous mentioned GeneXus tutorial.

After that, be sure to have fulfilled the Requirements for executing in Android, for an emulator or a real device.

Also, we assume that you already done the creation of a GXtest project and the setup the KB for the project. For additional info, see GXtest Projects and GXtest and the GeneXus KB articles.

Create a new test case for Smart Devices

Before we start designing the test case, it is recommended we manually follow the steps to create a new company in the mobile app, so we get to know the process and the steps we will automate later with GXtest. To run the app in the emulator/device from GXtest Designer, we can click in the "Launch application in device" button located in the toolbar, and also in the Smart Devices menu. In order to add a new company, from the main app menu we select the option "Work With Devices Company", tap on the button Insert, fill a company name and tap on Save. That will take us back to the company list, where we should see the company we just created.


To start creating the new test case, we go to the menu Test cases -> New.

CreateNewSDTC.PNG

At the time we need to choose a name, we also need to specify the main platform of the test case. In our case, we will choose 'Smart Device'


Now that we have a new empty test case, we will drag and drop a new SDPage from the Objects toolbar. This SDPage will represent the first screen the application shows when we start the execution, and it will match with the GeneXus object called Menu. Once we have the SDPage in the test case, we double-click the SDPage and we choose the Menu object from the object selector window.


After that, we must connect the start node to the Menu SDPage, so we drag the edge arrow to accomplish this. To make the application execute, we must add a Go command, as we do with the Web test cases to open the browser on a new URL. On a Smart Device test case, the Go command will install/launch the application in our device or emulator. So, we add a Go command on the first edge, and as the value parameter we must put the path to the APK file of the Android app in our computer. Luckily, we already loaded this path in the &apkPath variable in the Requirements for executing in Android.

GoApkPath.png

At this ponint, we can execute the test case as it is, in order to check that the app launches on the selected emulator/device.


Now we can continue with the test case design. We should add a new command TapText in the Menu SDPage, which taps on the "Work With Devices Company" item of the menu (so we will have a TapText("Work With Devices Company")). This tap should take us to the CompanyList page, so we must add another SDPage associated with the CompanyList GeneXus object, and connect the Menu SDPage to the latter one through a new edge.


Once in the CompanyList page, we must tap on the Insert button to go and create a new company, so we will add a new Tap command over this button, on the SDPage associated with CompanyList. The command should look like this: Tap(CompanyList.ButtonInsert)


After that, we will create a new SDPage, corresponding with the screen that allow us to create/edit/update a company. This page will be the CompanyGeneralSection GeneXus object, so we must assign this object to the SDPage, and connect the CompanyList node to this one.


Finally, at the last SDPage (CompanyGeneralSection), we will write the name for the new company (for example "My Company"), and then press the "Save" button.

TCAddCompany.png

In order to automate those two last steps, we will add the commands in the CompanyGeneralSection SDPage:

  • FillInput(CompanyGeneralSection.CompanyName, "My Company")
  • Tap(CompanyGeneralSection.ButtonSave)


At this point we completed the steps to create the new company, but it would be nice to verify on the same test case that the company has been successfully registered. So we will add one last SDPage associated to the CompanyList object, which is the page where we get after saving the new company. In this last page, we will add a validation that checks that the new company ("My Company") appears in the list. This is done with the AppearText("My Company") command.


SDInsertCompanyComplete.png


Run the test case and check that all steps are successfully completed, including the last validation.


Now that we have our first test case, we can change the fixed values we used in the test case flow and use datapools instead. This makes our test cases easier to maintain and extend with new data.

Extending the test case to the Web

Is is possible to create an hybrid test case, which means that the test case can execute some steps on a mobile device, and other steps oven the Web application (in any order). For example, we may need to check on the Web version of the application if the new company appears, after we created it on the Smart device app.


To create this kind of test cases, we should include the test cases that automate the steps in one platform at a time. For example, suppose we already have a Web test case that searches "My Company" on the Web, and also the test case we already created for adding a new company on the Android app. So, we only need to include both test cases in a third test case, connecting them through an edge, like this:

MixedTC.PNG