Desarrollo Dirigido por Comportamiento

Transcripción

Desarrollo Dirigido por Comportamiento
Behaviour
Driven
Development
Javier Aranda
:twitter => @javiarandav
:email => '[email protected]'
Analista/Programador en
NoSoloSoftware Network
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
En capítulos anteriores...
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
DSL para BDD: GHERKIN
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
DSL
●
Orientado al Modelo de Negocio
●
Localizado (i18n)
●
Implementado en varios lenguajes de
programación. Usaremos Cucumber, la
implementación para Ruby
●
Podemos testear código escrito en otros
lenguajes distintos a Ruby
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
Propósitos
●
Documentación
●
Tests automatizados
●
Cuando está en rojo nos dice que es lo que
tenemos que codificar para cumplir con la
funcionalidad
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
Convenciones
●
Un sólo archivo contiene una única
característica
●
Los archivos tienen la extensión .feature
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
Ejemplo
# language: en
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario: Add two numbers
Given I have entered 20 into the calculator
And I have entered 10 into the calculator
When I press add
Then the result should be 30 on the screen
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
Ejemplo
# language: es
Característica: adición
Para evitar hacer errores tontos
Como un matemático idiota
Quiero saber la suma de los números
Escenario: Sumar dos números
Dado que he introducido 20 en la calculadora
Y que he introducido 10 en la calculadora
Cuando oprimo el sumar
Entonces el resultado debe ser 30 en la pantalla
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
Sintaxis del Lenguaje
●
Feature → Característica
●
Scenario → Escenario
●
Given → Dado, Dada, Dados, Dadas
●
When → Cuando
●
Then → Entonces
●
And → Y
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
La teoría está muy bien...
... Pero...
... lo que mola es picar código y
llenarse de barro! ¿no?
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
No, no, me refería a otro tipo de barro
Así que fuera teoría y pongámosla en
práctica
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
Aprovechando la ocasión...
- Mañana de 14:00 a 16:00 Software Libre con Patatas
- Próximamente Curso de Ruby, ¡muy interesante!
- Charlas Aula Software Libre
print “Javier Aranda”, { :twitter => @javiarandav, :email => '[email protected]' }
Behaviour Driven Development – I Jornadas Tecnológicas CEEPS
exit(0);
Sígueme en Twitter: @javiarandav
O escríbeme un email: [email protected]

Documentos relacionados