SlideShare a Scribd company logo
1 of 45
Download to read offline
ERROS COMUNS EM
        TEST-DRIVEN DEVELOPMENT

                             Mauricio Aniche
                          mauricio@aniche.com.br
                             @mauricioaniche




Thursday, June 24, 2010
DESVIOS COMUNS EM
        TEST-DRIVEN DEVELOPMENT

                             Mauricio Aniche
                          mauricio@aniche.com.br
                             @mauricioaniche




Thursday, June 24, 2010
MAS O QUE É
                          TDD MESMO?




Thursday, June 24, 2010
É SOBRE TESTES?




Thursday, June 24, 2010
Thursday, June 24, 2010
Thursday, June 24, 2010
Thursday, June 24, 2010
Thursday, June 24, 2010
NÃO!
Thursday, June 24, 2010
É SOBRE
        DESIGN!




Thursday, June 24, 2010
QUE
                          CONFUSÃO! :-(




Thursday, June 24, 2010
Test-driven development (TDD) is the craft of
                  producing automated tests for production code, and
                  using that process to drive design and programming.
                   For every tiny bit of functionality in the production
                     code, you first develop a test that specifies and
                   validates what the code will do. You then produce
                  exactly as much code as will enable that test to pass.
                    Then you refactor (simplify and clarify) both the
                           production code and the test code.




                    www.agilealliance.org/programs/ roadmaps/Roadmap/tdd/tdd_index.htm

Thursday, June 24, 2010
Thursday, June 24, 2010
É SIMPLES!




Thursday, June 24, 2010
MAS NÃO É
                            FÁCIL!



Thursday, June 24, 2010
PROGRAMADORES ÀS VEZES
          COMETEM DESVIOS...



Thursday, June 24, 2010
FATORES DE INFLUÊNCIA




Thursday, June 24, 2010
QUESTIONÁRIO




Thursday, June 24, 2010
NÃO VER O TESTE FALHAR



Thursday, June 24, 2010
50
                                                                                         •55% nunca esquece ou
                                                                                         esquece raramente de ver o
               38
                                                                                         teste falhar;
               25
                                                                                         •24% esquece regularmente
               13
                                                                                         ou frequentemente;

                 0
                          Never            Sometimes               Frequently
                                                                                         •4% sempre esquece;
                                  Rarely               Regularly                Always




Thursday, June 24, 2010
ESQUECER DE
                           REFATORAR




Thursday, June 24, 2010
40
                                                                                    •44% dos
                                                                                    programadores
          30
                                                                                    experientes e 52% dos
                                                                                    iniciantes cometem esse
          20
                                                                                    erro regularmente ou
                                                                                    frequentemente;
          10


            0
                                                                                    •1% sempre esquece.
                     Never            Sometimes               Frequently

                             Rarely               Regularly                Always




Thursday, June 24, 2010
REFATORAR OUTRO
                    TRECHO DE CÓDIGO
                   ENQUANTO TRABALHA
                        EM UM TESTE


Thursday, June 24, 2010
40
                                                                                  •40% refatora outro trecho
                                                                                  de código regularmente ou
                                                                                  frequentemente;
        30
                                                                                  •5% refatora o tempo
                                                                                  todo;
        20
                                                                                  •6% nunca refatora;
                                                                                  •38% dos experientes
        10                                                                        fazem isso regularmente ou
                                                                                  frequentemente. No
          0                                                                       entendo, 44% nunca faz ou
                   Never            Sometimes               Frequently

                           Rarely               Regularly                Always   faz apenas raramente.



Thursday, June 24, 2010
NÃO COMEÇAR PELO
                           TESTE MAIS SIMPLES
                               POSSÍVEL



Thursday, June 24, 2010
50                                                                        •33% não começam pelo
                                                                                  teste mais simples possível
        38                                                                        regularmente ou
                                                                                  frequentemente;
        25

                                                                                  •2% sempre cometem o
        13                                                                        erro;

          0
                   Never            Sometimes               Frequently            •10% nunca cometem.
                           Rarely               Regularly                Always




Thursday, June 24, 2010
RODAR APENAS O
                          TESTE CORRENTE




Thursday, June 24, 2010
40                                                                        •16% rodam apenas o teste
                                                                                 corrente regularmente ou
                                                                                 frequentemente;
       30
                                                                                 •2% cometem o erro o
                                                                                 tempo todo;
       20
                                                                                 •25% nunca esquecem de
                                                                                 rodar a suíte inteira;
       10
                                                                                 •Programadores experientes
                                                                                 cometem esse erro mais
         0
                 Never             Sometimes               Frequently            frequentemente do que os
                          Rarely               Regularly                Always   iniciantes (21% contra 15%).



Thursday, June 24, 2010
ESCREVER TESTES
                            COMPLEXOS



Thursday, June 24, 2010
40                                                                         •50% escrevem cenários
                                                                                 complexos regularmente ou
      30
                                                                                 frequentemente;

                                                                                 •4% escreve o tempo todo;
      20
                                                                                 •3% nunca escreve;
      10                                                                         •35% dos programadores
                                                                                 experientes e 53% dos iniciantes
                                                                                 fazem isso regularmente ou
        0
                 Never             Sometimes               Frequently
                                                                                 frequentemente;
                          Rarely               Regularly                Always




Thursday, June 24, 2010
NÃO IMPLEMENTAR O
                          CÓDIGO MAIS SIMPLES
                           QUE FAÇA O TESTE
                                PASSAR


Thursday, June 24, 2010
50
                                                                                 •35% dos iniciantes e
       38                                                                        17% dos experientes
                                                                                 tendem a não
       25
                                                                                 implementar o código
                                                                                 mais simples que faça o
                                                                                 teste passar regularmente
       13
                                                                                 ou frequentemente;
         0
                 Never             Sometimes               Frequently

                          Rarely               Regularly                Always




Thursday, June 24, 2010
NOMES NÃO CLAROS
                            PARA OS TESTES




Thursday, June 24, 2010
40
                                                                                 •32% usam nomes não
       30
                                                                                 claros regularmente ou
                                                                                 frequentemente;
       20
                                                                                 •1% usam nomes não claros
                                                                                 o tempo todo;
       10

                                                                                 •14% nunca usam e 45%
         0                                                                       nunca usa ou usa raramente.
                 Never             Sometimes               Frequently

                          Rarely               Regularly                Always




                                                                           30
Thursday, June 24, 2010
NÃO REFATORAR
                          CÓDIGO DE TESTE




Thursday, June 24, 2010
50
                                                                                 •23% não refatora o código
       38                                                                        de teste regularmente ou
                                                                                 frequentemente;
       25
                                                                                 •1% sempre esquece de
       13
                                                                                 refatorar;


         0                                                                       •16% nunca comete o erro;
                  Never            Sometimes               Frequently

                          Rarely               Regularly                Always




                                                                          32
Thursday, June 24, 2010
DESVIOS MAIS COMUNS
                  Desvio              Média/Desvio Padrão        Correlação de Pearson   Frequente ou sempre

        Escrever testes complexos          2.58 / 1.21                    -0.1                 26.61%

          Esquecer de refatorar            2.37 / 1.17                   -0.03                 19.72%

        Refatorar outro trecho de
                                           2.34 / 1.36                   -0.13                 23.85%
                  código
      Não comecar pelo teste mais
                                           2.00 / 1.28                   -0.09                 15.14%
            simples possível
    Não implementar o código mais
                                           1.90 / 1.19                   -0.24                 11.01%
     simples que faz o teste passar

       Nomes de testes não claros          1.84 / 1.25                   -0.02                 11.01%

          Não ver o teste falhar           1.75 / 1.35                   -0.22                 14.22%

    Não refatorar o código de teste
                                           1.67 / 1.19                   -0.21                  8.72%

     Rodar apenas o teste corrente
                                           1.40 / 1.20                   -0.01                  5.96%


                                                            33
Thursday, June 24, 2010
PRECISO SEGUIR A RISCA
                     O TEMPO TODO?



                            34
Thursday, June 24, 2010
O QUE ELES PENSAM
                             SOBRE TDD?



                                  35
Thursday, June 24, 2010
PROBLEMAS
                           A VALIDAR



                              36
Thursday, June 24, 2010
CONCLUSÃO




                              37
Thursday, June 24, 2010
TRABALHOS FUTUROS




                                  38
Thursday, June 24, 2010
AONDE POSSO LER MAIS
                SOBRE ISSO?

    •O artigo foi publicado no 1st International Workshop on Test-
    Driven Development e pode ser encontrado na biblioteca da
    IEEE Digital.

    •Ou através da página dedicada ao trabalho em
    http://www.ime.usp.br/~aniche/tdd-survey




                                  39
Thursday, June 24, 2010
GOSTOU E QUER
                             AJUDAR?



                                40
Thursday, June 24, 2010
@mauricioaniche
                          mauricio@aniche.com.br



                                    41
Thursday, June 24, 2010

More Related Content

Viewers also liked

This is my school (ines)
This is my school (ines)This is my school (ines)
This is my school (ines)rominacheme
 
MarketingProfs 2012 State of Social Media
MarketingProfs 2012 State of Social Media MarketingProfs 2012 State of Social Media
MarketingProfs 2012 State of Social Media Lithium
 
Statistical Report Of The 2008 Iblce Examination
Statistical Report Of The 2008 Iblce ExaminationStatistical Report Of The 2008 Iblce Examination
Statistical Report Of The 2008 Iblce ExaminationBiblioteca Virtual
 
Unsafe Sleep Practices And An Analysis Of Bedsharing Among Infants Dying Sudd...
Unsafe Sleep Practices And An Analysis Of Bedsharing Among Infants Dying Sudd...Unsafe Sleep Practices And An Analysis Of Bedsharing Among Infants Dying Sudd...
Unsafe Sleep Practices And An Analysis Of Bedsharing Among Infants Dying Sudd...Biblioteca Virtual
 
19. Decision Making
19. Decision Making19. Decision Making
19. Decision MakingNBHS
 
Forever Flowing: The Azure legacy 1.2
Forever Flowing: The Azure legacy 1.2Forever Flowing: The Azure legacy 1.2
Forever Flowing: The Azure legacy 1.2Geminiasp
 
Lenmana Island Travel Special
Lenmana Island Travel SpecialLenmana Island Travel Special
Lenmana Island Travel SpecialGeminiasp
 
Rendon Remodeling & Design Info
Rendon Remodeling & Design InfoRendon Remodeling & Design Info
Rendon Remodeling & Design Infomrendon2323
 
Бизнес-кейс: Zingaya Click-to-Call (онлайн звонок) для повышения эффективност...
Бизнес-кейс: Zingaya Click-to-Call (онлайн звонок) для повышения эффективност...Бизнес-кейс: Zingaya Click-to-Call (онлайн звонок) для повышения эффективност...
Бизнес-кейс: Zingaya Click-to-Call (онлайн звонок) для повышения эффективност...Michael Kozloff
 
Introduction to Optimization Group
Introduction to Optimization GroupIntroduction to Optimization Group
Introduction to Optimization GroupTom_Thompson
 
ComunicaCity call4ideas2015 ForumPA
ComunicaCity call4ideas2015 ForumPAComunicaCity call4ideas2015 ForumPA
ComunicaCity call4ideas2015 ForumPAComunicaCity
 
Frente De Defesa Do Plano Diretor Estrategico
Frente De Defesa Do Plano Diretor EstrategicoFrente De Defesa Do Plano Diretor Estrategico
Frente De Defesa Do Plano Diretor Estrategicourbanias
 
Диплом бакалавра
Диплом бакалавраДиплом бакалавра
Диплом бакалавраguest79428
 
FSI- Claim the Customer Experience Now
FSI- Claim the Customer Experience Now FSI- Claim the Customer Experience Now
FSI- Claim the Customer Experience Now Lithium
 
Об ActiveCloud ("В Облаке.РФ" №1)
Об ActiveCloud ("В Облаке.РФ" №1)Об ActiveCloud ("В Облаке.РФ" №1)
Об ActiveCloud ("В Облаке.РФ" №1)Michael Kozloff
 

Viewers also liked (20)

This is my school (ines)
This is my school (ines)This is my school (ines)
This is my school (ines)
 
Chisholm Gallery/Leslie Shiels Canine Culture 2
Chisholm Gallery/Leslie Shiels Canine Culture 2Chisholm Gallery/Leslie Shiels Canine Culture 2
Chisholm Gallery/Leslie Shiels Canine Culture 2
 
MarketingProfs 2012 State of Social Media
MarketingProfs 2012 State of Social Media MarketingProfs 2012 State of Social Media
MarketingProfs 2012 State of Social Media
 
Mosaic Presentation May 2009
Mosaic Presentation May 2009Mosaic Presentation May 2009
Mosaic Presentation May 2009
 
Statistical Report Of The 2008 Iblce Examination
Statistical Report Of The 2008 Iblce ExaminationStatistical Report Of The 2008 Iblce Examination
Statistical Report Of The 2008 Iblce Examination
 
Unsafe Sleep Practices And An Analysis Of Bedsharing Among Infants Dying Sudd...
Unsafe Sleep Practices And An Analysis Of Bedsharing Among Infants Dying Sudd...Unsafe Sleep Practices And An Analysis Of Bedsharing Among Infants Dying Sudd...
Unsafe Sleep Practices And An Analysis Of Bedsharing Among Infants Dying Sudd...
 
11 ConfiguracióN
11 ConfiguracióN11 ConfiguracióN
11 ConfiguracióN
 
19. Decision Making
19. Decision Making19. Decision Making
19. Decision Making
 
Forever Flowing: The Azure legacy 1.2
Forever Flowing: The Azure legacy 1.2Forever Flowing: The Azure legacy 1.2
Forever Flowing: The Azure legacy 1.2
 
Lenmana Island Travel Special
Lenmana Island Travel SpecialLenmana Island Travel Special
Lenmana Island Travel Special
 
Rendon Remodeling & Design Info
Rendon Remodeling & Design InfoRendon Remodeling & Design Info
Rendon Remodeling & Design Info
 
Бизнес-кейс: Zingaya Click-to-Call (онлайн звонок) для повышения эффективност...
Бизнес-кейс: Zingaya Click-to-Call (онлайн звонок) для повышения эффективност...Бизнес-кейс: Zingaya Click-to-Call (онлайн звонок) для повышения эффективност...
Бизнес-кейс: Zingaya Click-to-Call (онлайн звонок) для повышения эффективност...
 
Our Song
Our SongOur Song
Our Song
 
Introduction to Optimization Group
Introduction to Optimization GroupIntroduction to Optimization Group
Introduction to Optimization Group
 
ComunicaCity call4ideas2015 ForumPA
ComunicaCity call4ideas2015 ForumPAComunicaCity call4ideas2015 ForumPA
ComunicaCity call4ideas2015 ForumPA
 
Frente De Defesa Do Plano Diretor Estrategico
Frente De Defesa Do Plano Diretor EstrategicoFrente De Defesa Do Plano Diretor Estrategico
Frente De Defesa Do Plano Diretor Estrategico
 
Диплом бакалавра
Диплом бакалавраДиплом бакалавра
Диплом бакалавра
 
FSI- Claim the Customer Experience Now
FSI- Claim the Customer Experience Now FSI- Claim the Customer Experience Now
FSI- Claim the Customer Experience Now
 
Об ActiveCloud ("В Облаке.РФ" №1)
Об ActiveCloud ("В Облаке.РФ" №1)Об ActiveCloud ("В Облаке.РФ" №1)
Об ActiveCloud ("В Облаке.РФ" №1)
 
Marketplaces
MarketplacesMarketplaces
Marketplaces
 

More from Maurício Aniche

Can ML help software developers? (TEQnation 2022)
Can ML help software developers? (TEQnation 2022)Can ML help software developers? (TEQnation 2022)
Can ML help software developers? (TEQnation 2022)Maurício Aniche
 
Tracing Back Log Data to its Log Statement: From Research to Practice
Tracing Back Log Data to its Log Statement: From Research to PracticeTracing Back Log Data to its Log Statement: From Research to Practice
Tracing Back Log Data to its Log Statement: From Research to PracticeMaurício Aniche
 
Pragmatic software testing education - SIGCSE 2019
Pragmatic software testing education - SIGCSE 2019Pragmatic software testing education - SIGCSE 2019
Pragmatic software testing education - SIGCSE 2019Maurício Aniche
 
Software Testing with Caipirinhas and Stroopwafels
Software Testing with Caipirinhas and StroopwafelsSoftware Testing with Caipirinhas and Stroopwafels
Software Testing with Caipirinhas and StroopwafelsMaurício Aniche
 
Code smells in MVC applications (Dutch Spring meetup)
Code smells in MVC applications (Dutch Spring meetup)Code smells in MVC applications (Dutch Spring meetup)
Code smells in MVC applications (Dutch Spring meetup)Maurício Aniche
 
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017A Collaborative Approach to Teach Software Architecture - SIGCSE 2017
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017Maurício Aniche
 
Code quality in MVC systems - BENEVOL 2016
Code quality in MVC systems - BENEVOL 2016Code quality in MVC systems - BENEVOL 2016
Code quality in MVC systems - BENEVOL 2016Maurício Aniche
 
A Validated Set of Smells for MVC Architectures - ICSME 2016
A Validated Set of Smells for MVC Architectures - ICSME 2016A Validated Set of Smells for MVC Architectures - ICSME 2016
A Validated Set of Smells for MVC Architectures - ICSME 2016Maurício Aniche
 
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...Maurício Aniche
 
DNAD 2015 - Métricas de código, pra que te quero?
DNAD 2015 - Métricas de código, pra que te quero?DNAD 2015 - Métricas de código, pra que te quero?
DNAD 2015 - Métricas de código, pra que te quero?Maurício Aniche
 
Como eu aprendi que testar software é importante?
Como eu aprendi que testar software é importante?Como eu aprendi que testar software é importante?
Como eu aprendi que testar software é importante?Maurício Aniche
 
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações Web
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações WebProposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações Web
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações WebMaurício Aniche
 
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...Maurício Aniche
 
Test-Driven Development serve pra mim?
Test-Driven Development serve pra mim?Test-Driven Development serve pra mim?
Test-Driven Development serve pra mim?Maurício Aniche
 
O que estamos temos feito com mineração de repositório de código no IME?
O que estamos temos feito com mineração de repositório de código no IME?O que estamos temos feito com mineração de repositório de código no IME?
O que estamos temos feito com mineração de repositório de código no IME?Maurício Aniche
 
MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013
MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013
MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013Maurício Aniche
 
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...Maurício Aniche
 
Minicurso sobre Evolução de Software no CBSoft 2011
Minicurso sobre Evolução de Software no CBSoft 2011Minicurso sobre Evolução de Software no CBSoft 2011
Minicurso sobre Evolução de Software no CBSoft 2011Maurício Aniche
 
MTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary Study
MTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary StudyMTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary Study
MTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary StudyMaurício Aniche
 

More from Maurício Aniche (20)

Can ML help software developers? (TEQnation 2022)
Can ML help software developers? (TEQnation 2022)Can ML help software developers? (TEQnation 2022)
Can ML help software developers? (TEQnation 2022)
 
Tracing Back Log Data to its Log Statement: From Research to Practice
Tracing Back Log Data to its Log Statement: From Research to PracticeTracing Back Log Data to its Log Statement: From Research to Practice
Tracing Back Log Data to its Log Statement: From Research to Practice
 
Pragmatic software testing education - SIGCSE 2019
Pragmatic software testing education - SIGCSE 2019Pragmatic software testing education - SIGCSE 2019
Pragmatic software testing education - SIGCSE 2019
 
Test Automation Day 2018
Test Automation Day 2018Test Automation Day 2018
Test Automation Day 2018
 
Software Testing with Caipirinhas and Stroopwafels
Software Testing with Caipirinhas and StroopwafelsSoftware Testing with Caipirinhas and Stroopwafels
Software Testing with Caipirinhas and Stroopwafels
 
Code smells in MVC applications (Dutch Spring meetup)
Code smells in MVC applications (Dutch Spring meetup)Code smells in MVC applications (Dutch Spring meetup)
Code smells in MVC applications (Dutch Spring meetup)
 
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017A Collaborative Approach to Teach Software Architecture - SIGCSE 2017
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017
 
Code quality in MVC systems - BENEVOL 2016
Code quality in MVC systems - BENEVOL 2016Code quality in MVC systems - BENEVOL 2016
Code quality in MVC systems - BENEVOL 2016
 
A Validated Set of Smells for MVC Architectures - ICSME 2016
A Validated Set of Smells for MVC Architectures - ICSME 2016A Validated Set of Smells for MVC Architectures - ICSME 2016
A Validated Set of Smells for MVC Architectures - ICSME 2016
 
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...
 
DNAD 2015 - Métricas de código, pra que te quero?
DNAD 2015 - Métricas de código, pra que te quero?DNAD 2015 - Métricas de código, pra que te quero?
DNAD 2015 - Métricas de código, pra que te quero?
 
Como eu aprendi que testar software é importante?
Como eu aprendi que testar software é importante?Como eu aprendi que testar software é importante?
Como eu aprendi que testar software é importante?
 
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações Web
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações WebProposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações Web
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações Web
 
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...
 
Test-Driven Development serve pra mim?
Test-Driven Development serve pra mim?Test-Driven Development serve pra mim?
Test-Driven Development serve pra mim?
 
O que estamos temos feito com mineração de repositório de código no IME?
O que estamos temos feito com mineração de repositório de código no IME?O que estamos temos feito com mineração de repositório de código no IME?
O que estamos temos feito com mineração de repositório de código no IME?
 
MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013
MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013
MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013
 
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...
 
Minicurso sobre Evolução de Software no CBSoft 2011
Minicurso sobre Evolução de Software no CBSoft 2011Minicurso sobre Evolução de Software no CBSoft 2011
Minicurso sobre Evolução de Software no CBSoft 2011
 
MTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary Study
MTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary StudyMTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary Study
MTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary Study
 

Recently uploaded

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

Desvios comuns em TDD

  • 1. ERROS COMUNS EM TEST-DRIVEN DEVELOPMENT Mauricio Aniche mauricio@aniche.com.br @mauricioaniche Thursday, June 24, 2010
  • 2. DESVIOS COMUNS EM TEST-DRIVEN DEVELOPMENT Mauricio Aniche mauricio@aniche.com.br @mauricioaniche Thursday, June 24, 2010
  • 3. MAS O QUE É TDD MESMO? Thursday, June 24, 2010
  • 10. É SOBRE DESIGN! Thursday, June 24, 2010
  • 11. QUE CONFUSÃO! :-( Thursday, June 24, 2010
  • 12. Test-driven development (TDD) is the craft of producing automated tests for production code, and using that process to drive design and programming. For every tiny bit of functionality in the production code, you first develop a test that specifies and validates what the code will do. You then produce exactly as much code as will enable that test to pass. Then you refactor (simplify and clarify) both the production code and the test code. www.agilealliance.org/programs/ roadmaps/Roadmap/tdd/tdd_index.htm Thursday, June 24, 2010
  • 15. MAS NÃO É FÁCIL! Thursday, June 24, 2010
  • 16. PROGRAMADORES ÀS VEZES COMETEM DESVIOS... Thursday, June 24, 2010
  • 19. NÃO VER O TESTE FALHAR Thursday, June 24, 2010
  • 20. 50 •55% nunca esquece ou esquece raramente de ver o 38 teste falhar; 25 •24% esquece regularmente 13 ou frequentemente; 0 Never Sometimes Frequently •4% sempre esquece; Rarely Regularly Always Thursday, June 24, 2010
  • 21. ESQUECER DE REFATORAR Thursday, June 24, 2010
  • 22. 40 •44% dos programadores 30 experientes e 52% dos iniciantes cometem esse 20 erro regularmente ou frequentemente; 10 0 •1% sempre esquece. Never Sometimes Frequently Rarely Regularly Always Thursday, June 24, 2010
  • 23. REFATORAR OUTRO TRECHO DE CÓDIGO ENQUANTO TRABALHA EM UM TESTE Thursday, June 24, 2010
  • 24. 40 •40% refatora outro trecho de código regularmente ou frequentemente; 30 •5% refatora o tempo todo; 20 •6% nunca refatora; •38% dos experientes 10 fazem isso regularmente ou frequentemente. No 0 entendo, 44% nunca faz ou Never Sometimes Frequently Rarely Regularly Always faz apenas raramente. Thursday, June 24, 2010
  • 25. NÃO COMEÇAR PELO TESTE MAIS SIMPLES POSSÍVEL Thursday, June 24, 2010
  • 26. 50 •33% não começam pelo teste mais simples possível 38 regularmente ou frequentemente; 25 •2% sempre cometem o 13 erro; 0 Never Sometimes Frequently •10% nunca cometem. Rarely Regularly Always Thursday, June 24, 2010
  • 27. RODAR APENAS O TESTE CORRENTE Thursday, June 24, 2010
  • 28. 40 •16% rodam apenas o teste corrente regularmente ou frequentemente; 30 •2% cometem o erro o tempo todo; 20 •25% nunca esquecem de rodar a suíte inteira; 10 •Programadores experientes cometem esse erro mais 0 Never Sometimes Frequently frequentemente do que os Rarely Regularly Always iniciantes (21% contra 15%). Thursday, June 24, 2010
  • 29. ESCREVER TESTES COMPLEXOS Thursday, June 24, 2010
  • 30. 40 •50% escrevem cenários complexos regularmente ou 30 frequentemente; •4% escreve o tempo todo; 20 •3% nunca escreve; 10 •35% dos programadores experientes e 53% dos iniciantes fazem isso regularmente ou 0 Never Sometimes Frequently frequentemente; Rarely Regularly Always Thursday, June 24, 2010
  • 31. NÃO IMPLEMENTAR O CÓDIGO MAIS SIMPLES QUE FAÇA O TESTE PASSAR Thursday, June 24, 2010
  • 32. 50 •35% dos iniciantes e 38 17% dos experientes tendem a não 25 implementar o código mais simples que faça o teste passar regularmente 13 ou frequentemente; 0 Never Sometimes Frequently Rarely Regularly Always Thursday, June 24, 2010
  • 33. NOMES NÃO CLAROS PARA OS TESTES Thursday, June 24, 2010
  • 34. 40 •32% usam nomes não 30 claros regularmente ou frequentemente; 20 •1% usam nomes não claros o tempo todo; 10 •14% nunca usam e 45% 0 nunca usa ou usa raramente. Never Sometimes Frequently Rarely Regularly Always 30 Thursday, June 24, 2010
  • 35. NÃO REFATORAR CÓDIGO DE TESTE Thursday, June 24, 2010
  • 36. 50 •23% não refatora o código 38 de teste regularmente ou frequentemente; 25 •1% sempre esquece de 13 refatorar; 0 •16% nunca comete o erro; Never Sometimes Frequently Rarely Regularly Always 32 Thursday, June 24, 2010
  • 37. DESVIOS MAIS COMUNS Desvio Média/Desvio Padrão Correlação de Pearson Frequente ou sempre Escrever testes complexos 2.58 / 1.21 -0.1 26.61% Esquecer de refatorar 2.37 / 1.17 -0.03 19.72% Refatorar outro trecho de 2.34 / 1.36 -0.13 23.85% código Não comecar pelo teste mais 2.00 / 1.28 -0.09 15.14% simples possível Não implementar o código mais 1.90 / 1.19 -0.24 11.01% simples que faz o teste passar Nomes de testes não claros 1.84 / 1.25 -0.02 11.01% Não ver o teste falhar 1.75 / 1.35 -0.22 14.22% Não refatorar o código de teste 1.67 / 1.19 -0.21 8.72% Rodar apenas o teste corrente 1.40 / 1.20 -0.01 5.96% 33 Thursday, June 24, 2010
  • 38. PRECISO SEGUIR A RISCA O TEMPO TODO? 34 Thursday, June 24, 2010
  • 39. O QUE ELES PENSAM SOBRE TDD? 35 Thursday, June 24, 2010
  • 40. PROBLEMAS A VALIDAR 36 Thursday, June 24, 2010
  • 41. CONCLUSÃO 37 Thursday, June 24, 2010
  • 42. TRABALHOS FUTUROS 38 Thursday, June 24, 2010
  • 43. AONDE POSSO LER MAIS SOBRE ISSO? •O artigo foi publicado no 1st International Workshop on Test- Driven Development e pode ser encontrado na biblioteca da IEEE Digital. •Ou através da página dedicada ao trabalho em http://www.ime.usp.br/~aniche/tdd-survey 39 Thursday, June 24, 2010
  • 44. GOSTOU E QUER AJUDAR? 40 Thursday, June 24, 2010
  • 45. @mauricioaniche mauricio@aniche.com.br 41 Thursday, June 24, 2010