SlideShare una empresa de Scribd logo
TDD
Desarrollo Dirigido por Pruebas
Ciclo


Test en ROJO
Ciclo


Test en ROJO   Test en VERDE
Ciclo


Test en ROJO   Test en VERDE   Refactor
Ciclo


Test en ROJO   Test en VERDE   Refactor

 Baby steps
Ciclo


Test en ROJO    Test en VERDE     Refactor

 Baby steps    Prohibido pensar
Ciclo


Test en ROJO    Test en VERDE        Refactor

 Baby steps    Prohibido pensar   Transformations
Evolución del código con TDD


•   Tests progresan desde una definición genérica hacia la más específica

•   Implementación progresa desde específica hacia genérica
Refactor
Code refactoring is "a disciplined way to restructure code",[1] undertaken
in order to improve some of the nonfunctional attributes of the software.


By continuously improving the design of code, we make it easier and easier to work with. This
is in sharp contrast to what typically happens: little refactoring and a great deal of attention
paid to expediently adding new features. If you get into the hygienic habit of refactoring
continuously, you'll find that it is easier to extend and maintain code.

                                                  —- Joshua Kerievsky, Refactoring to Patterns
Transformation
({}–>nil) no code at all->code that employs nil
(nil->constant)
(constant->constant+) a simple constant to a more complex constant
(constant->scalar) replacing a constant with a variable or an argument
(statement->statements) adding more unconditional statements.
(unconditional->if) splitting the execution path
(scalar->array)
(array->container)
(statement->recursion)
(if->while)
(expression->function) replacing an expression with a function or algorithm
(variable->assignment) replacing the value of a variable.
       http://cleancoder.posterous.com/the-transformation-priority-premise
Waterfall

•   Requisitos

•   Análisis          Cada paso
•   Diseño         inyecta feedback
•   Coding
                      al anterior
•   Testeo
Lean - BDD - TDD - Test first

   •   Requisitos

   •   Análisis

   •   Diseño

   •   Coding       Test first

   •   Testeo
Lean - BDD - TDD - Test first

   •   Requisitos

   •   Análisis

   •   Diseño                   TDD

   •   Coding       Test first

   •   Testeo
Lean - BDD - TDD - Test first

   •   Requisitos

   •   Análisis                       BDD

   •   Diseño                   TDD

   •   Coding       Test first

   •   Testeo
Lean - BDD - TDD - Test first

   •   Requisitos                           Lean

   •   Análisis                       BDD

   •   Diseño                   TDD

   •   Coding       Test first

   •   Testeo
TDD                                       BDD


Top-down / Bottom up    Estrategias            Outside in


      Arrange                                   Given ...
        Act         Forma de una prueba         When ...
      Assert                                    Then ...

   Example driven      Fuerza motriz      Business value driven


       xUnit             Standard                  --
                       Frameworks
       jUnit                           Concordion, EasyB, JBehave
                           Java
Herramientas
       KISS,YAGNI, SOLID, DRY

   Bloc de notas, estrategia de testeo

       Autotest, TDGotchi, Pulse

Pair programming, ping-pong, peer-review



 Esto va de hacer software bien hecho
Ejemplo BDD
  Describir comportamiento                               Escribir la definición de un paso                                   Ver cómo falla




Escribir lo mínimo para que pase                                  Ver que pasa                                  Iterar hasta que todo esté verde




                         Y, finalmente, repetir todo con nuevos comportamientos hasta que se acabe la pasta/alcance/tiempo
Ejemplo de TDD


Kata: StringCalculator

Más contenido relacionado

ODP
Introducción a Behaviour Driven Development
PDF
Td dvs bdd
PPTX
TDD (Test-Driven Development)
PDF
Cas2010 behavior-driven-development-aplicado-en-acceptance-test-automation
PPTX
Desarrollo Dirigido por Comportamiento (con Cucumber y Groovy)
PPTX
BDD - Desarrollo dirigido por comportamiento
PDF
BDD y tests automatizados
PPTX
Buenas practicas desarrollando software
Introducción a Behaviour Driven Development
Td dvs bdd
TDD (Test-Driven Development)
Cas2010 behavior-driven-development-aplicado-en-acceptance-test-automation
Desarrollo Dirigido por Comportamiento (con Cucumber y Groovy)
BDD - Desarrollo dirigido por comportamiento
BDD y tests automatizados
Buenas practicas desarrollando software

Destacado (8)

PDF
Control de Versiones - Slides
PPTX
Aftermath of functional programming. the good parts
PDF
Aftermath of functional programming. The good parts
PPT
Comité paritario de salud ocupacional
PDF
Salud trabajo autocuidado
PPTX
Autocuidado
PDF
Hype vs. Reality: The AI Explainer
PDF
Study: The Future of VR, AR and Self-Driving Cars
Control de Versiones - Slides
Aftermath of functional programming. the good parts
Aftermath of functional programming. The good parts
Comité paritario de salud ocupacional
Salud trabajo autocuidado
Autocuidado
Hype vs. Reality: The AI Explainer
Study: The Future of VR, AR and Self-Driving Cars
Publicidad

Similar a TDD (20)

PDF
[ES] webcat 2014-03 Demystifying Development Techniques
PDF
"Demystifying development techniques" por @eturino
PPTX
PDF
Test Driven Development. Fortalezas y Debilidades
PDF
Introducción a TDD
PDF
Introducción a TDD
PDF
Apuntes #XPweek
PPSX
7iSF-4 test driver development
PPT
Tdd on the rocks
PPTX
Artalde Tdd intro
PPTX
Introducción a tdd
PPTX
Unidad ii. tdd
PDF
Metodologías Aágiles: TDD (Test Driven development)
PPTX
Cruzando el abismo educativo de la ingeniería de software utilizando Software...
ODP
Tdd desde las_trincheras
PDF
Desarrollo Guiado por Comportamiento
PDF
Crowdar - Introducción a BDD
PPTX
imagenes-testing-agile-agil.pptx.doc.ppt.doc
PDF
Como escribir buenos tests al hacer TDD
[ES] webcat 2014-03 Demystifying Development Techniques
"Demystifying development techniques" por @eturino
Test Driven Development. Fortalezas y Debilidades
Introducción a TDD
Introducción a TDD
Apuntes #XPweek
7iSF-4 test driver development
Tdd on the rocks
Artalde Tdd intro
Introducción a tdd
Unidad ii. tdd
Metodologías Aágiles: TDD (Test Driven development)
Cruzando el abismo educativo de la ingeniería de software utilizando Software...
Tdd desde las_trincheras
Desarrollo Guiado por Comportamiento
Crowdar - Introducción a BDD
imagenes-testing-agile-agil.pptx.doc.ppt.doc
Como escribir buenos tests al hacer TDD
Publicidad

TDD

  • 3. Ciclo Test en ROJO Test en VERDE
  • 4. Ciclo Test en ROJO Test en VERDE Refactor
  • 5. Ciclo Test en ROJO Test en VERDE Refactor Baby steps
  • 6. Ciclo Test en ROJO Test en VERDE Refactor Baby steps Prohibido pensar
  • 7. Ciclo Test en ROJO Test en VERDE Refactor Baby steps Prohibido pensar Transformations
  • 8. Evolución del código con TDD • Tests progresan desde una definición genérica hacia la más específica • Implementación progresa desde específica hacia genérica
  • 9. Refactor Code refactoring is "a disciplined way to restructure code",[1] undertaken in order to improve some of the nonfunctional attributes of the software. By continuously improving the design of code, we make it easier and easier to work with. This is in sharp contrast to what typically happens: little refactoring and a great deal of attention paid to expediently adding new features. If you get into the hygienic habit of refactoring continuously, you'll find that it is easier to extend and maintain code. —- Joshua Kerievsky, Refactoring to Patterns
  • 10. Transformation ({}–>nil) no code at all->code that employs nil (nil->constant) (constant->constant+) a simple constant to a more complex constant (constant->scalar) replacing a constant with a variable or an argument (statement->statements) adding more unconditional statements. (unconditional->if) splitting the execution path (scalar->array) (array->container) (statement->recursion) (if->while) (expression->function) replacing an expression with a function or algorithm (variable->assignment) replacing the value of a variable. http://cleancoder.posterous.com/the-transformation-priority-premise
  • 11. Waterfall • Requisitos • Análisis Cada paso • Diseño inyecta feedback • Coding al anterior • Testeo
  • 12. Lean - BDD - TDD - Test first • Requisitos • Análisis • Diseño • Coding Test first • Testeo
  • 13. Lean - BDD - TDD - Test first • Requisitos • Análisis • Diseño TDD • Coding Test first • Testeo
  • 14. Lean - BDD - TDD - Test first • Requisitos • Análisis BDD • Diseño TDD • Coding Test first • Testeo
  • 15. Lean - BDD - TDD - Test first • Requisitos Lean • Análisis BDD • Diseño TDD • Coding Test first • Testeo
  • 16. TDD BDD Top-down / Bottom up Estrategias Outside in Arrange Given ... Act Forma de una prueba When ... Assert Then ... Example driven Fuerza motriz Business value driven xUnit Standard -- Frameworks jUnit Concordion, EasyB, JBehave Java
  • 17. Herramientas KISS,YAGNI, SOLID, DRY Bloc de notas, estrategia de testeo Autotest, TDGotchi, Pulse Pair programming, ping-pong, peer-review Esto va de hacer software bien hecho
  • 18. Ejemplo BDD Describir comportamiento Escribir la definición de un paso Ver cómo falla Escribir lo mínimo para que pase Ver que pasa Iterar hasta que todo esté verde Y, finalmente, repetir todo con nuevos comportamientos hasta que se acabe la pasta/alcance/tiempo
  • 19. Ejemplo de TDD Kata: StringCalculator

Notas del editor