SlideShare une entreprise Scribd logo
1  sur  82
Télécharger pour lire hors ligne
OTIMIZANDO INTEGRAÇÕES COM
TESTES DE COLABORAÇÃO E CONTRATO




                                                                                 @snit_ram
 http://www.flickr.com/photos/viasualart2011/5941136672/sizes/l/in/photostream/
TEORIA DAS FILAS




   http://www.flickr.com/photos/57665680@N06/5649865356/sizes/l/in/photostream/
TEORIA DAS FILAS


“ Dado um processo B, que sucede um
   processo A, as vezes, ao executar B,
precisamos refazer parte de A. Podemos
evitar este retrabalho extraindo parte de
 B e executando-o antes do processo A
                                        ”
TEORIA DAS FILAS



    A     B
TEORIA DAS FILAS



    A     B
        20%
TEORIA DAS FILAS



    B     A

            Ciclos
            curtos
REVENDO O WATERFALL




       http://www.flickr.com/photos/chiaralily/4416226801/sizes/z/in/photostream/
REVENDO O WATERFALL

 Requisitos
              Análise

                        Design
                             Código
                                      Testes
                                          Manutenção
Código   Teste
Código      Teste




         Bugs
Teste   Código




                 Ciclos
                 curtos
Teste
Design
                 Código
Teste
Design
                          Código



         “Não testável”
Teste            Código




        Design

                          Ciclos
                          Curtos
= TDD
Teste            Código




        Design

                          Ciclos
                          Curtos
Teste            Código

Análise


                  Design
Teste            Código

 Análise


                       Design


“Não era isso que eu queria”
Teste   Código




Análise    Design

                    Ciclos
                    Curtos
= Agile
  Teste   Código




Análise    Design

                    Ciclos
                    Curtos
INTEGRAÇÃO




    http://www.edge-ka.com/uploads/Image/BioRails/collaboration.jpg
A   B
Teste   A   Código   B
Teste   A   Código   Teste   B   Código
Teste   A   Código   Teste   B   Código
Teste   A   Código                Teste   B   Código

                     Integração
Teste   A   Código                Teste   B   Código

                     Integração




                     BUGS
WTF?
Teste


                 Integração
        Código
Teste


                         Integração
        Código




           “quando juntei deu erro”
O QUE?
Teste                Código




        Integração


                              Ciclos
                              curtos
COMO?
TESTES DE COLABORAÇÃO
      E CONTRATO




    http://www.flickr.com/photos/25143703@N04/2491903629/sizes/m/in/photostream/
COMO FUNCIONA

    1       2       3




4       5       6       7




    8               9
COMO FUNCIONA


                  C
                  o
     Testes de    n
                  t
                      Testes de
1                                 5
                  r
    Colaboração   a   Contrato
                  t
                  o
COMO FUNCIONA
          Colaboração



       Fiz a pergunta certa?

                                 5
1
                                Mock


       Sei tratar a resposta?
COMO FUNCIONA
        Contrato



  Sou capaz de responder?

                            5



  Respondo como esperado?
COMO FUNCIONA
    Colaboração             Contrato

                       C
      Fiz a pergunta   o    Sou capaz de
           certa?      n     responder?
                       t
                       r
1                                          5
                       a
                       a
       Sei tratar a    t
                           Respondo como
                       o
        resposta?             esperado?
Correspondência
   entre testes
EXEMPLO REAL



                       The
                   Coffee Maker




   https://github.com/snit-ram/contract-tests-lab
THE COFFEE MAKER


               Water      Led
              Dispenser



CoffeeMaker


               Ground
               Coffee     Led
              Dispenser
Init

                 Water      Led
                Dispenser



  CoffeeMaker


                 Ground
                 Coffee     Led
                Dispenser
Init
                Init

                        Water      Led
                       Dispenser



  CoffeeMaker


                        Ground
                        Coffee     Led
                       Dispenser



                         Init
Init
                            On
                 Water           Led
                Dispenser



  CoffeeMaker


                 Ground
                 Coffee          Led
                Dispenser

                            On
Fill

                 Water      Led
                Dispenser



  CoffeeMaker


                 Ground
                 Coffee     Led
                Dispenser
Fill
                fill

                        Water      Led
                       Dispenser



  CoffeeMaker


                        Ground
                        Coffee     Led
                       Dispenser



                         fill
Fill
                            Off
                 Water            Led
                Dispenser



  CoffeeMaker


                 Ground
                 Coffee           Led
                Dispenser

                            Off
Make coffee

                 Water      Led
                Dispenser



  CoffeeMaker


                 Ground
                 Coffee     Led
                Dispenser
Make coffee

Make
coffee              Water      Led
                   Dispenser



     CoffeeMaker


                    Ground
                    Coffee     Led
                   Dispenser
Make coffee

                        Water      Led
            has?       Dispenser



  CoffeeMaker


                        Ground
                        Coffee     Led
                has?   Dispenser
Make coffee

                        Water      Led
                y/n    Dispenser



  CoffeeMaker


                        Ground
                        Coffee     Led
                 y/n   Dispenser
Make coffee

                   Water      Led
                  Dispenser



    CoffeeMaker


                   Ground
                   Coffee     Led
                  Dispenser
exception
Make coffee

                       Water      Led
                get   Dispenser



  CoffeeMaker


                       Ground
                       Coffee     Led
                get   Dispenser
Make coffee

                Give    Water      Led
                       Dispenser



  CoffeeMaker


                        Ground
                        Coffee     Led
                       Dispenser
                Give
Make coffee
                has?

                    Water      Led
                   Dispenser



  CoffeeMaker


                    Ground
                    Coffee     Led
                   Dispenser


                  has?
Make coffee
                            On
                 Water           Led
                Dispenser



  CoffeeMaker


                 Ground
                 Coffee          Led
                Dispenser

                            On
Make coffee

                   Water      Led
                  Dispenser



    CoffeeMaker


                   Ground
                   Coffee     Led
                  Dispenser
 coffee
COLABORAÇÃO
              has(5)
                         Water
CoffeeMaker             Dispenser
                         Mock
              True
COLABORAÇÃO
              has(5)
                         Water
CoffeeMaker             Dispenser
                         Mock
              True



              has(5)
                         Water
CoffeeMaker             Dispenser
                         Mock
              False
CONTRATO
                 amount=5
     has(5)
                   Water
                  Dispenser

  assertTrue()
CONTRATO
                 amount=5
     has(5)
                   Water
                  Dispenser

  assertTrue()


                 amount=2
     has(5)
                   Water
                  Dispenser
 assertFalse()
COLABORAÇÃO
get(5)
               assertFalse( led.on.called )
   Water                                       Led
  Dispenser                                   Mock


amount=10
COLABORAÇÃO
get(5)
               assertFalse( led.on.called )
   Water                                       Led
  Dispenser                                   Mock


amount=10


get(5)
               assertTrue( led.on.called )
   Water                                       Led
  Dispenser                                   Mock


amount=5
CONTRATO
         on()
                           Led


assertTrue( self.is_on )
CONTRATO
          on()
                            Led


assertTrue( self.is_on )



          off()
                            Led

assertFalse( self.is_on )
POR QUE?
Integração durante o fluxo de TDD
Integração durante o fluxo de TDD


   Feedback mais rápido
Integração durante o fluxo de TDD


   Feedback mais rápido

  Continuous integration
Contratos sólidos
Contratos sólidos

Reduz bugs / retrabalho
Contratos sólidos

 Reduz bugs / retrabalho
Colaborações transparentes
Contratos sólidos

 Reduz bugs / retrabalho
Colaborações transparentes
   Aumenta paralelismo
Reduz testes integrados
Reduz testes integrados

Suite mais rápida
Reduz testes integrados

    Suite mais rápida
Menos código para manter
Reduz testes integrados

    Suite mais rápida
Menos código para manter
    Trabalho focado
Outside-in Development
Outside-in Development

  Design simples
Outside-in Development

  Design simples
Código independente
MAY THE
CONTRACT TESTS
  BE WITH YOU




   rmartins@yahoo-inc.com
               @snit_ram

Contenu connexe

En vedette

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 

En vedette (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

Otimizando integrações com testes de colaboração e contrato