Seminario Calabash - VLCTesting 2014
-
Upload
enrique-sanchez -
Category
Software
-
view
516 -
download
0
description
Transcript of Seminario Calabash - VLCTesting 2014
![Page 1: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/1.jpg)
CalabashBDD en entornos móviles
![Page 2: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/2.jpg)
¡Hola !
Enrique SánchezTester & Automation Engineer
12 y 13 de noviembre de 2014 Valencia, España
![Page 3: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/3.jpg)
• Technical Team Leader y Responsable Técnico del Área de Testing en
• Más de 4 años de experiencia en testing en empresas como
• Co-organizador de MAQA y Evangelista BDD y Agile
¿Quién soy?
12 y 13 de noviembre de 2014 Valencia, España
![Page 4: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/4.jpg)
¿Qué es Medianet?Somos una empresa de consultoría tecnológica fundada en 1995, presente en España, Estados Unidos y México
Somos más de 200 TalenTech People con pasión por la calidad y la innovación
12 y 13 de noviembre de 2014 Valencia, España
![Page 5: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/5.jpg)
¿Qué es Medianet?
12 y 13 de noviembre de 2014 Valencia, España
![Page 6: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/6.jpg)
¿Qué es Medianet?Confían en nosotros gente como…
12 y 13 de noviembre de 2014 Valencia, España
![Page 7: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/7.jpg)
¿Por qué este Seminario?
![Page 8: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/8.jpg)
¿Cuántos tipos de dispositivos móviles, versiones de S.O. y configuraciones existen hoy día?
12 y 13 de noviembre de 2014 Valencia, España
![Page 9: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/9.jpg)
¿Cómo podemos aplicar los mismos parámetros de calidad a un proyecto móvil que a un proyecto web?
12 y 13 de noviembre de 2014 Valencia, España
![Page 10: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/10.jpg)
Cómo conseguimos no gastar más tiempo arreglando bugs que haciendo cosas útiles
12 y 13 de noviembre de 2014 Valencia, España
![Page 11: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/11.jpg)
¿De qué va entonces este seminario?
![Page 12: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/12.jpg)
Queremos aprender cómo montar un entorno que nos permita hacer pruebas para diferentes entornos móviles…
12 y 13 de noviembre de 2014 Valencia, España
![Page 13: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/13.jpg)
Sin volvernos locos…
vaya… salió Android 5… no me lo esperaba
12 y 13 de noviembre de 2014 Valencia, España
![Page 14: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/14.jpg)
Sin tener que instalar o conocer miles de tecnologías diferentes…
12 y 13 de noviembre de 2014 Valencia, España
![Page 15: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/15.jpg)
¡¡¡y sin romper versiones anteriores!!!
12 y 13 de noviembre de 2014 Valencia, España
![Page 16: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/16.jpg)
12 y 13 de noviembre de 2014 Valencia, España
![Page 17: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/17.jpg)
Pongamos un Caso PrácticoO cómo MediaTesting se
ahorró un pastón en pruebas
![Page 18: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/18.jpg)
MediaTesting es una empresa a la que le ha empezado a ir bien con el desarrollo móvil…
pero tienen un pequeño problema
12 y 13 de noviembre de 2014 Valencia, España
![Page 19: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/19.jpg)
Nuestros clientes quieren más calidad en el desarrollo de las pruebas pero no quieren
pagar mucho más…
12 y 13 de noviembre de 2014 Valencia, España
![Page 20: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/20.jpg)
Enseguida empiezan a pensar en qué opciones hay en el mercado y descubren que hay un muchas opciones dependiendo del entorno
Kiwi
12 y 13 de noviembre de 2014 Valencia, España
![Page 21: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/21.jpg)
Incluso hay algunas Cross-Platform
12 y 13 de noviembre de 2014 Valencia, España
![Page 22: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/22.jpg)
¿Qué es Calabash?
![Page 23: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/23.jpg)
Calabash enables you to write and execute automated acceptance tests of mobile apps. Calabash is cross-platform, supporting Android
and iOS native apps.
12 y 13 de noviembre de 2014 Valencia, España
![Page 24: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/24.jpg)
¿Por Qué Calabash?
![Page 25: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/25.jpg)
Multiplataforma: iOS y Android
Permite testing sobre apps nativas
Independiente del lenguaje elegido para el desarrollo
Open Source
12 y 13 de noviembre de 2014 Valencia, España
![Page 26: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/26.jpg)
¿Cómo funciona?
![Page 27: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/27.jpg)
Calabash consiste en una serie de librerías que permiten probar la funcionalidad.
Para ello se utiliza una serie de acciones que imitan al comportamiento de un usuario final:
• Gestos: tocar, swipe, rotar…
• Aserciones: comprobar si un elemento existe o contiene cierta información
• Sreenshots: capturas de pantalla del estado actual del dispositivo
12 y 13 de noviembre de 2014 Valencia, España
![Page 28: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/28.jpg)
Cómo configurarlo
Demo I
![Page 29: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/29.jpg)
Instala Ruby
Usa RVM -> http://rvm.io/
Instala las gemas necesarias
$> gem install cucumber
$> gem install calabash-‐cucumber
$> gem install calabash-‐android
12 y 13 de noviembre de 2014 Valencia, España
![Page 30: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/30.jpg)
1. ANDROID
Comprueba que tienes una variable de entorno ANDROID_HOME
$> echo $ANDROID_HOME
Si no lo tenemos, exportarlo dentro de ~/.bahsrc o ~/.bash_profile
$> export ANDROID_HOME=path/to/sdk
Más info: https://github.com/calabash/calabash-android
2. IOS
Instala la última versión de Xcode
Instala las Command Line Tools (http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/)
Más info: https://github.com/calabash/calabash-ios
12 y 13 de noviembre de 2014 Valencia, España
![Page 31: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/31.jpg)
ANDROID
Instala Genymotion (https://cloud.genymotion.com/page/launchpad/download/)
Baja el simulador para la ROM que quieras
Configúralo para que use tu ANDROID_HOME
12 y 13 de noviembre de 2014 Valencia, España
![Page 32: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/32.jpg)
iOS
Instala sim-launcher*
$> brew install ios-‐sim
12 y 13 de noviembre de 2014 Valencia, España
* Sólo si no usas iOS 8.1, en cualquier otro caso asegúrate de tener instalado Instruments
![Page 33: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/33.jpg)
12 y 13 de noviembre de 2014 Valencia, España
![Page 34: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/34.jpg)
Es hora de crear nuestro proyecto:
$> mkdir VLC_testing_calabash
12 y 13 de noviembre de 2014 Valencia, España
![Page 35: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/35.jpg)
Crea un árbol de directorios similar al siguiente:
├ config <-‐ Guardaremos la config genérica ├ features <-‐ Dónde irán las features │ ├ android <-‐ Definiciones concretas para Android │ │ ├ pages <-‐ Screen Objects para Android │ │ ├ support <-‐ Soporte para Android │ ├ ios │ │ ├ pages <-‐ Definiciones concretas para iOS │ │ ├ support <-‐ Screen Objects para iOS │ ├ step_definitions <-‐ Definición de los steps │ ├ support <-‐ Soporte genérico ├ apps <-‐ Guardaremos los binarios de las apps
12 y 13 de noviembre de 2014 Valencia, España
![Page 36: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/36.jpg)
Copiamos estos dos binarios al directorio apps
$> cd apps
$> wget https://www.dropbox.com/sh/4liqujul5mqme1z/AADbw2HLusihacSxepIFj5Rna/Android-‐debug.apk?dl=0
$> wget https://www.dropbox.com/sh/4liqujul5mqme1z/AACydxl0KG8i0fpMw_HJvXK9a/WordPress-‐cal.app?dl=0
12 y 13 de noviembre de 2014 Valencia, España
![Page 37: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/37.jpg)
ANDROID
Firma la app usando Calabash
$> calabash-‐android resign <apk>
Si aparece algún error entonces sigue estas instrucciones: https://github.com/calabash/calabash-android/wiki/Running-Calabash-Android
12 y 13 de noviembre de 2014 Valencia, España
![Page 38: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/38.jpg)
Comprueba que todo se ha instalado correctamente
$> calabash-‐android console app/<andriod>.apk
irb(main):001:0> reinstall_apps
=> nil
irb(main):002:0> start_test_server_in_background
=> nil
12 y 13 de noviembre de 2014 Valencia, España
![Page 39: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/39.jpg)
iOS
Comprueba que todo se ha instalado correctamente
$> APP_BUNDLE_PATH=app/<ios>-‐cal.app calabash-‐ios console
irb(main):001:0> start_test_server_in_background
=> nil
12 y 13 de noviembre de 2014 Valencia, España
![Page 40: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/40.jpg)
12 y 13 de noviembre de 2014 Valencia, España
![Page 41: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/41.jpg)
Si has llegado hasta aquí tu jefe estará muy contento…
12 y 13 de noviembre de 2014 Valencia, España
![Page 42: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/42.jpg)
Creemos Features
![Page 43: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/43.jpg)
Creamos una nueva Feature
Demo II
![Page 44: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/44.jpg)
Creemos una nueva feature que sea común para iOS y Android:
$> vim features/login.feature
Feature: Login
@invalid
Scenario: Add site -‐ Invalid login
Given I am about to login
When I enter invalid credentials
Then I am presented with an error message to correct credentials
@valid
Scenario: Add site
Given I am about to login
When I enter valid credentials
Then I am successfully authenticated
And I can see posts for the site
12 y 13 de noviembre de 2014 Valencia, España
![Page 45: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/45.jpg)
Definamos los steps:
$> vim features/login.feature
Given(/^I am about to login$/) do
@current_page = page(LoginPage).await(timeout: 30)
@current_page.self_hosted_site
end
When(/^I enter invalid credentials$/) do
user = CREDENTIALS[:invalid_user]
@current_page = @current_page.login(user[:username], user[:password], CREDENTIALS[:site])
end
Then(/^I am presented with an error message to correct credentials$/) do
#TODO
end
When(/^I enter valid credentials$/) do
user = CREDENTIALS[:valid_user]
@current_page = @current_page.login(user[:username], user[:password],CREDENTIALS[:site])
end
Then(/^I am successfully authenticated$/) do
unless @current_page.is_a?(SitePage)
raise "Expected SitePage, but found #{@current_page}"
end
end
12 y 13 de noviembre de 2014 Valencia, España
![Page 46: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/46.jpg)
Definamos los steps:
$> vim features/login.feature
When(/^I can see posts for the site$/) do
@current_page.to_posts
end
12 y 13 de noviembre de 2014 Valencia, España
![Page 47: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/47.jpg)
Creamos los Screen Objects y el código auxiliar
$> git clone https://github.com/enriquesanchezb/vlctesting14.git
12 y 13 de noviembre de 2014 Valencia, España
![Page 48: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/48.jpg)
12 y 13 de noviembre de 2014 Valencia, España
![Page 49: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/49.jpg)
¿Cómo añadimos esto a un proceso de IC?
![Page 50: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/50.jpg)
Continuous Integration is a software development practice where members of a
team integrate their work frequently (…)
Each integration is verified by an automated build (including test) to detect integration errors
as quickly as possible
12 y 13 de noviembre de 2014 Valencia, España
![Page 51: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/51.jpg)
12 y 13 de noviembre de 2014 Valencia, España
![Page 52: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/52.jpg)
Rock’n’roll
Demo III
![Page 53: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/53.jpg)
Instalamos Jenkins
$> brew install jenkins
12 y 13 de noviembre de 2014 Valencia, España
![Page 54: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/54.jpg)
Instalamos los plugins que necesitamos
12 y 13 de noviembre de 2014 Valencia, España
![Page 55: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/55.jpg)
Comprobamos que Xcode y el ANDROID_HOME están correctos
12 y 13 de noviembre de 2014 Valencia, España
![Page 56: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/56.jpg)
Creamos un nuevo Job para cada una de las dos tareas que queremos realizar
12 y 13 de noviembre de 2014 Valencia, España
![Page 57: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/57.jpg)
Darle nombre a la tarea
Crear un nuevo comando de shell
12 y 13 de noviembre de 2014 Valencia, España
![Page 58: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/58.jpg)
![Page 59: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/59.jpg)
Preguntas?Gracias!
![Page 60: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/60.jpg)
Enrique Sánchez | [email protected] | @EnriqueSanchezB
12 y 13 de noviembre de 2014 Valencia, España
![Page 61: Seminario Calabash - VLCTesting 2014](https://reader034.fdocuments.mx/reader034/viewer/2022052601/55978ef81a28abd0368b46ce/html5/thumbnails/61.jpg)