SlideShare a Scribd company logo
Sabrina	
  de	
  F.	
  Souto,	
  UFCG,	
  Brazil	
  
sabrina@dsc.ufcg.edu.br	
  
	
  
Supervisor:	
  Dalton	
  Serey,	
  UFCG,	
  Brazil	
  
dalton@dsc.ufcg.edu.br	
  
Student	
  Forum	
  
¡  Introduction	
  
§  Unit	
  Test	
  
§  Mock	
  Objects	
  
¡  The	
  Problem	
  
¡  Solution	
  
¡  Evaluation	
  
2
¡  A	
  unit	
  is	
  the	
  smallest	
  testable	
  part	
  of	
  an	
  application	
  	
  
¡  In	
  the	
  object	
  oriented	
  paradigm	
  it	
  is	
  a	
  class	
  
¡  A	
  unit	
  test	
  consists	
  of	
  a	
  fixed	
  sequence	
  of	
  method	
  
invocations	
   with	
   arguments	
   that	
   explores	
   a	
  
particular	
  aspect	
  of	
  the	
  behavior	
  of	
  the	
  class	
  under	
  
test	
  –	
  CUT	
  
3
¡  Testing	
   a	
   unit	
   in	
   isolation	
   is	
   one	
   of	
   the	
   most	
  
important	
   principles	
   of	
   unit	
   testing.	
   However,	
   the	
  
CUT	
  usually	
  depends	
  on	
  other	
  classes...	
  
4
Test boundary
¡  For example, we have a test that access data
from a database
5
testMethodA(){
...
insert(“223300”, 20);
...
}
Table	
  Account	
  
[223300,	
  20]	
  
(1)
(2)
Solution: Initiate the database
with necessary data for the test
It can be very
slow!!!
Timeout	
  
6
Test boundary
¡  For example, we have tests that access data
from a database
7
testMethodA(){
...
insert(“223300”, 20);
...
}
Table	
  Account	
  
[223300,	
  20]	
  
(1)
(2)
Solution: Initiate the database
with necessary data for the test
It can be very
slow!!!
Timeout	
  
8
Efficiency
9
Efficiency
Effectiveness
10
Efficiency
Effectiveness
Development
11
12
Development
Maintenance
Efficiency
Effectiveness
¡  Mocks	
  can	
  make	
  tests	
  more	
  effective	
  and	
  efficient	
  
§  Mocks	
  make	
  testing	
  more	
  effective	
  because	
  mock	
  based	
  
tests	
  provide	
  more	
  precise	
  information	
  about	
  failures	
  and	
  
defects	
  
§  Mock	
   based	
   tests	
   use	
   simplified	
   simulations	
   of	
   the	
   real	
  
collaborators	
  
§  They	
   tend	
   to	
   run	
   faster,	
   especially	
   when	
   collaborators	
  
access	
   databases,	
   internet	
   connections	
   or	
   other	
   external	
  
systems	
  
13
¡  Writing	
   tests	
   that	
   use	
   mocks,	
   however,	
   can	
   be	
   a	
  
tedious	
  and	
  costly	
  task	
  
§  A	
   mock	
   based	
   unit	
   test	
   consists	
   in	
   writing	
   an	
   expectation	
  
script	
  
§  To	
   be	
   able	
   to	
   do	
   so,	
   testers	
   must	
   have	
   a	
   precise	
  
understanding	
   of	
   the	
   interactions	
   that	
   occur	
   among	
   all	
  
objects	
  in	
  the	
  chosen	
  scenario	
  
§  This	
   includes	
   not	
   only	
   the	
   sequence	
   of	
   calls,	
   but	
   also	
   the	
  
precise	
  data	
  that	
  is	
  sent	
  and	
  received	
  back	
  in	
  each	
  call	
  
§  Mock-­‐based	
  tests	
  are	
  short-­‐lived,	
  they	
  must	
  be	
  reconfigured	
  
for	
  every	
  minor	
  design	
  change	
  of	
  the	
  objects	
  in	
  the	
  scenario	
  
14
¡  All	
  these	
  drawbacks	
  make	
  using	
  mocks	
  costly	
  
¡  As	
  a	
  consequence,	
  in	
  practice,	
  testers	
  must	
  do	
  cost-­‐
benefit	
  analysis,	
  and	
  mock	
  only	
  part	
  of	
  the	
  unit	
  tests,	
  
when	
  they	
  don´t	
  give	
  up!	
  
15
¡  In	
  a	
  test	
  package,	
  the	
  percentage	
  of	
  unit	
  tests	
  with	
  
mock	
  objects	
  can	
  be	
  large	
  
¡  For	
   instance,	
   in	
   OurBackup	
   Home	
   Project,	
   53.4%	
   of	
   all	
  
automatic	
  unit	
  tests	
  use	
  mock	
  objects!	
  
¡  Thus,	
  how	
  can	
  we	
  take	
  advantage	
  of	
  mock	
  objects	
  
without	
  the	
  burden	
  caused	
  by	
  the	
  development	
  and	
  
maintenance?	
  
16
Development
Maintenance
Efficiency
Effectiveness
17
DevelopmentEfficiency
Effectiveness
18
Efficiency
Effectiveness
19
Efficiency
Effectiveness
20
Automock	
  
Automates	
   the	
   writing	
   of	
  
mock	
  objects,	
  by	
  generating	
  
them	
   automatically	
   for	
   a	
  
given	
  test	
  class!	
  
21
Automock
Test
Collaborators
C1	
  
C2	
  
…
Sta0c	
  
Analysis	
  
Dynamic	
  
Analysis	
  
Mock	
  Code	
  
Genera0on	
  
Interac0ons Mocked	
  	
  
Unit	
  Test
22
Automock
Test
Mocked	
  	
  
Unit	
  Test
Collaborators
C1	
  
C2	
  
…
Sta0c	
  
Analysis	
  
Dynamic	
  
Analysis	
  
Mock	
  Code	
  
Genera0on	
  
Interac0ons
¡  Questions:	
  
§  What	
   is	
   the	
   reduction	
   of	
   tester’s	
   effort,	
   by	
   using	
  
Automock?	
  
§  What	
  is	
  the	
  reduction	
  of	
  mock	
  code	
  development	
  time,	
  by	
  
using	
  Automock?	
  
§  Does	
  the	
  generated	
  code	
  have	
  the	
  same	
  semantic	
  of	
  one	
  
developed	
  manually?	
  
23
24
GOAL	
  
To	
  investigate	
  the	
  tester’s	
  effort	
  reduction	
  on	
  develop	
  mock	
  code,	
  by	
  
comparing	
  	
  the	
  number	
  of	
  lines	
  of	
  test	
  code	
  with	
  and	
  without	
  mocks	
  
QUESTION	
   What	
  is	
  the	
  reduction	
  of	
  tester’s	
  effort,	
  by	
  using	
  Automock?	
  
METRIC	
   Effort’s	
  reduction	
  =	
  (LOTCM	
  -­‐	
  LOTC)	
  /	
  LOTCM	
  	
  
Test	
  Class	
   LOTC	
   LOTCM	
  
Test1 243 600
Test2 905 2300
LOTC: lines of test code without mock objects
LOTCM: lines of test code with mock objects
It	
  means	
  that	
  the	
  tester/programmer	
  will	
  only	
  
have	
  to	
  produce	
  the	
  test	
  code	
  normally,	
  and	
  then	
  
generate	
  mock	
  code	
  using	
  Automock	
  
25
GOAL	
  
To	
   examine	
   the	
   mock	
   code	
   development	
   time	
   through	
   the	
   comparison	
  
between	
  develop	
  mocks	
  manually	
  and	
  automatically,	
  by	
  using	
  Automock	
  
QUESTION	
  
What	
   is	
   the	
   reduction	
   of	
   mock	
   code	
   development	
   time,	
   by	
   using	
  
Automock?	
  
METRIC	
   Time	
  reduction	
  =	
  (TMM	
  -­‐	
  TMA)	
  /	
  TMM	
  
Test	
  Class	
   TMM	
   TMA	
  
Test1 30.33 min 15 min
Test2 6 hours 20 min
TMM: time to develop mock code manually
TMA: time to develop mock code automatically
It	
  means	
  that	
  the	
  tester/programmer	
  will	
  only	
  
take	
  4%	
  of	
  the	
  time	
  to	
  produce	
  mock	
  code,	
  by	
  
using	
  Automock	
  
¡  Does	
   the	
   generated	
   code	
   have	
   the	
   same	
   semantic	
   of	
   one	
  
developed	
  manually?	
  
§  To	
  apply	
  mutation	
  tests	
  in	
  a	
  manual	
  mock	
  code	
  and	
  in	
  the	
  
one	
  automatically	
  generated	
  
§  To	
   do	
   a	
   qualitative	
   analysis,	
   by	
   comparing	
   manually	
   the	
  
generated	
  code	
  and	
  the	
  one	
  developed	
  in	
  a	
  manual	
  way	
  
§  To	
  execute	
  the	
  generated	
  code	
  and	
  the	
  one	
  developed	
  in	
  a	
  
manual	
  way	
  with	
  the	
  purpose	
  of	
  obtain	
  the	
  same	
  result	
  
26
¡  We	
   presented	
   a	
   technique	
   that	
   automatically	
  
generates	
  mock	
  code	
  for	
  tests	
  
¡  In	
  order	
  to	
  support	
  and	
  evaluate	
  the	
  technique,	
  we	
  
developed	
  a	
  prototype-­‐tool	
  and	
  applied	
  it	
  in	
  a	
  test	
  
development	
  environment	
  
¡  Although	
  the	
  evaluation	
  can	
  only	
  be	
  considered	
  as	
  
preliminary,	
  the	
  results	
  are	
  promising	
  
¡  Furthermore,	
   testers	
   were	
   convinced	
   that	
   the	
  
technique	
   can	
   be	
   very	
   helpful	
   during	
   test	
  
development	
  
27
¡  Future	
  work	
  will	
  be	
  focused	
  in	
  two	
  directions:	
  
§  First,	
  we	
  will	
  further	
  evaluate	
  the	
  gains	
  that	
  can	
  be	
  derived	
  
by	
   applying	
   the	
   technique	
   by	
   means	
   of	
   more	
   rigorous	
  
experiments	
  
§  Second,	
  we	
  plan	
  on	
  evolving	
  the	
  tool	
  to	
  make	
  it	
  both	
  more	
  
efficient	
   and	
   easier	
   to	
   use,	
   possibly	
   by	
   developing	
   an	
  
Automock	
  plug-­‐in	
  to	
  the	
  Eclipse	
  IDE	
  
28
Questions?	
  Suggestions?!	
  
29
Sabrina	
  de	
  F.	
  Souto,	
  UFCG,	
  Brazil	
  
Student	
  Forum	
  

More Related Content

What's hot

White box & Black box testing
White box & Black box testingWhite box & Black box testing
White box & Black box testing
NitishMhaske1
 
Model-Based Testing: Concepts, Tools, and Techniques
Model-Based Testing: Concepts, Tools, and TechniquesModel-Based Testing: Concepts, Tools, and Techniques
Model-Based Testing: Concepts, Tools, and Techniques
TechWell
 
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
Taeyeop Kim
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Quality
guest268ee8
 
Black box & white-box testing technique
Black box & white-box testing techniqueBlack box & white-box testing technique
Black box & white-box testing technique
SivaprasanthRentala1975
 
Unit testing legacy code
Unit testing legacy codeUnit testing legacy code
Unit testing legacy code
Lars Thorup
 
New software testing-techniques
New software testing-techniquesNew software testing-techniques
New software testing-techniques
Fincy V.J
 
N Unit Presentation
N Unit PresentationN Unit Presentation
N Unit Presentation
priya_trivedi
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Comunidade NetPonto
 
Boundary and equivalnce systematic test design
Boundary and equivalnce   systematic test designBoundary and equivalnce   systematic test design
Boundary and equivalnce systematic test design
Ian McDonald
 
Software Quality Testing
Software Quality TestingSoftware Quality Testing
Software Quality Testing
Kiran Kumar
 
How to complement TDD with static analysis
How to complement TDD with static analysisHow to complement TDD with static analysis
How to complement TDD with static analysis
PVS-Studio
 
Introduction to White box testing
Introduction to White box testingIntroduction to White box testing
Introduction to White box testing
Aliaa Monier Ismaail
 
Clean Unit Test Patterns
Clean Unit Test PatternsClean Unit Test Patterns
Clean Unit Test Patterns
Frank Appel
 
Black & White Box testing
Black & White Box testingBlack & White Box testing
Software Testing Techniques
Software Testing TechniquesSoftware Testing Techniques
Software Testing Techniques
Kiran Kumar
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnit
weili_at_slideshare
 
system verilog
system verilogsystem verilog
system verilog
Vinchipsytm Vlsitraining
 
White Box testing by Pankaj Thakur, NITTTR Chandigarh
White Box testing by Pankaj Thakur, NITTTR ChandigarhWhite Box testing by Pankaj Thakur, NITTTR Chandigarh
White Box testing by Pankaj Thakur, NITTTR Chandigarh
Pankaj Thakur
 
Unit testing on embedded target with C++Test
Unit testing on embedded  target with C++TestUnit testing on embedded  target with C++Test
Unit testing on embedded target with C++Test
Engineering Software Lab
 

What's hot (20)

White box & Black box testing
White box & Black box testingWhite box & Black box testing
White box & Black box testing
 
Model-Based Testing: Concepts, Tools, and Techniques
Model-Based Testing: Concepts, Tools, and TechniquesModel-Based Testing: Concepts, Tools, and Techniques
Model-Based Testing: Concepts, Tools, and Techniques
 
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Quality
 
Black box & white-box testing technique
Black box & white-box testing techniqueBlack box & white-box testing technique
Black box & white-box testing technique
 
Unit testing legacy code
Unit testing legacy codeUnit testing legacy code
Unit testing legacy code
 
New software testing-techniques
New software testing-techniquesNew software testing-techniques
New software testing-techniques
 
N Unit Presentation
N Unit PresentationN Unit Presentation
N Unit Presentation
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
 
Boundary and equivalnce systematic test design
Boundary and equivalnce   systematic test designBoundary and equivalnce   systematic test design
Boundary and equivalnce systematic test design
 
Software Quality Testing
Software Quality TestingSoftware Quality Testing
Software Quality Testing
 
How to complement TDD with static analysis
How to complement TDD with static analysisHow to complement TDD with static analysis
How to complement TDD with static analysis
 
Introduction to White box testing
Introduction to White box testingIntroduction to White box testing
Introduction to White box testing
 
Clean Unit Test Patterns
Clean Unit Test PatternsClean Unit Test Patterns
Clean Unit Test Patterns
 
Black & White Box testing
Black & White Box testingBlack & White Box testing
Black & White Box testing
 
Software Testing Techniques
Software Testing TechniquesSoftware Testing Techniques
Software Testing Techniques
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnit
 
system verilog
system verilogsystem verilog
system verilog
 
White Box testing by Pankaj Thakur, NITTTR Chandigarh
White Box testing by Pankaj Thakur, NITTTR ChandigarhWhite Box testing by Pankaj Thakur, NITTTR Chandigarh
White Box testing by Pankaj Thakur, NITTTR Chandigarh
 
Unit testing on embedded target with C++Test
Unit testing on embedded  target with C++TestUnit testing on embedded  target with C++Test
Unit testing on embedded target with C++Test
 

Similar to Automock: Interaction-Based Mock Code Generation

Testing of Object-Oriented Software
Testing of Object-Oriented SoftwareTesting of Object-Oriented Software
Testing of Object-Oriented Software
Praveen Penumathsa
 
Generating test cases using UML Communication Diagram
Generating test cases using UML Communication Diagram Generating test cases using UML Communication Diagram
Generating test cases using UML Communication Diagram
Praveen Penumathsa
 
Automated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsAutomated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra Solutions
Quontra Solutions
 
Software Testing Tecniques
Software Testing TecniquesSoftware Testing Tecniques
Software Testing Tecniques
ersanbilik
 
OOSE Unit 5 PPT.ppt
OOSE Unit 5 PPT.pptOOSE Unit 5 PPT.ppt
OOSE Unit 5 PPT.ppt
itadmin33
 
Oose unit 5 ppt
Oose unit 5 pptOose unit 5 ppt
Oose unit 5 ppt
Dr VISU P
 
Software Testing
Software TestingSoftware Testing
Software Testing
AdroitLogic
 
Unit tests and TDD
Unit tests and TDDUnit tests and TDD
Unit tests and TDD
Roman Okolovich
 
Unit Testing Full@
Unit Testing Full@Unit Testing Full@
Unit Testing Full@
Alex Borsuk
 
Software Testing - Day One
Software Testing - Day OneSoftware Testing - Day One
Software Testing - Day One
Govardhan Reddy
 
TLC2018 Thomas Haver: The Automation Firehose - Be Strategic and Tactical
TLC2018 Thomas Haver: The Automation Firehose - Be Strategic and TacticalTLC2018 Thomas Haver: The Automation Firehose - Be Strategic and Tactical
TLC2018 Thomas Haver: The Automation Firehose - Be Strategic and Tactical
Anna Royzman
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
Baskar K
 
How To Transform the Manual Testing Process to Incorporate Test Automation
How To Transform the Manual Testing Process to Incorporate Test AutomationHow To Transform the Manual Testing Process to Incorporate Test Automation
How To Transform the Manual Testing Process to Incorporate Test Automation
Ranorex
 
Testing
TestingTesting
www.tutorialsbook.com presents Manual testing
www.tutorialsbook.com presents Manual testingwww.tutorialsbook.com presents Manual testing
www.tutorialsbook.com presents Manual testing
Tutorials Book
 
Testing
TestingTesting
Testing
nazeer pasha
 
Testing chapter updated (1)
Testing chapter updated (1)Testing chapter updated (1)
Testing chapter updated (1)
abdullah619
 
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
Roberto Pérez Alcolea
 
Coldbox developer training – session 4
Coldbox developer training – session 4Coldbox developer training – session 4
Coldbox developer training – session 4
Billie Berzinskas
 
TDD Workshop UTN 2012
TDD Workshop UTN 2012TDD Workshop UTN 2012
TDD Workshop UTN 2012
Facundo Farias
 

Similar to Automock: Interaction-Based Mock Code Generation (20)

Testing of Object-Oriented Software
Testing of Object-Oriented SoftwareTesting of Object-Oriented Software
Testing of Object-Oriented Software
 
Generating test cases using UML Communication Diagram
Generating test cases using UML Communication Diagram Generating test cases using UML Communication Diagram
Generating test cases using UML Communication Diagram
 
Automated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsAutomated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra Solutions
 
Software Testing Tecniques
Software Testing TecniquesSoftware Testing Tecniques
Software Testing Tecniques
 
OOSE Unit 5 PPT.ppt
OOSE Unit 5 PPT.pptOOSE Unit 5 PPT.ppt
OOSE Unit 5 PPT.ppt
 
Oose unit 5 ppt
Oose unit 5 pptOose unit 5 ppt
Oose unit 5 ppt
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Unit tests and TDD
Unit tests and TDDUnit tests and TDD
Unit tests and TDD
 
Unit Testing Full@
Unit Testing Full@Unit Testing Full@
Unit Testing Full@
 
Software Testing - Day One
Software Testing - Day OneSoftware Testing - Day One
Software Testing - Day One
 
TLC2018 Thomas Haver: The Automation Firehose - Be Strategic and Tactical
TLC2018 Thomas Haver: The Automation Firehose - Be Strategic and TacticalTLC2018 Thomas Haver: The Automation Firehose - Be Strategic and Tactical
TLC2018 Thomas Haver: The Automation Firehose - Be Strategic and Tactical
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
 
How To Transform the Manual Testing Process to Incorporate Test Automation
How To Transform the Manual Testing Process to Incorporate Test AutomationHow To Transform the Manual Testing Process to Incorporate Test Automation
How To Transform the Manual Testing Process to Incorporate Test Automation
 
Testing
TestingTesting
Testing
 
www.tutorialsbook.com presents Manual testing
www.tutorialsbook.com presents Manual testingwww.tutorialsbook.com presents Manual testing
www.tutorialsbook.com presents Manual testing
 
Testing
TestingTesting
Testing
 
Testing chapter updated (1)
Testing chapter updated (1)Testing chapter updated (1)
Testing chapter updated (1)
 
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
[DPE Summit] How Improving the Testing Experience Goes Beyond Quality: A Deve...
 
Coldbox developer training – session 4
Coldbox developer training – session 4Coldbox developer training – session 4
Coldbox developer training – session 4
 
TDD Workshop UTN 2012
TDD Workshop UTN 2012TDD Workshop UTN 2012
TDD Workshop UTN 2012
 

Recently uploaded

HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 

Recently uploaded (20)

HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 

Automock: Interaction-Based Mock Code Generation

  • 1. Sabrina  de  F.  Souto,  UFCG,  Brazil   sabrina@dsc.ufcg.edu.br     Supervisor:  Dalton  Serey,  UFCG,  Brazil   dalton@dsc.ufcg.edu.br   Student  Forum  
  • 2. ¡  Introduction   §  Unit  Test   §  Mock  Objects   ¡  The  Problem   ¡  Solution   ¡  Evaluation   2
  • 3. ¡  A  unit  is  the  smallest  testable  part  of  an  application     ¡  In  the  object  oriented  paradigm  it  is  a  class   ¡  A  unit  test  consists  of  a  fixed  sequence  of  method   invocations   with   arguments   that   explores   a   particular  aspect  of  the  behavior  of  the  class  under   test  –  CUT   3
  • 4. ¡  Testing   a   unit   in   isolation   is   one   of   the   most   important   principles   of   unit   testing.   However,   the   CUT  usually  depends  on  other  classes...   4 Test boundary
  • 5. ¡  For example, we have a test that access data from a database 5 testMethodA(){ ... insert(“223300”, 20); ... } Table  Account   [223300,  20]   (1) (2) Solution: Initiate the database with necessary data for the test It can be very slow!!! Timeout  
  • 7. ¡  For example, we have tests that access data from a database 7 testMethodA(){ ... insert(“223300”, 20); ... } Table  Account   [223300,  20]   (1) (2) Solution: Initiate the database with necessary data for the test It can be very slow!!! Timeout  
  • 8. 8
  • 13. ¡  Mocks  can  make  tests  more  effective  and  efficient   §  Mocks  make  testing  more  effective  because  mock  based   tests  provide  more  precise  information  about  failures  and   defects   §  Mock   based   tests   use   simplified   simulations   of   the   real   collaborators   §  They   tend   to   run   faster,   especially   when   collaborators   access   databases,   internet   connections   or   other   external   systems   13
  • 14. ¡  Writing   tests   that   use   mocks,   however,   can   be   a   tedious  and  costly  task   §  A   mock   based   unit   test   consists   in   writing   an   expectation   script   §  To   be   able   to   do   so,   testers   must   have   a   precise   understanding   of   the   interactions   that   occur   among   all   objects  in  the  chosen  scenario   §  This   includes   not   only   the   sequence   of   calls,   but   also   the   precise  data  that  is  sent  and  received  back  in  each  call   §  Mock-­‐based  tests  are  short-­‐lived,  they  must  be  reconfigured   for  every  minor  design  change  of  the  objects  in  the  scenario   14
  • 15. ¡  All  these  drawbacks  make  using  mocks  costly   ¡  As  a  consequence,  in  practice,  testers  must  do  cost-­‐ benefit  analysis,  and  mock  only  part  of  the  unit  tests,   when  they  don´t  give  up!   15
  • 16. ¡  In  a  test  package,  the  percentage  of  unit  tests  with   mock  objects  can  be  large   ¡  For   instance,   in   OurBackup   Home   Project,   53.4%   of   all   automatic  unit  tests  use  mock  objects!   ¡  Thus,  how  can  we  take  advantage  of  mock  objects   without  the  burden  caused  by  the  development  and   maintenance?   16
  • 20. Efficiency Effectiveness 20 Automock   Automates   the   writing   of   mock  objects,  by  generating   them   automatically   for   a   given  test  class!  
  • 21. 21 Automock Test Collaborators C1   C2   … Sta0c   Analysis   Dynamic   Analysis   Mock  Code   Genera0on   Interac0ons Mocked     Unit  Test
  • 22. 22 Automock Test Mocked     Unit  Test Collaborators C1   C2   … Sta0c   Analysis   Dynamic   Analysis   Mock  Code   Genera0on   Interac0ons
  • 23. ¡  Questions:   §  What   is   the   reduction   of   tester’s   effort,   by   using   Automock?   §  What  is  the  reduction  of  mock  code  development  time,  by   using  Automock?   §  Does  the  generated  code  have  the  same  semantic  of  one   developed  manually?   23
  • 24. 24 GOAL   To  investigate  the  tester’s  effort  reduction  on  develop  mock  code,  by   comparing    the  number  of  lines  of  test  code  with  and  without  mocks   QUESTION   What  is  the  reduction  of  tester’s  effort,  by  using  Automock?   METRIC   Effort’s  reduction  =  (LOTCM  -­‐  LOTC)  /  LOTCM     Test  Class   LOTC   LOTCM   Test1 243 600 Test2 905 2300 LOTC: lines of test code without mock objects LOTCM: lines of test code with mock objects It  means  that  the  tester/programmer  will  only   have  to  produce  the  test  code  normally,  and  then   generate  mock  code  using  Automock  
  • 25. 25 GOAL   To   examine   the   mock   code   development   time   through   the   comparison   between  develop  mocks  manually  and  automatically,  by  using  Automock   QUESTION   What   is   the   reduction   of   mock   code   development   time,   by   using   Automock?   METRIC   Time  reduction  =  (TMM  -­‐  TMA)  /  TMM   Test  Class   TMM   TMA   Test1 30.33 min 15 min Test2 6 hours 20 min TMM: time to develop mock code manually TMA: time to develop mock code automatically It  means  that  the  tester/programmer  will  only   take  4%  of  the  time  to  produce  mock  code,  by   using  Automock  
  • 26. ¡  Does   the   generated   code   have   the   same   semantic   of   one   developed  manually?   §  To  apply  mutation  tests  in  a  manual  mock  code  and  in  the   one  automatically  generated   §  To   do   a   qualitative   analysis,   by   comparing   manually   the   generated  code  and  the  one  developed  in  a  manual  way   §  To  execute  the  generated  code  and  the  one  developed  in  a   manual  way  with  the  purpose  of  obtain  the  same  result   26
  • 27. ¡  We   presented   a   technique   that   automatically   generates  mock  code  for  tests   ¡  In  order  to  support  and  evaluate  the  technique,  we   developed  a  prototype-­‐tool  and  applied  it  in  a  test   development  environment   ¡  Although  the  evaluation  can  only  be  considered  as   preliminary,  the  results  are  promising   ¡  Furthermore,   testers   were   convinced   that   the   technique   can   be   very   helpful   during   test   development   27
  • 28. ¡  Future  work  will  be  focused  in  two  directions:   §  First,  we  will  further  evaluate  the  gains  that  can  be  derived   by   applying   the   technique   by   means   of   more   rigorous   experiments   §  Second,  we  plan  on  evolving  the  tool  to  make  it  both  more   efficient   and   easier   to   use,   possibly   by   developing   an   Automock  plug-­‐in  to  the  Eclipse  IDE   28
  • 29. Questions?  Suggestions?!   29 Sabrina  de  F.  Souto,  UFCG,  Brazil   Student  Forum