SlideShare una empresa de Scribd logo
1 de 29
IME-USP

The relationship
between test
code and
production code
Mauricio Aniche
University of São Paulo (USP)
aniche@ime.usp.br
Who Am I?
   PhD Student at University of São Paulo
       Master thesis defended on April.2012
   Software Developer
       Consultancy for companies such as
        VeriFone, Sony.
       Nowadays: Caelum
   Open Source
   Restfulie.NET
 1st Test-Driven Development book in Brazilian
    portuguese (in my non biased opinion, the
    best TDD book ever!)
Unit Tests and Code Quality
 Great  synergy between a testable class
  and a well-designed class (Feathers, 2007)
 The write of unit tests can become
  complex as the interactions between
  software components grow out of control
  (McGregor, 2001)
 Agile practitioners state that unit tests are
  a way to validate and improve class
  design (Beck et al, 2001)
What am I Going to Say?
A  little bit about my master thesis.
 The first very step of my PhD.
 The tool I am working on.
1st part: TDD and Class Design
 Does  the practice of TDD influence on the
  quality of class design?
 Mixed study with ~20 experienced
  developers from industry
     33% has 6 to 10 years of experience
     6 different companies in 3 different cities
 Developers  were asked to implement a
 set of problems, using and not using TDD.
     Exercises dealt with coupling, cohesion,
      encapsulation problems.
Quantitative Analysis
 264   production classes
    831 methods / 2520 lines of code
 73   test classes
    225 methods / 1832 lines of code
 Wilcoxonto compare the difference in
 both groups.
Show me the p-value!
Quantitative Analysis
 Filtering   by their experience in TDD
     No statistical significance.
 Specialists’   opinion
     Two different specialists reviewed all
      generated code, without knowing if that
      code was produced with or without TDD.
     They evaluated in terms of “class
      design”, “testability”, “simplicity”, using a
      Likert scale from 1 to 5.
     No difference in their evaluation.
Qualitative Analysis
 Interviews with ~10 developers.
 All of them said that “TDD does not guide
  you to a better class design by itself; the
  experience in OO and class design makes
  such a difference”.
 Some patterns emerged.
Patterns of Feedback
In my PhD
 My idea is to check whether the presence
 of those patterns in a unit test really
 implies in a bad production code.
    MSR techniques.
    Open source repositories for exploratory
     purposes and industry repositories for the
     final study.
2nd part: Unit Tests and Asserts
 Every    unit test contains three parts
     Set up the scenario
     Invoke the behavior under test
     Validates the expected output
 Assert   instructions
     assertEquals (expected, calculated);
     assertTrue(), assertFalse(), and so on
 No   limits for the number of asserts per test
A little piece of code
class InvoiceTest {
  @Test
  public void shouldCalculateTaxes() {
    // (i) setting up the scenario
    Invoice inv = new Invoice(5000.0);

        // (ii) invoking the behavior
        double tax = inv.calculateTaxes();

        // (iii) validating the output
        assertEquals (5000 ∗ 0.06 , tax );
    }
}
Why would…
…     a test contain more than one assert?
 Is it a smell of bad code/design?
Research Design
 We    selected 22 projects
     19 from ASF
     3 from a Brazilian consultancy
 Data   extraction from all projects
     Code metrics
 Statistical
            Test
 Qualitative Analysis
Data Extraction
 Test   code
     Number of asserts per test
     Production method being tested
 Production    code
     Cyclomatic Complexity (McCabe, 1976)
     Number of method invocations (Li and
      Henry, 1993)
     Lines of Code
Heuristic to Extract the
        Production Method
class InvoiceTest {                          class Invoice {
  @Test                                        public double calculateTaxes()
                                               {
  public void shouldCalculateTaxes() {
                                                 // something…
    // (i) setting up the scenario
                                               }
    Invoice inv = new Invoice(5000.0);
                                             }

        // (ii) invoking the behavior
        double tax = inv.calculateTaxes();

        // (iii) validating the output
        assertEquals (5000 ∗ 0.06 , tax );
    }
}
Asserts
Distribution
in Selected
Projects
Results of
the Test
Why more than 1 assert?
 130tests randomly selected
 Qualitative analysis:
    More than one assert for the same object
     (40.4%)
    Different inputs to the same method (38.9%)
    List/Array (9.9%)
    Others (6.8%)
    Extra assert to check if object is not null (3.8%)
“Asserted Objects”
 We   coined the term “asserted objects”
    It counts not the number of asserts in a unit
     test, but the number of different instances
     of objects that are being asserted

     assertEquals(10, obj.getA());
     assertEquals(20, obj.getB());
        Counts as 1 “asserted object”
Distribution of
Asserted
Objects
Results of
the Test
Findings
   Counting the number of asserts in a unit test
    does not give valuable feedback about
    code quality
       But counting the number of asserted objects
        may provide useful information
       However, the difference between both groups
        was not “big”
   A possible explanation:
       Methods that contain higher CC, lines of
        code, and method invocations contains many
        different paths, and developers prefer to write
        all of it in a single unit test, rather than splitting in
        many of them
My current problem
 How to statistically identify if a test code is
 a “unit test” or a “integration/system
 test”?
3rd Step: Metric Miner
 Started
        as a command-line tool to
 calculate code metrics in Git repositories.
    As you can guess, I needed that for my
     masters.
A undergraduate student ported my tool
 to a web-based system.
    Much more interesting!
What does it do?
 Tool  that facilitates studies in MSR.
 Already contains the entire Apache
  repository cloned.
 Researcher can write a new metric and
  just plug to the system.
 Later on, he can execute an SQL query
  and extract data.
 He can also execute an statistical test
  with two sets of existent data.
Pros and Cons
 You do not need to spend your computer
  resources.
     The power of cloud computing (thanks,
      Locaweb!)
 Still   slow.
     We need to parallelize the metric
      execution.
     Go for Google’s Big Query (~300GB of
      data).
Contact Information
 Mauricio Aniche
  aniche@ime.usp.br / @mauricioaniche
 TDD no Mundo Real
  http://www.tddnomundoreal.com.br

   Software Engineering & Collaborative
     Systems Research Lab (LAPESSC)
         http://lapessc.ime.usp.br/

Más contenido relacionado

La actualidad más candente

Test design techniques
Test design techniquesTest design techniques
Test design techniquesPragya Rastogi
 
Software Quality Testing
Software Quality TestingSoftware Quality Testing
Software Quality TestingKiran Kumar
 
Test design techniques
Test design techniquesTest design techniques
Test design techniquesOksana
 
Black box testing (an introduction to)
Black box testing (an introduction to)Black box testing (an introduction to)
Black box testing (an introduction to)Henry Muccini
 
Input Space Partitioning
Input Space PartitioningInput Space Partitioning
Input Space PartitioningRiyad Parvez
 
Testing Fundamentals
Testing FundamentalsTesting Fundamentals
Testing FundamentalsKiran Kumar
 
White Box Testing
White Box TestingWhite Box Testing
White Box TestingAlisha Roy
 
Whitebox testing
Whitebox testingWhitebox testing
Whitebox testingOana Feidi
 
Test design techniques
Test design techniquesTest design techniques
Test design techniquesBipul Roy Bpl
 
Mining Assumptions for Software Components using Machine Learning
Mining Assumptions for Software Components using Machine LearningMining Assumptions for Software Components using Machine Learning
Mining Assumptions for Software Components using Machine LearningLionel Briand
 
Java Unit Testing Tool Competition — Fifth Round
Java Unit Testing Tool Competition — Fifth RoundJava Unit Testing Tool Competition — Fifth Round
Java Unit Testing Tool Competition — Fifth RoundAnnibale Panichella
 
Design Test Case Technique (Equivalence partitioning And Boundary value analy...
Design Test Case Technique (Equivalence partitioning And Boundary value analy...Design Test Case Technique (Equivalence partitioning And Boundary value analy...
Design Test Case Technique (Equivalence partitioning And Boundary value analy...Ryan Tran
 
Fundamental Test Design Techniques
Fundamental Test Design TechniquesFundamental Test Design Techniques
Fundamental Test Design TechniquesTechWell
 

La actualidad más candente (20)

Whitebox
WhiteboxWhitebox
Whitebox
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
 
Software Quality Testing
Software Quality TestingSoftware Quality Testing
Software Quality Testing
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
 
10 software testing_technique
10 software testing_technique10 software testing_technique
10 software testing_technique
 
Black & White Box testing
Black & White Box testingBlack & White Box testing
Black & White Box testing
 
White Box Testing V0.2
White Box Testing V0.2White Box Testing V0.2
White Box Testing V0.2
 
Black box testing (an introduction to)
Black box testing (an introduction to)Black box testing (an introduction to)
Black box testing (an introduction to)
 
Input Space Partitioning
Input Space PartitioningInput Space Partitioning
Input Space Partitioning
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
 
Testing Fundamentals
Testing FundamentalsTesting Fundamentals
Testing Fundamentals
 
White Box Testing
White Box TestingWhite Box Testing
White Box Testing
 
Whitebox testing
Whitebox testingWhitebox testing
Whitebox testing
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
 
Sta unit 3(abimanyu)
Sta unit 3(abimanyu)Sta unit 3(abimanyu)
Sta unit 3(abimanyu)
 
Mining Assumptions for Software Components using Machine Learning
Mining Assumptions for Software Components using Machine LearningMining Assumptions for Software Components using Machine Learning
Mining Assumptions for Software Components using Machine Learning
 
Java Unit Testing Tool Competition — Fifth Round
Java Unit Testing Tool Competition — Fifth RoundJava Unit Testing Tool Competition — Fifth Round
Java Unit Testing Tool Competition — Fifth Round
 
Design Test Case Technique (Equivalence partitioning And Boundary value analy...
Design Test Case Technique (Equivalence partitioning And Boundary value analy...Design Test Case Technique (Equivalence partitioning And Boundary value analy...
Design Test Case Technique (Equivalence partitioning And Boundary value analy...
 
Fundamental Test Design Techniques
Fundamental Test Design TechniquesFundamental Test Design Techniques
Fundamental Test Design Techniques
 

Destacado

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
 
«Коломенская пастила», Коломна
«Коломенская пастила», Коломна«Коломенская пастила», Коломна
«Коломенская пастила», КоломнаMichael Kozloff
 
Облачные решения ActiveCloud и примеры внедрений
Облачные решения ActiveCloud и примеры внедренийОблачные решения ActiveCloud и примеры внедрений
Облачные решения ActiveCloud и примеры внедренийMichael Kozloff
 
Методы расчета отдачи на инвестиции (ROI) в технологии информационной безопас...
Методы расчета отдачи на инвестиции (ROI) в технологии информационной безопас...Методы расчета отдачи на инвестиции (ROI) в технологии информационной безопас...
Методы расчета отдачи на инвестиции (ROI) в технологии информационной безопас...Michael Kozloff
 
19. Decision Making
19. Decision Making19. Decision Making
19. Decision MakingNBHS
 
Nervous System & Synapses
Nervous System & SynapsesNervous System & Synapses
Nervous System & SynapsesToby Newton
 
Rome Through The Ages
Rome Through The AgesRome Through The Ages
Rome Through The Agesguest375084
 
Умные машины для банков
Умные машины для банковУмные машины для банков
Умные машины для банковMichael Kozloff
 
Forever Flowing:The Azure Legacy 2.5b
Forever Flowing:The Azure Legacy 2.5bForever Flowing:The Azure Legacy 2.5b
Forever Flowing:The Azure Legacy 2.5bGeminiasp
 
Pacifier Use As A Risk Factor For Reduction In Breastfeeding Duration A Syste...
Pacifier Use As A Risk Factor For Reduction In Breastfeeding Duration A Syste...Pacifier Use As A Risk Factor For Reduction In Breastfeeding Duration A Syste...
Pacifier Use As A Risk Factor For Reduction In Breastfeeding Duration A Syste...Biblioteca Virtual
 
Breastfeeding Friendly Physician’S Office Optimizing Care For Infants And C...
Breastfeeding Friendly Physician’S Office   Optimizing Care For Infants And C...Breastfeeding Friendly Physician’S Office   Optimizing Care For Infants And C...
Breastfeeding Friendly Physician’S Office Optimizing Care For Infants And C...Biblioteca Virtual
 
RAF Tabtronics LLC Overview 2013
RAF Tabtronics LLC Overview 2013RAF Tabtronics LLC Overview 2013
RAF Tabtronics LLC Overview 2013RAF Tabtronics LLC
 
Pooled Analysis Of Antidepressant Levels In Lactating Mothers, Breast Milk, A...
Pooled Analysis Of Antidepressant Levels In Lactating Mothers, Breast Milk, A...Pooled Analysis Of Antidepressant Levels In Lactating Mothers, Breast Milk, A...
Pooled Analysis Of Antidepressant Levels In Lactating Mothers, Breast Milk, A...Biblioteca Virtual
 
Breastfeeding Rates In The United States By Characteristics Of The Child,
Breastfeeding Rates In The United States By Characteristics Of The Child,Breastfeeding Rates In The United States By Characteristics Of The Child,
Breastfeeding Rates In The United States By Characteristics Of The Child,Biblioteca Virtual
 
Innovation webinar - Three ways erp will change - dan matthews
Innovation webinar - Three ways erp will change - dan matthewsInnovation webinar - Three ways erp will change - dan matthews
Innovation webinar - Three ways erp will change - dan matthewsIFS
 
A Tour Around Argentina
A Tour Around ArgentinaA Tour Around Argentina
A Tour Around Argentinarominacheme
 
Forever flowing 2.4
Forever flowing 2.4Forever flowing 2.4
Forever flowing 2.4Geminiasp
 
Drupal Overview
Drupal OverviewDrupal Overview
Drupal OverviewKurt Madel
 

Destacado (20)

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
 
«Коломенская пастила», Коломна
«Коломенская пастила», Коломна«Коломенская пастила», Коломна
«Коломенская пастила», Коломна
 
Облачные решения ActiveCloud и примеры внедрений
Облачные решения ActiveCloud и примеры внедренийОблачные решения ActiveCloud и примеры внедрений
Облачные решения ActiveCloud и примеры внедрений
 
Student Response Systems
Student Response SystemsStudent Response Systems
Student Response Systems
 
Методы расчета отдачи на инвестиции (ROI) в технологии информационной безопас...
Методы расчета отдачи на инвестиции (ROI) в технологии информационной безопас...Методы расчета отдачи на инвестиции (ROI) в технологии информационной безопас...
Методы расчета отдачи на инвестиции (ROI) в технологии информационной безопас...
 
6 My Home Modelo De InstalaçãO
6  My Home Modelo De InstalaçãO6  My Home Modelo De InstalaçãO
6 My Home Modelo De InstalaçãO
 
19. Decision Making
19. Decision Making19. Decision Making
19. Decision Making
 
Nervous System & Synapses
Nervous System & SynapsesNervous System & Synapses
Nervous System & Synapses
 
Rome Through The Ages
Rome Through The AgesRome Through The Ages
Rome Through The Ages
 
Умные машины для банков
Умные машины для банковУмные машины для банков
Умные машины для банков
 
Forever Flowing:The Azure Legacy 2.5b
Forever Flowing:The Azure Legacy 2.5bForever Flowing:The Azure Legacy 2.5b
Forever Flowing:The Azure Legacy 2.5b
 
Pacifier Use As A Risk Factor For Reduction In Breastfeeding Duration A Syste...
Pacifier Use As A Risk Factor For Reduction In Breastfeeding Duration A Syste...Pacifier Use As A Risk Factor For Reduction In Breastfeeding Duration A Syste...
Pacifier Use As A Risk Factor For Reduction In Breastfeeding Duration A Syste...
 
Breastfeeding Friendly Physician’S Office Optimizing Care For Infants And C...
Breastfeeding Friendly Physician’S Office   Optimizing Care For Infants And C...Breastfeeding Friendly Physician’S Office   Optimizing Care For Infants And C...
Breastfeeding Friendly Physician’S Office Optimizing Care For Infants And C...
 
RAF Tabtronics LLC Overview 2013
RAF Tabtronics LLC Overview 2013RAF Tabtronics LLC Overview 2013
RAF Tabtronics LLC Overview 2013
 
Pooled Analysis Of Antidepressant Levels In Lactating Mothers, Breast Milk, A...
Pooled Analysis Of Antidepressant Levels In Lactating Mothers, Breast Milk, A...Pooled Analysis Of Antidepressant Levels In Lactating Mothers, Breast Milk, A...
Pooled Analysis Of Antidepressant Levels In Lactating Mothers, Breast Milk, A...
 
Breastfeeding Rates In The United States By Characteristics Of The Child,
Breastfeeding Rates In The United States By Characteristics Of The Child,Breastfeeding Rates In The United States By Characteristics Of The Child,
Breastfeeding Rates In The United States By Characteristics Of The Child,
 
Innovation webinar - Three ways erp will change - dan matthews
Innovation webinar - Three ways erp will change - dan matthewsInnovation webinar - Three ways erp will change - dan matthews
Innovation webinar - Three ways erp will change - dan matthews
 
A Tour Around Argentina
A Tour Around ArgentinaA Tour Around Argentina
A Tour Around Argentina
 
Forever flowing 2.4
Forever flowing 2.4Forever flowing 2.4
Forever flowing 2.4
 
Drupal Overview
Drupal OverviewDrupal Overview
Drupal Overview
 

Similar a The relationship between test and production code quality (@ SIG)

Testing survey by_directions
Testing survey by_directionsTesting survey by_directions
Testing survey by_directionsTao He
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Qualityguest268ee8
 
SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 20_ Test-Driven Development (TDD)SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 20_ Test-Driven Development (TDD)Amr E. Mohamed
 
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...acijjournal
 
Software testing: an introduction - 2017
Software testing: an introduction - 2017Software testing: an introduction - 2017
Software testing: an introduction - 2017XavierDevroey
 
30 February 2005 QUEUE rants [email protected] DARNEDTestin.docx
30  February 2005  QUEUE rants [email protected] DARNEDTestin.docx30  February 2005  QUEUE rants [email protected] DARNEDTestin.docx
30 February 2005 QUEUE rants [email protected] DARNEDTestin.docxtamicawaysmith
 
5.Black Box Testing and Levels of Testing.ppt
5.Black Box Testing and Levels of Testing.ppt5.Black Box Testing and Levels of Testing.ppt
5.Black Box Testing and Levels of Testing.pptSyedAhmad732853
 
Combinatorial testing
Combinatorial testingCombinatorial testing
Combinatorial testingKedar Kumar
 
Types of Software Testing
Types of Software TestingTypes of Software Testing
Types of Software TestingNishant Worah
 
Annotated Bibliography .Guidelines Annotated Bibliograph.docx
Annotated Bibliography  .Guidelines Annotated Bibliograph.docxAnnotated Bibliography  .Guidelines Annotated Bibliograph.docx
Annotated Bibliography .Guidelines Annotated Bibliograph.docxjustine1simpson78276
 
Ivan Pashko - Simplifying test automation with design patterns
Ivan Pashko - Simplifying test automation with design patternsIvan Pashko - Simplifying test automation with design patterns
Ivan Pashko - Simplifying test automation with design patternsIevgenii Katsan
 
Mining Code Examples with Descriptive Text from Software Artifacts
Mining Code Examples with Descriptive Text from Software ArtifactsMining Code Examples with Descriptive Text from Software Artifacts
Mining Code Examples with Descriptive Text from Software ArtifactsPreetha Chatterjee
 

Similar a The relationship between test and production code quality (@ SIG) (20)

SWE-6 TESTING.pptx
SWE-6 TESTING.pptxSWE-6 TESTING.pptx
SWE-6 TESTING.pptx
 
Testing survey by_directions
Testing survey by_directionsTesting survey by_directions
Testing survey by_directions
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Quality
 
SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 20_ Test-Driven Development (TDD)SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 20_ Test-Driven Development (TDD)
 
Unit tests and TDD
Unit tests and TDDUnit tests and TDD
Unit tests and TDD
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
 
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
 
Software testing: an introduction - 2017
Software testing: an introduction - 2017Software testing: an introduction - 2017
Software testing: an introduction - 2017
 
30 February 2005 QUEUE rants [email protected] DARNEDTestin.docx
30  February 2005  QUEUE rants [email protected] DARNEDTestin.docx30  February 2005  QUEUE rants [email protected] DARNEDTestin.docx
30 February 2005 QUEUE rants [email protected] DARNEDTestin.docx
 
Unit test
Unit testUnit test
Unit test
 
Pragmatic Code Coverage
Pragmatic Code CoveragePragmatic Code Coverage
Pragmatic Code Coverage
 
5.Black Box Testing and Levels of Testing.ppt
5.Black Box Testing and Levels of Testing.ppt5.Black Box Testing and Levels of Testing.ppt
5.Black Box Testing and Levels of Testing.ppt
 
Testing
TestingTesting
Testing
 
Combinatorial testing
Combinatorial testingCombinatorial testing
Combinatorial testing
 
Types of Software Testing
Types of Software TestingTypes of Software Testing
Types of Software Testing
 
Workshop unit test
Workshop   unit testWorkshop   unit test
Workshop unit test
 
Annotated Bibliography .Guidelines Annotated Bibliograph.docx
Annotated Bibliography  .Guidelines Annotated Bibliograph.docxAnnotated Bibliography  .Guidelines Annotated Bibliograph.docx
Annotated Bibliography .Guidelines Annotated Bibliograph.docx
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Ivan Pashko - Simplifying test automation with design patterns
Ivan Pashko - Simplifying test automation with design patternsIvan Pashko - Simplifying test automation with design patterns
Ivan Pashko - Simplifying test automation with design patterns
 
Mining Code Examples with Descriptive Text from Software Artifacts
Mining Code Examples with Descriptive Text from Software ArtifactsMining Code Examples with Descriptive Text from Software Artifacts
Mining Code Examples with Descriptive Text from Software Artifacts
 

Más de 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
 
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
 
[TDC 2014] Métricas de código, pra que te quero?
[TDC 2014] Métricas de código, pra que te quero?[TDC 2014] Métricas de código, pra que te quero?
[TDC 2014] Métricas de código, pra que te quero?Maurício Aniche
 

Más de 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
 
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
 
[TDC 2014] Métricas de código, pra que te quero?
[TDC 2014] Métricas de código, pra que te quero?[TDC 2014] Métricas de código, pra que te quero?
[TDC 2014] Métricas de código, pra que te quero?
 

Último

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Último (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

The relationship between test and production code quality (@ SIG)

  • 1. IME-USP The relationship between test code and production code Mauricio Aniche University of São Paulo (USP) aniche@ime.usp.br
  • 2. Who Am I?  PhD Student at University of São Paulo  Master thesis defended on April.2012  Software Developer  Consultancy for companies such as VeriFone, Sony.  Nowadays: Caelum  Open Source  Restfulie.NET  1st Test-Driven Development book in Brazilian portuguese (in my non biased opinion, the best TDD book ever!)
  • 3. Unit Tests and Code Quality  Great synergy between a testable class and a well-designed class (Feathers, 2007)  The write of unit tests can become complex as the interactions between software components grow out of control (McGregor, 2001)  Agile practitioners state that unit tests are a way to validate and improve class design (Beck et al, 2001)
  • 4. What am I Going to Say? A little bit about my master thesis.  The first very step of my PhD.  The tool I am working on.
  • 5. 1st part: TDD and Class Design  Does the practice of TDD influence on the quality of class design?  Mixed study with ~20 experienced developers from industry  33% has 6 to 10 years of experience  6 different companies in 3 different cities  Developers were asked to implement a set of problems, using and not using TDD.  Exercises dealt with coupling, cohesion, encapsulation problems.
  • 6. Quantitative Analysis  264 production classes  831 methods / 2520 lines of code  73 test classes  225 methods / 1832 lines of code  Wilcoxonto compare the difference in both groups.
  • 7. Show me the p-value!
  • 8. Quantitative Analysis  Filtering by their experience in TDD  No statistical significance.  Specialists’ opinion  Two different specialists reviewed all generated code, without knowing if that code was produced with or without TDD.  They evaluated in terms of “class design”, “testability”, “simplicity”, using a Likert scale from 1 to 5.  No difference in their evaluation.
  • 9. Qualitative Analysis  Interviews with ~10 developers.  All of them said that “TDD does not guide you to a better class design by itself; the experience in OO and class design makes such a difference”.  Some patterns emerged.
  • 11. In my PhD  My idea is to check whether the presence of those patterns in a unit test really implies in a bad production code.  MSR techniques.  Open source repositories for exploratory purposes and industry repositories for the final study.
  • 12. 2nd part: Unit Tests and Asserts  Every unit test contains three parts  Set up the scenario  Invoke the behavior under test  Validates the expected output  Assert instructions  assertEquals (expected, calculated);  assertTrue(), assertFalse(), and so on  No limits for the number of asserts per test
  • 13. A little piece of code class InvoiceTest { @Test public void shouldCalculateTaxes() { // (i) setting up the scenario Invoice inv = new Invoice(5000.0); // (ii) invoking the behavior double tax = inv.calculateTaxes(); // (iii) validating the output assertEquals (5000 ∗ 0.06 , tax ); } }
  • 14. Why would… … a test contain more than one assert?  Is it a smell of bad code/design?
  • 15. Research Design  We selected 22 projects  19 from ASF  3 from a Brazilian consultancy  Data extraction from all projects  Code metrics  Statistical Test  Qualitative Analysis
  • 16. Data Extraction  Test code  Number of asserts per test  Production method being tested  Production code  Cyclomatic Complexity (McCabe, 1976)  Number of method invocations (Li and Henry, 1993)  Lines of Code
  • 17. Heuristic to Extract the Production Method class InvoiceTest { class Invoice { @Test public double calculateTaxes() { public void shouldCalculateTaxes() { // something… // (i) setting up the scenario } Invoice inv = new Invoice(5000.0); } // (ii) invoking the behavior double tax = inv.calculateTaxes(); // (iii) validating the output assertEquals (5000 ∗ 0.06 , tax ); } }
  • 20. Why more than 1 assert?  130tests randomly selected  Qualitative analysis:  More than one assert for the same object (40.4%)  Different inputs to the same method (38.9%)  List/Array (9.9%)  Others (6.8%)  Extra assert to check if object is not null (3.8%)
  • 21. “Asserted Objects”  We coined the term “asserted objects”  It counts not the number of asserts in a unit test, but the number of different instances of objects that are being asserted assertEquals(10, obj.getA()); assertEquals(20, obj.getB()); Counts as 1 “asserted object”
  • 24. Findings  Counting the number of asserts in a unit test does not give valuable feedback about code quality  But counting the number of asserted objects may provide useful information  However, the difference between both groups was not “big”  A possible explanation:  Methods that contain higher CC, lines of code, and method invocations contains many different paths, and developers prefer to write all of it in a single unit test, rather than splitting in many of them
  • 25. My current problem  How to statistically identify if a test code is a “unit test” or a “integration/system test”?
  • 26. 3rd Step: Metric Miner  Started as a command-line tool to calculate code metrics in Git repositories.  As you can guess, I needed that for my masters. A undergraduate student ported my tool to a web-based system.  Much more interesting!
  • 27. What does it do?  Tool that facilitates studies in MSR.  Already contains the entire Apache repository cloned.  Researcher can write a new metric and just plug to the system.  Later on, he can execute an SQL query and extract data.  He can also execute an statistical test with two sets of existent data.
  • 28. Pros and Cons  You do not need to spend your computer resources.  The power of cloud computing (thanks, Locaweb!)  Still slow.  We need to parallelize the metric execution.  Go for Google’s Big Query (~300GB of data).
  • 29. Contact Information  Mauricio Aniche aniche@ime.usp.br / @mauricioaniche  TDD no Mundo Real http://www.tddnomundoreal.com.br Software Engineering & Collaborative Systems Research Lab (LAPESSC) http://lapessc.ime.usp.br/