SlideShare a Scribd company logo
1 of 48
Download to read offline
On the Diffusion ofTest Smells in Automatically
GeneratedTest Code:An Empirical Study
Fabio Palomba*, Dario Di Nucci*,Annibale Panichella+,
Rocco Oliveto°,Andrea De Lucia*
* University of Salerno, Italy
+Delft University ofTechnology,The Netherlands
° University of Molise, Italy
SBST 2016
May, 16th 2016
Austin,TX, USA
Automatic Generation ofTest Code
method1()
method2()
…
methodN()
Production Class
test_method1()
test_method2()
…
test_methodN()
Test Suite
Automatic Generation ofTest Code
[Arcuri and Fraser - SSBSE’14]
Effectiveness of Whole Suite
Test Case Generation
[Panichella et al. - ICSE’16]
Impact ofTest Case Summaries
on Bug Fixing Performance
[Shamshiri et al. - ASE’15]
Effectiveness of Generated
Test Cases on Effectiveness
Automatic Generation ofTest Code
[Rojas et al. - ISSTA’15]
Usability of Automatic
GenerationTools in Practice
Automatic Generation ofTest Code
What about the characteristics of test code produced by such tools?
Test Smells inTest Code
[Van Deursen et al. - XP 2001]
“Test Smells represent a set of a
poor design solutions to write tests ”
11test smells related to the way
developers write test fixtures
and test cases
Test Smells inTest Code
public void test12 () throws Throwable {
JSTerm jSTerm0 = new JSTerm();

jSTerm0.makeVariable () ;
jSTerm0.add((Object) ””);
jSTerm0.matches(jSTerm0);

assertEquals (false, jSTerm0.isGround ());
assertEquals(true, jSTerm0.isVariable());
}
Test Smells inTest Code
public void test12 () throws Throwable {
JSTerm jSTerm0 = new JSTerm();

jSTerm0.makeVariable () ;
jSTerm0.add((Object) ””);
jSTerm0.matches(jSTerm0);

assertEquals (false, jSTerm0.isGround ());
assertEquals(true, jSTerm0.isVariable());
}
The test method checks the production method isGround()
Test Smells inTest Code
public void test12 () throws Throwable {
JSTerm jSTerm0 = new JSTerm();

jSTerm0.makeVariable () ;
jSTerm0.add((Object) ””);
jSTerm0.matches(jSTerm0);

assertEquals (false, jSTerm0.isGround ());
assertEquals(true, jSTerm0.isVariable());
}
But also the production method isVariable()
Test Smells inTest Code
public void test12 () throws Throwable {
JSTerm jSTerm0 = new JSTerm();

jSTerm0.makeVariable () ;
jSTerm0.add((Object) ””);
jSTerm0.matches(jSTerm0);

assertEquals (false, jSTerm0.isGround ());
assertEquals(true, jSTerm0.isVariable());
}
This is an EagerTest, namely a test which checks more than
one method of the class to be tested, making difficult
the comprehension of the actual test target.
Test Smells inTest Code
A test case is affected by a Resource Optimism when
it makes assumptions about the state or the existence
of external resources, providing a non-deterministic
result that depend on the state of the resources.
An Assertion Roulette comes from having a number of
assertions in a test method that have no explanation.
If an assertion fails, the identification of
the assert that failed can be difficult.
Who cares aboutTest Smells?
Test Cases can be re-generated!
Who cares aboutTest Smells?
Test Cases can be re-generated!
True
Who cares aboutTest Smells?
Test Cases can be re-generated!
True
BUT
Who cares aboutTest Smells?
Test Cases can be re-generated!
Developers modify and remove test code
Developers add tests when automatic tools leave
uncovered branches
Developers combine generated with manually written tests
[Rojas et al. - ISSTA’15]
Usability of Automatic GenerationTools in Practice
True
BUT
On the Diffusion ofTest Smells in Automatically
GeneratedTest Code:An Empirical Study
Empirical Study Design
Empirical Study Design
8test smell types
“RefactoringTest Code”
[Van Deursen et al. - XP 2001]
Empirical Study Design
110software projects
8test smell types
[Fraser and Arcuri -TOSEM 2014]
“A Large Scale Evaluation of Automated Unit
Test Generation using Evosuite”
“RefactoringTest Code”
[Van Deursen et al. - XP 2001]
Empirical Study Design
110software projects
8test smell types
[Fraser and Arcuri -TOSEM 2014]
“A Large Scale Evaluation of Automated Unit
Test Generation using Evosuite”
“RefactoringTest Code”
[Van Deursen et al. - XP 2001]
Empirical Study Design
16,603JUnit classes
[Fraser and Arcuri -TOSEM 2014]
“A Large Scale Evaluation of Automated Unit
Test Generation using Evosuite”
Data Extraction
test_method1()
test_method2()
…
test_methodN()
Test Suite
[Bavota et al. - EMSE 2015]
“AreTest Smells Harmful? An Empirical Study”
Test Smell Detector
Data Extraction
test_method1()
test_method2()
…
test_methodN()
Test Suite
[Bavota et al. - EMSE 2015]
“AreTest Smells Harmful? An Empirical Study”
Test Smell Detector
75%
precision
100%
recall
Sample size: 378 JUnit classes
Research Questions
RQ1:To What ExtentTest Smells are Spread in
Automatically GeneratedTest Classes?
?
RQ1:To What ExtentTest Smells are Spread in
Automatically GeneratedTest Classes?
RQ2:WhichTest Smells Occur More Frequently
in Automatically GeneratedTest Classes?
?
Research Questions
RQ1:To What ExtentTest Smells are Spread in
Automatically GeneratedTest Classes?
RQ2:WhichTest Smells Occur More Frequently
in Automatically GeneratedTest Classes?
RQ3:WhichTest Smells Co-OccurTogether?
?
Research Questions
RQ1:To What ExtentTest Smells are Spread in
Automatically GeneratedTest Classes?
RQ2:WhichTest Smells Occur More Frequently
in Automatically GeneratedTest Classes?
RQ3:WhichTest Smells Co-OccurTogether?
RQ4: IsThere a Relationship Between the Presence
ofTest Smells and the Project Characteristics?
?
Research Questions
On the Diffusion ofTest Smells in Automatically
GeneratedTest Code:An Empirical Study
Analysis of the Results
Results of the Study
RQ1:To What ExtentTest Smells are Spread in
Automatically GeneratedTest Classes?
!13,791smelly JUnit classes
Results of the Study
RQ1:To What ExtentTest Smells are Spread in
Automatically GeneratedTest Classes?
!83%of the JUnit classes analyzed
Results of the Study
RQ1:To What ExtentTest Smells are Spread in
Automatically GeneratedTest Classes?
!RQ1
Test Smells are highly diffused in the
automatically generated test suites
RQ2:WhichTest Smells Occur More Frequently
in Automatically GeneratedTest Classes?
Results of the Study
!Assertion Roulette 54%
RQ2:WhichTest Smells Occur More Frequently
in Automatically GeneratedTest Classes?
Results of the Study
!Assertion Roulette 54%
Test Code Duplication
33%
RQ2:WhichTest Smells Occur More Frequently
in Automatically GeneratedTest Classes?
Results of the Study
!Assertion Roulette 54%
Test Code Duplication
EagerTest
33%
29%
RQ2:WhichTest Smells Occur More Frequently
in Automatically GeneratedTest Classes?
Results of the Study
!public void test8 () throws Throwable {
Document document0 = new Document();

assertNotNull(document0);
document0.procText.add((Character) ”s”);
String string0 = document0.stringify();

assertEquals (“s”, document0.stringify()); 

assertNotNull(string0);

assertEquals(“s”, string0);
}
Assertion Roulette
RQ2:WhichTest Smells Occur More Frequently
in Automatically GeneratedTest Classes?
Results of the Study
!
Assertion Roulette
What is the behavior
under test?
Are the generated
assertions valid?
RQ2:WhichTest Smells Occur More Frequently
in Automatically GeneratedTest Classes?
Results of the Study
!
Assertion Roulette
[Panichella et al. - ICSE’16]
The Impact ofTest Case Summaries on Bug Fixing Performance
An Empirical Investigation
These problems have a huge impact on
developers’ ability to find faults
RQ2:WhichTest Smells Occur More Frequently
in Automatically GeneratedTest Classes?
Results of the Study
!public void test8 () throws Throwable {
GenericProperties generic0 = new GenericProperties();

boolean boolean0 = generic0.isValidClassname();
…
}
Test Code Duplication
public void test9 () throws Throwable {
GenericProperties generic0 = new GenericProperties();

boolean boolean0 = generic0.isValidClassname();
…
}
RQ2:WhichTest Smells Occur More Frequently
in Automatically GeneratedTest Classes?
Results of the Study
!
Test Code Duplication
This problem can be avoided by
generating test fixtures!
Results of the Study
!
RQ3:WhichTest Smells Co-OccurTogether?
Assertion Roulette Eager Test
Assertion Roulette Sensitive Equality
Resource Optimism Mystery Guest
Results of the Study
!
RQ3:WhichTest Smells Co-OccurTogether?
Assertion Roulette Eager Test
Assertion Roulette Sensitive Equality
Resource Optimism Mystery Guest
Automatic tools have as main goal that of maximize
coverage, without considering test code quality
RQ4: IsThere a Relationship Between the Presence
ofTest Smells and the Project Characteristics?
Results of the Study
!Yes! The higher the LOC to be tested, the higher the
probability to produce a smelly test case!
RQ4: IsThere a Relationship Between the Presence
ofTest Smells and the Project Characteristics?
Results of the Study
!Yes! The higher the LOC to be tested, the higher the
probability to produce a smelly test case!
The higher the LOC of the JUnit class, the higher the
probability to produce a smelly test case!
Summarizing
Lesson 1: Current implementations of search-based algorithms
for automatic test case generation do not consider code quality,
increasing the probability to introduce smells!
Summarizing
Lesson 1: Current implementations of search-based algorithms
for automatic test case generation do not consider code quality,
increasing the probability to introduce smells!
NB: Considering test code quality is important not only to
avoid the introduction of smells, but also because the
coverage can be increased!
[F. Palomba,A. Panichella,A. Zaidman, R. Oliveto,A. De Lucia - ISSTA’16]
AutomaticTest Case Generation:What IfTest Code Quality Matters?
Summarizing
Lesson 2:Automatic test case generation tools do not produce
text fixtures during their computation, and this implies the
introduction of several code clones in the resulting JUnit classes.
Future research should spend effort in the automatic
generation of test fixtures!
From now on…
?
Challenge 1: EvaluatingTest Smells inTest Cases
automatically generated by other tools
From now on…
?
Challenge 1: EvaluatingTest Smells inTest Cases
automatically generated by other tools
Challenge 2: Defining new algorithms able to solve
the design problems analyzed (e.g., test fixtures).
On the Diffusion ofTest Smells in Automatically
GeneratedTest Code:An Empirical Study
Fabio Palomba*, Dario Di Nucci*,Annibale Panichella+,
Rocco Oliveto°,Andrea De Lucia*
* University of Salerno, Italy
+Delft University ofTechnology,The Netherlands
° University of Molise, Italy
SBST 2016
May, 16th 2016
Austin,TX, USA

More Related Content

What's hot

Social Debt Analytics for Improving the Management of Software Evolution Tasks
Social Debt Analytics for Improving the Management of Software Evolution TasksSocial Debt Analytics for Improving the Management of Software Evolution Tasks
Social Debt Analytics for Improving the Management of Software Evolution TasksFabio Palomba
 
Revisiting Code Ownership and Its Relationship with Software Quality in the S...
Revisiting Code Ownership and Its Relationship with Software Quality in the S...Revisiting Code Ownership and Its Relationship with Software Quality in the S...
Revisiting Code Ownership and Its Relationship with Software Quality in the S...The University of Adelaide
 
Improving Code Review Effectiveness Through Reviewer Recommendations
Improving Code Review Effectiveness Through Reviewer RecommendationsImproving Code Review Effectiveness Through Reviewer Recommendations
Improving Code Review Effectiveness Through Reviewer RecommendationsThe University of Adelaide
 
Investigating Code Review Practices in Defective Files
Investigating Code Review Practices in Defective FilesInvestigating Code Review Practices in Defective Files
Investigating Code Review Practices in Defective FilesThe University of Adelaide
 
Ph.D. Thesis Defense: Studying Reviewer Selection and Involvement in Modern ...
Ph.D. Thesis Defense:  Studying Reviewer Selection and Involvement in Modern ...Ph.D. Thesis Defense:  Studying Reviewer Selection and Involvement in Modern ...
Ph.D. Thesis Defense: Studying Reviewer Selection and Involvement in Modern ...The University of Adelaide
 
A Method to Detect License Inconsistencies for Large-Scale Open Source Projects
A Method to Detect License Inconsistencies for Large-Scale Open Source ProjectsA Method to Detect License Inconsistencies for Large-Scale Open Source Projects
A Method to Detect License Inconsistencies for Large-Scale Open Source ProjectsYuhao Wu
 
2011 08 21 - LOINC Tutorial and Mapping Bootcamp - PHI 2011 Conference
2011 08 21 - LOINC Tutorial and Mapping Bootcamp - PHI 2011 Conference2011 08 21 - LOINC Tutorial and Mapping Bootcamp - PHI 2011 Conference
2011 08 21 - LOINC Tutorial and Mapping Bootcamp - PHI 2011 Conferencedvreeman
 
A Multidimensional Empirical Study on Refactoring Activity
A Multidimensional Empirical Study on Refactoring ActivityA Multidimensional Empirical Study on Refactoring Activity
A Multidimensional Empirical Study on Refactoring ActivityNikolaos Tsantalis
 
MAVIS: A Visualization Tool for Cohesion-based Bad Smell Inspection
MAVIS: A Visualization Tool for Cohesion-based Bad Smell InspectionMAVIS: A Visualization Tool for Cohesion-based Bad Smell Inspection
MAVIS: A Visualization Tool for Cohesion-based Bad Smell Inspection立偉 馬
 
Quantifying the Value of Static Analysis
Quantifying the Value of Static AnalysisQuantifying the Value of Static Analysis
Quantifying the Value of Static AnalysisTechWell
 

What's hot (12)

Social Debt Analytics for Improving the Management of Software Evolution Tasks
Social Debt Analytics for Improving the Management of Software Evolution TasksSocial Debt Analytics for Improving the Management of Software Evolution Tasks
Social Debt Analytics for Improving the Management of Software Evolution Tasks
 
Who Should Review My Code?
Who Should Review My Code?  Who Should Review My Code?
Who Should Review My Code?
 
Msr17a.ppt
Msr17a.pptMsr17a.ppt
Msr17a.ppt
 
Revisiting Code Ownership and Its Relationship with Software Quality in the S...
Revisiting Code Ownership and Its Relationship with Software Quality in the S...Revisiting Code Ownership and Its Relationship with Software Quality in the S...
Revisiting Code Ownership and Its Relationship with Software Quality in the S...
 
Improving Code Review Effectiveness Through Reviewer Recommendations
Improving Code Review Effectiveness Through Reviewer RecommendationsImproving Code Review Effectiveness Through Reviewer Recommendations
Improving Code Review Effectiveness Through Reviewer Recommendations
 
Investigating Code Review Practices in Defective Files
Investigating Code Review Practices in Defective FilesInvestigating Code Review Practices in Defective Files
Investigating Code Review Practices in Defective Files
 
Ph.D. Thesis Defense: Studying Reviewer Selection and Involvement in Modern ...
Ph.D. Thesis Defense:  Studying Reviewer Selection and Involvement in Modern ...Ph.D. Thesis Defense:  Studying Reviewer Selection and Involvement in Modern ...
Ph.D. Thesis Defense: Studying Reviewer Selection and Involvement in Modern ...
 
A Method to Detect License Inconsistencies for Large-Scale Open Source Projects
A Method to Detect License Inconsistencies for Large-Scale Open Source ProjectsA Method to Detect License Inconsistencies for Large-Scale Open Source Projects
A Method to Detect License Inconsistencies for Large-Scale Open Source Projects
 
2011 08 21 - LOINC Tutorial and Mapping Bootcamp - PHI 2011 Conference
2011 08 21 - LOINC Tutorial and Mapping Bootcamp - PHI 2011 Conference2011 08 21 - LOINC Tutorial and Mapping Bootcamp - PHI 2011 Conference
2011 08 21 - LOINC Tutorial and Mapping Bootcamp - PHI 2011 Conference
 
A Multidimensional Empirical Study on Refactoring Activity
A Multidimensional Empirical Study on Refactoring ActivityA Multidimensional Empirical Study on Refactoring Activity
A Multidimensional Empirical Study on Refactoring Activity
 
MAVIS: A Visualization Tool for Cohesion-based Bad Smell Inspection
MAVIS: A Visualization Tool for Cohesion-based Bad Smell InspectionMAVIS: A Visualization Tool for Cohesion-based Bad Smell Inspection
MAVIS: A Visualization Tool for Cohesion-based Bad Smell Inspection
 
Quantifying the Value of Static Analysis
Quantifying the Value of Static AnalysisQuantifying the Value of Static Analysis
Quantifying the Value of Static Analysis
 

Viewers also liked

EclipseCon: Test Confessions - What Eclipsers think and do about testing
EclipseCon: Test Confessions - What Eclipsers think and do about testingEclipseCon: Test Confessions - What Eclipsers think and do about testing
EclipseCon: Test Confessions - What Eclipsers think and do about testingMichaela Greiler
 
Scenario Testing
Scenario TestingScenario Testing
Scenario Testingrealbot
 
Anatomy of Test Driven Development
Anatomy of Test Driven DevelopmentAnatomy of Test Driven Development
Anatomy of Test Driven DevelopmentDhaval Shah
 
तुम बिन जाएँ कहाँ
तुम बिन जाएँ कहाँतुम बिन जाएँ कहाँ
तुम बिन जाएँ कहाँBalaji Sharma
 
205230 primavera installation walkthrough
205230 primavera installation walkthrough205230 primavera installation walkthrough
205230 primavera installation walkthroughp6academy
 
Hallgrímur pétursson
Hallgrímur péturssonHallgrímur pétursson
Hallgrímur péturssontinnamj2190
 
शायद इसी को
शायद इसी कोशायद इसी को
शायद इसी कोBalaji Sharma
 
Howison CAREER journey - NSF CISE CAREER Workshop 2016
Howison CAREER journey - NSF CISE CAREER Workshop 2016Howison CAREER journey - NSF CISE CAREER Workshop 2016
Howison CAREER journey - NSF CISE CAREER Workshop 2016James Howison
 
1310799 권세진
1310799 권세진1310799 권세진
1310799 권세진sejin kwon
 
Apresentação prof luíz senna
Apresentação prof luíz sennaApresentação prof luíz senna
Apresentação prof luíz sennaDyone Andrade
 
Extract Package Refactoring in ARIES
Extract Package Refactoring in ARIESExtract Package Refactoring in ARIES
Extract Package Refactoring in ARIESFabio Palomba
 
Unit testing best practices
Unit testing best practicesUnit testing best practices
Unit testing best practicesnickokiss
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPTsuhasreddy1
 
10 Challenges for Emerging Market Startup Ecosystems
10 Challenges for Emerging Market Startup Ecosystems10 Challenges for Emerging Market Startup Ecosystems
10 Challenges for Emerging Market Startup EcosystemsDave McClure
 
la formacion del sistema educativo mexicano
la formacion del sistema educativo mexicanola formacion del sistema educativo mexicano
la formacion del sistema educativo mexicanoAngel Garcia
 

Viewers also liked (17)

EclipseCon: Test Confessions - What Eclipsers think and do about testing
EclipseCon: Test Confessions - What Eclipsers think and do about testingEclipseCon: Test Confessions - What Eclipsers think and do about testing
EclipseCon: Test Confessions - What Eclipsers think and do about testing
 
Scenario Testing
Scenario TestingScenario Testing
Scenario Testing
 
Anatomy of Test Driven Development
Anatomy of Test Driven DevelopmentAnatomy of Test Driven Development
Anatomy of Test Driven Development
 
तुम बिन जाएँ कहाँ
तुम बिन जाएँ कहाँतुम बिन जाएँ कहाँ
तुम बिन जाएँ कहाँ
 
205230 primavera installation walkthrough
205230 primavera installation walkthrough205230 primavera installation walkthrough
205230 primavera installation walkthrough
 
Hallgrímur pétursson
Hallgrímur péturssonHallgrímur pétursson
Hallgrímur pétursson
 
Mahmoud Al Khouli_CV2015
Mahmoud Al Khouli_CV2015Mahmoud Al Khouli_CV2015
Mahmoud Al Khouli_CV2015
 
शायद इसी को
शायद इसी कोशायद इसी को
शायद इसी को
 
Howison CAREER journey - NSF CISE CAREER Workshop 2016
Howison CAREER journey - NSF CISE CAREER Workshop 2016Howison CAREER journey - NSF CISE CAREER Workshop 2016
Howison CAREER journey - NSF CISE CAREER Workshop 2016
 
1310799 권세진
1310799 권세진1310799 권세진
1310799 권세진
 
Apresentação prof luíz senna
Apresentação prof luíz sennaApresentação prof luíz senna
Apresentação prof luíz senna
 
Endocarditis infecciosa
Endocarditis infecciosaEndocarditis infecciosa
Endocarditis infecciosa
 
Extract Package Refactoring in ARIES
Extract Package Refactoring in ARIESExtract Package Refactoring in ARIES
Extract Package Refactoring in ARIES
 
Unit testing best practices
Unit testing best practicesUnit testing best practices
Unit testing best practices
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPT
 
10 Challenges for Emerging Market Startup Ecosystems
10 Challenges for Emerging Market Startup Ecosystems10 Challenges for Emerging Market Startup Ecosystems
10 Challenges for Emerging Market Startup Ecosystems
 
la formacion del sistema educativo mexicano
la formacion del sistema educativo mexicanola formacion del sistema educativo mexicano
la formacion del sistema educativo mexicano
 

Similar to On the Diffusion of Test Smells in Automatically Generated Test Code: An Empirical Study

Strategies to Avoid Test Fixture Smells durin Software Evolution
Strategies to Avoid Test Fixture Smells durin Software EvolutionStrategies to Avoid Test Fixture Smells durin Software Evolution
Strategies to Avoid Test Fixture Smells durin Software EvolutionMichaela Greiler
 
Revisiting Test Smells in Automatically Generated Tests: Limitations, Pitfall...
Revisiting Test Smells in Automatically Generated Tests: Limitations, Pitfall...Revisiting Test Smells in Automatically Generated Tests: Limitations, Pitfall...
Revisiting Test Smells in Automatically Generated Tests: Limitations, Pitfall...Sebastiano Panichella
 
Does Refactoring of Test Smells Induce Fixing Flaky Tests?
Does Refactoring of Test Smells Induce Fixing Flaky Tests?Does Refactoring of Test Smells Induce Fixing Flaky Tests?
Does Refactoring of Test Smells Induce Fixing Flaky Tests?Fabio Palomba
 
Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTscatherinewall
 
DSR Testing (Part 1)
DSR Testing (Part 1)DSR Testing (Part 1)
DSR Testing (Part 1)Steve Upton
 
Test design techniques
Test design techniquesTest design techniques
Test design techniquesOksana
 
Make good use of explortary testing
Make good use of explortary testingMake good use of explortary testing
Make good use of explortary testinggaoliang641
 
Pairwise Software Test Design - What exactly is pairwise coverage? What is 3-...
Pairwise Software Test Design - What exactly is pairwise coverage? What is 3-...Pairwise Software Test Design - What exactly is pairwise coverage? What is 3-...
Pairwise Software Test Design - What exactly is pairwise coverage? What is 3-...Justin Hunter
 
Software testing foundation
Software testing foundationSoftware testing foundation
Software testing foundationAnirudh503501
 
2-Way Coverage vs 3-Way Coverage
2-Way Coverage vs 3-Way Coverage2-Way Coverage vs 3-Way Coverage
2-Way Coverage vs 3-Way CoverageTyler Klose
 
ISTQB / ISEB Foundation Exam Practice -1
ISTQB / ISEB Foundation Exam Practice -1ISTQB / ISEB Foundation Exam Practice -1
ISTQB / ISEB Foundation Exam Practice -1Yogindernath Gupta
 
Unit and integration Testing
Unit and integration TestingUnit and integration Testing
Unit and integration TestingDavid Berliner
 
Orthogonal array approach a case study
Orthogonal array approach   a case studyOrthogonal array approach   a case study
Orthogonal array approach a case studyKarthikeyan Rajendran
 
Speeding-up Software Testing With Computational Intelligence
Speeding-up Software Testing With Computational IntelligenceSpeeding-up Software Testing With Computational Intelligence
Speeding-up Software Testing With Computational IntelligenceAnnibale Panichella
 
ISTQB, ISEB Lecture Notes
ISTQB, ISEB Lecture NotesISTQB, ISEB Lecture Notes
ISTQB, ISEB Lecture Notesonsoftwaretest
 
Qc trg 16 apr 2020
Qc trg 16 apr 2020Qc trg 16 apr 2020
Qc trg 16 apr 2020Aisha Saleem
 
Rapid Software Testing: Reporting
Rapid Software Testing: ReportingRapid Software Testing: Reporting
Rapid Software Testing: ReportingTechWell
 

Similar to On the Diffusion of Test Smells in Automatically Generated Test Code: An Empirical Study (20)

Strategies to Avoid Test Fixture Smells durin Software Evolution
Strategies to Avoid Test Fixture Smells durin Software EvolutionStrategies to Avoid Test Fixture Smells durin Software Evolution
Strategies to Avoid Test Fixture Smells durin Software Evolution
 
Revisiting Test Smells in Automatically Generated Tests: Limitations, Pitfall...
Revisiting Test Smells in Automatically Generated Tests: Limitations, Pitfall...Revisiting Test Smells in Automatically Generated Tests: Limitations, Pitfall...
Revisiting Test Smells in Automatically Generated Tests: Limitations, Pitfall...
 
Does Refactoring of Test Smells Induce Fixing Flaky Tests?
Does Refactoring of Test Smells Induce Fixing Flaky Tests?Does Refactoring of Test Smells Induce Fixing Flaky Tests?
Does Refactoring of Test Smells Induce Fixing Flaky Tests?
 
Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTs
 
DSR Testing (Part 1)
DSR Testing (Part 1)DSR Testing (Part 1)
DSR Testing (Part 1)
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
 
Make good use of explortary testing
Make good use of explortary testingMake good use of explortary testing
Make good use of explortary testing
 
Pairwise Software Test Design - What exactly is pairwise coverage? What is 3-...
Pairwise Software Test Design - What exactly is pairwise coverage? What is 3-...Pairwise Software Test Design - What exactly is pairwise coverage? What is 3-...
Pairwise Software Test Design - What exactly is pairwise coverage? What is 3-...
 
Software testing foundation
Software testing foundationSoftware testing foundation
Software testing foundation
 
Thinking in software testing
Thinking in software testingThinking in software testing
Thinking in software testing
 
2-Way Coverage vs 3-Way Coverage
2-Way Coverage vs 3-Way Coverage2-Way Coverage vs 3-Way Coverage
2-Way Coverage vs 3-Way Coverage
 
ISTQB / ISEB Foundation Exam Practice -1
ISTQB / ISEB Foundation Exam Practice -1ISTQB / ISEB Foundation Exam Practice -1
ISTQB / ISEB Foundation Exam Practice -1
 
Java Unit Testing
Java Unit TestingJava Unit Testing
Java Unit Testing
 
Unit and integration Testing
Unit and integration TestingUnit and integration Testing
Unit and integration Testing
 
Testing
TestingTesting
Testing
 
Orthogonal array approach a case study
Orthogonal array approach   a case studyOrthogonal array approach   a case study
Orthogonal array approach a case study
 
Speeding-up Software Testing With Computational Intelligence
Speeding-up Software Testing With Computational IntelligenceSpeeding-up Software Testing With Computational Intelligence
Speeding-up Software Testing With Computational Intelligence
 
ISTQB, ISEB Lecture Notes
ISTQB, ISEB Lecture NotesISTQB, ISEB Lecture Notes
ISTQB, ISEB Lecture Notes
 
Qc trg 16 apr 2020
Qc trg 16 apr 2020Qc trg 16 apr 2020
Qc trg 16 apr 2020
 
Rapid Software Testing: Reporting
Rapid Software Testing: ReportingRapid Software Testing: Reporting
Rapid Software Testing: Reporting
 

More from Fabio Palomba

Textual Analysis for Code Smell Detection
Textual Analysis for Code Smell DetectionTextual Analysis for Code Smell Detection
Textual Analysis for Code Smell DetectionFabio Palomba
 
ARIES: An Eclipse Plug-in To Support Extract Class Refactoring
ARIES: An Eclipse Plug-in To Support Extract Class RefactoringARIES: An Eclipse Plug-in To Support Extract Class Refactoring
ARIES: An Eclipse Plug-in To Support Extract Class RefactoringFabio Palomba
 
Next! - An Android application to support tourists activities
Next! - An Android application to support tourists activitiesNext! - An Android application to support tourists activities
Next! - An Android application to support tourists activitiesFabio Palomba
 
A false digital alibi on Mac OS X
A false digital alibi on Mac OS XA false digital alibi on Mac OS X
A false digital alibi on Mac OS XFabio Palomba
 
Un plug-in Eclipse per il supporto all'Extract Class Refactoring
Un plug-in Eclipse per il supporto all'Extract Class RefactoringUn plug-in Eclipse per il supporto all'Extract Class Refactoring
Un plug-in Eclipse per il supporto all'Extract Class RefactoringFabio Palomba
 

More from Fabio Palomba (6)

Textual Analysis for Code Smell Detection
Textual Analysis for Code Smell DetectionTextual Analysis for Code Smell Detection
Textual Analysis for Code Smell Detection
 
ARIES: An Eclipse Plug-in To Support Extract Class Refactoring
ARIES: An Eclipse Plug-in To Support Extract Class RefactoringARIES: An Eclipse Plug-in To Support Extract Class Refactoring
ARIES: An Eclipse Plug-in To Support Extract Class Refactoring
 
People management
People managementPeople management
People management
 
Next! - An Android application to support tourists activities
Next! - An Android application to support tourists activitiesNext! - An Android application to support tourists activities
Next! - An Android application to support tourists activities
 
A false digital alibi on Mac OS X
A false digital alibi on Mac OS XA false digital alibi on Mac OS X
A false digital alibi on Mac OS X
 
Un plug-in Eclipse per il supporto all'Extract Class Refactoring
Un plug-in Eclipse per il supporto all'Extract Class RefactoringUn plug-in Eclipse per il supporto all'Extract Class Refactoring
Un plug-in Eclipse per il supporto all'Extract Class Refactoring
 

Recently uploaded

Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 

Recently uploaded (20)

Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 

On the Diffusion of Test Smells in Automatically Generated Test Code: An Empirical Study

  • 1. On the Diffusion ofTest Smells in Automatically GeneratedTest Code:An Empirical Study Fabio Palomba*, Dario Di Nucci*,Annibale Panichella+, Rocco Oliveto°,Andrea De Lucia* * University of Salerno, Italy +Delft University ofTechnology,The Netherlands ° University of Molise, Italy SBST 2016 May, 16th 2016 Austin,TX, USA
  • 2. Automatic Generation ofTest Code method1() method2() … methodN() Production Class test_method1() test_method2() … test_methodN() Test Suite
  • 3. Automatic Generation ofTest Code [Arcuri and Fraser - SSBSE’14] Effectiveness of Whole Suite Test Case Generation [Panichella et al. - ICSE’16] Impact ofTest Case Summaries on Bug Fixing Performance [Shamshiri et al. - ASE’15] Effectiveness of Generated Test Cases on Effectiveness
  • 4. Automatic Generation ofTest Code [Rojas et al. - ISSTA’15] Usability of Automatic GenerationTools in Practice
  • 5. Automatic Generation ofTest Code What about the characteristics of test code produced by such tools?
  • 6. Test Smells inTest Code [Van Deursen et al. - XP 2001] “Test Smells represent a set of a poor design solutions to write tests ” 11test smells related to the way developers write test fixtures and test cases
  • 7. Test Smells inTest Code public void test12 () throws Throwable { JSTerm jSTerm0 = new JSTerm();
 jSTerm0.makeVariable () ; jSTerm0.add((Object) ””); jSTerm0.matches(jSTerm0);
 assertEquals (false, jSTerm0.isGround ()); assertEquals(true, jSTerm0.isVariable()); }
  • 8. Test Smells inTest Code public void test12 () throws Throwable { JSTerm jSTerm0 = new JSTerm();
 jSTerm0.makeVariable () ; jSTerm0.add((Object) ””); jSTerm0.matches(jSTerm0);
 assertEquals (false, jSTerm0.isGround ()); assertEquals(true, jSTerm0.isVariable()); } The test method checks the production method isGround()
  • 9. Test Smells inTest Code public void test12 () throws Throwable { JSTerm jSTerm0 = new JSTerm();
 jSTerm0.makeVariable () ; jSTerm0.add((Object) ””); jSTerm0.matches(jSTerm0);
 assertEquals (false, jSTerm0.isGround ()); assertEquals(true, jSTerm0.isVariable()); } But also the production method isVariable()
  • 10. Test Smells inTest Code public void test12 () throws Throwable { JSTerm jSTerm0 = new JSTerm();
 jSTerm0.makeVariable () ; jSTerm0.add((Object) ””); jSTerm0.matches(jSTerm0);
 assertEquals (false, jSTerm0.isGround ()); assertEquals(true, jSTerm0.isVariable()); } This is an EagerTest, namely a test which checks more than one method of the class to be tested, making difficult the comprehension of the actual test target.
  • 11. Test Smells inTest Code A test case is affected by a Resource Optimism when it makes assumptions about the state or the existence of external resources, providing a non-deterministic result that depend on the state of the resources. An Assertion Roulette comes from having a number of assertions in a test method that have no explanation. If an assertion fails, the identification of the assert that failed can be difficult.
  • 12. Who cares aboutTest Smells? Test Cases can be re-generated!
  • 13. Who cares aboutTest Smells? Test Cases can be re-generated! True
  • 14. Who cares aboutTest Smells? Test Cases can be re-generated! True BUT
  • 15. Who cares aboutTest Smells? Test Cases can be re-generated! Developers modify and remove test code Developers add tests when automatic tools leave uncovered branches Developers combine generated with manually written tests [Rojas et al. - ISSTA’15] Usability of Automatic GenerationTools in Practice True BUT
  • 16. On the Diffusion ofTest Smells in Automatically GeneratedTest Code:An Empirical Study Empirical Study Design
  • 17. Empirical Study Design 8test smell types “RefactoringTest Code” [Van Deursen et al. - XP 2001]
  • 18. Empirical Study Design 110software projects 8test smell types [Fraser and Arcuri -TOSEM 2014] “A Large Scale Evaluation of Automated Unit Test Generation using Evosuite” “RefactoringTest Code” [Van Deursen et al. - XP 2001]
  • 19. Empirical Study Design 110software projects 8test smell types [Fraser and Arcuri -TOSEM 2014] “A Large Scale Evaluation of Automated Unit Test Generation using Evosuite” “RefactoringTest Code” [Van Deursen et al. - XP 2001]
  • 20. Empirical Study Design 16,603JUnit classes [Fraser and Arcuri -TOSEM 2014] “A Large Scale Evaluation of Automated Unit Test Generation using Evosuite”
  • 21. Data Extraction test_method1() test_method2() … test_methodN() Test Suite [Bavota et al. - EMSE 2015] “AreTest Smells Harmful? An Empirical Study” Test Smell Detector
  • 22. Data Extraction test_method1() test_method2() … test_methodN() Test Suite [Bavota et al. - EMSE 2015] “AreTest Smells Harmful? An Empirical Study” Test Smell Detector 75% precision 100% recall Sample size: 378 JUnit classes
  • 23. Research Questions RQ1:To What ExtentTest Smells are Spread in Automatically GeneratedTest Classes? ?
  • 24. RQ1:To What ExtentTest Smells are Spread in Automatically GeneratedTest Classes? RQ2:WhichTest Smells Occur More Frequently in Automatically GeneratedTest Classes? ? Research Questions
  • 25. RQ1:To What ExtentTest Smells are Spread in Automatically GeneratedTest Classes? RQ2:WhichTest Smells Occur More Frequently in Automatically GeneratedTest Classes? RQ3:WhichTest Smells Co-OccurTogether? ? Research Questions
  • 26. RQ1:To What ExtentTest Smells are Spread in Automatically GeneratedTest Classes? RQ2:WhichTest Smells Occur More Frequently in Automatically GeneratedTest Classes? RQ3:WhichTest Smells Co-OccurTogether? RQ4: IsThere a Relationship Between the Presence ofTest Smells and the Project Characteristics? ? Research Questions
  • 27. On the Diffusion ofTest Smells in Automatically GeneratedTest Code:An Empirical Study Analysis of the Results
  • 28. Results of the Study RQ1:To What ExtentTest Smells are Spread in Automatically GeneratedTest Classes? !13,791smelly JUnit classes
  • 29. Results of the Study RQ1:To What ExtentTest Smells are Spread in Automatically GeneratedTest Classes? !83%of the JUnit classes analyzed
  • 30. Results of the Study RQ1:To What ExtentTest Smells are Spread in Automatically GeneratedTest Classes? !RQ1 Test Smells are highly diffused in the automatically generated test suites
  • 31. RQ2:WhichTest Smells Occur More Frequently in Automatically GeneratedTest Classes? Results of the Study !Assertion Roulette 54%
  • 32. RQ2:WhichTest Smells Occur More Frequently in Automatically GeneratedTest Classes? Results of the Study !Assertion Roulette 54% Test Code Duplication 33%
  • 33. RQ2:WhichTest Smells Occur More Frequently in Automatically GeneratedTest Classes? Results of the Study !Assertion Roulette 54% Test Code Duplication EagerTest 33% 29%
  • 34. RQ2:WhichTest Smells Occur More Frequently in Automatically GeneratedTest Classes? Results of the Study !public void test8 () throws Throwable { Document document0 = new Document();
 assertNotNull(document0); document0.procText.add((Character) ”s”); String string0 = document0.stringify();
 assertEquals (“s”, document0.stringify()); 
 assertNotNull(string0);
 assertEquals(“s”, string0); } Assertion Roulette
  • 35. RQ2:WhichTest Smells Occur More Frequently in Automatically GeneratedTest Classes? Results of the Study ! Assertion Roulette What is the behavior under test? Are the generated assertions valid?
  • 36. RQ2:WhichTest Smells Occur More Frequently in Automatically GeneratedTest Classes? Results of the Study ! Assertion Roulette [Panichella et al. - ICSE’16] The Impact ofTest Case Summaries on Bug Fixing Performance An Empirical Investigation These problems have a huge impact on developers’ ability to find faults
  • 37. RQ2:WhichTest Smells Occur More Frequently in Automatically GeneratedTest Classes? Results of the Study !public void test8 () throws Throwable { GenericProperties generic0 = new GenericProperties();
 boolean boolean0 = generic0.isValidClassname(); … } Test Code Duplication public void test9 () throws Throwable { GenericProperties generic0 = new GenericProperties();
 boolean boolean0 = generic0.isValidClassname(); … }
  • 38. RQ2:WhichTest Smells Occur More Frequently in Automatically GeneratedTest Classes? Results of the Study ! Test Code Duplication This problem can be avoided by generating test fixtures!
  • 39. Results of the Study ! RQ3:WhichTest Smells Co-OccurTogether? Assertion Roulette Eager Test Assertion Roulette Sensitive Equality Resource Optimism Mystery Guest
  • 40. Results of the Study ! RQ3:WhichTest Smells Co-OccurTogether? Assertion Roulette Eager Test Assertion Roulette Sensitive Equality Resource Optimism Mystery Guest Automatic tools have as main goal that of maximize coverage, without considering test code quality
  • 41. RQ4: IsThere a Relationship Between the Presence ofTest Smells and the Project Characteristics? Results of the Study !Yes! The higher the LOC to be tested, the higher the probability to produce a smelly test case!
  • 42. RQ4: IsThere a Relationship Between the Presence ofTest Smells and the Project Characteristics? Results of the Study !Yes! The higher the LOC to be tested, the higher the probability to produce a smelly test case! The higher the LOC of the JUnit class, the higher the probability to produce a smelly test case!
  • 43. Summarizing Lesson 1: Current implementations of search-based algorithms for automatic test case generation do not consider code quality, increasing the probability to introduce smells!
  • 44. Summarizing Lesson 1: Current implementations of search-based algorithms for automatic test case generation do not consider code quality, increasing the probability to introduce smells! NB: Considering test code quality is important not only to avoid the introduction of smells, but also because the coverage can be increased! [F. Palomba,A. Panichella,A. Zaidman, R. Oliveto,A. De Lucia - ISSTA’16] AutomaticTest Case Generation:What IfTest Code Quality Matters?
  • 45. Summarizing Lesson 2:Automatic test case generation tools do not produce text fixtures during their computation, and this implies the introduction of several code clones in the resulting JUnit classes. Future research should spend effort in the automatic generation of test fixtures!
  • 46. From now on… ? Challenge 1: EvaluatingTest Smells inTest Cases automatically generated by other tools
  • 47. From now on… ? Challenge 1: EvaluatingTest Smells inTest Cases automatically generated by other tools Challenge 2: Defining new algorithms able to solve the design problems analyzed (e.g., test fixtures).
  • 48. On the Diffusion ofTest Smells in Automatically GeneratedTest Code:An Empirical Study Fabio Palomba*, Dario Di Nucci*,Annibale Panichella+, Rocco Oliveto°,Andrea De Lucia* * University of Salerno, Italy +Delft University ofTechnology,The Netherlands ° University of Molise, Italy SBST 2016 May, 16th 2016 Austin,TX, USA