SlideShare a Scribd company logo
1 of 19
Download to read offline
Becoming a better
PROGRAMMER
Unit	
  Tes)ng	
  
About my company:
•  Founded: Oct/2003
•  Headquarter: Tokyo
•  Services: Web & Smartphone
development
•  Number of employees: 60
SeeSaa	
  
Tokyo	
  
Viet	
  Nam	
  
Kyoto	
  
Web services:
Smartphone apps:
About me:
Nguyen	
  
The	
  Cuong	
  
Android	
  
Developer	
  
im.thecuong	
  
HUT	
  
Agenda:
What	
  is	
  Unit	
  Test	
  ?	
  
Why	
  should	
  we	
  do	
  Unit	
  Test	
  ?	
  
When,	
  Where	
  &	
  Who	
  do	
  Unit	
  Test	
  ?	
  
How	
  to	
  write	
  a	
  good	
  Unit	
  Test	
  
Development process
Test Driven Development
Unit Test
Unit	
  Tes)ng	
  
is	
  a	
  process	
  of	
  
wri)ng	
  test	
  for	
  
specific	
  part	
  of	
  
code/system.	
  	
  	
  
A	
  Unit	
  is	
  the	
  smallest	
  
possible	
  part	
  of	
  
applica)on/system	
  
under	
  test.	
  
Tes)ng	
  is	
  a	
  process	
  of	
  
	
  checking/evalua)ng	
  an	
  
aJribute/characteris)cs/
capability	
  of	
  a	
  method/object/
program…	
  	
  
and	
  determining	
  that	
  actual	
  
behavior	
  meets	
  with	
  expected	
  
behavior.	
  
Why should we do Unit Test ?
•  How	
  about	
  Logger,	
  Debugger	
  ?	
  
Faster	
  debugging,	
  isn’t	
  it	
  ?	
  
•  Not	
  sure,	
  even	
  slower!	
  
Faster	
  development,	
  isn’t	
  it	
  ?	
  
•  Let	
  see	
  an	
  example:	
  
Faster	
  tes)ng	
  ?	
  
Example
Testing max of list keyword ?
Why should we do Unit Test ?
•  Instead	
  of	
  wri)ng	
  code	
  to	
  do	
  something,	
  you’re	
  star)ng	
  by	
  
outlining	
  all	
  the	
  condi)ons	
  you’re	
  subjec)ng	
  the	
  code	
  to	
  and	
  
what	
  outputs	
  you’d	
  expect	
  from	
  that	
  
Designing	
  soUware	
  components	
  robustly	
  
•  Avoid	
  regression	
  errors	
  
•  You	
  test	
  the	
  code	
  once	
  and	
  the	
  con)nuously	
  aUerwards	
  
•  For	
  people	
  who	
  are	
  going	
  to	
  maintain	
  or	
  develop	
  your	
  code	
  
Reduce	
  future	
  code	
  
• Of	
  course,	
  are	
  developers	
  
Who	
  create	
  Unit	
  Test	
  ? 	
  	
  
• Right	
  aUer	
  get	
  &	
  read	
  details	
  design/
requirement.	
  
Where	
  in	
  project	
  development	
  ?	
  
• Depends	
  on	
  size	
  of	
  the	
  project	
  ?	
  
• Depends	
  on	
  kind	
  of	
  the	
  project	
  ?	
  
• Depends	
  on	
  level	
  of	
  the	
  developer	
  ?	
  
When	
  do,	
  when	
  don’t	
  ?	
  
•  Process:
•  Get & Read detail design document
•  Choose a function to develop, then follow
to the diagram
•  Take attention: whenever refactoring your
code, you should run unit test accordingly.
Along with adding new code, you need to
perform corresponding tests as well.
How to write a good Unit Test
Structure:
•  Set up all conditions for testing
•  Call the method (or trigger)
being tested
•  Verify that the result is correct
•  Teardown: clean up modified
records
How to write a good Unit Test
Some tips:
•  Make each test independent to all the
others
•  Test one thing only in one test case
•  One function may have multiple unit
tests according to the usage and outputs
of the function
•  Don’t forget to refactor the test code
•  With little time and much to test you can’t
afford lengthy and ineffective checks.
Make test case simple, concentrate on
the core behavior of your product and
use as little code as you can.
•  Creating maintainable & readable tests
How to write a good Unit Test
Conclusion
Without doubt, unit testing can
significantly increase the quality of
your project
Becoming a better programmer - unit testing

More Related Content

What's hot

Automated Testing of Web Applications
Automated Testing of Web ApplicationsAutomated Testing of Web Applications
Automated Testing of Web Applicationsjonatankronqvist
 
Selenium Testing Project report
Selenium Testing Project reportSelenium Testing Project report
Selenium Testing Project reportKapil Rajpurohit
 
How to be proud when you are done
How to be proud when you are doneHow to be proud when you are done
How to be proud when you are doneAleksey Solntsev
 
Introduction to Automation Testing
Introduction to Automation TestingIntroduction to Automation Testing
Introduction to Automation TestingArchana Krushnan
 
Visual Studio 2010 Testing for Developers
Visual Studio 2010 Testing for DevelopersVisual Studio 2010 Testing for Developers
Visual Studio 2010 Testing for DevelopersSteve Lange
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentZendCon
 
Unit Testing, TDD and the Walking Skeleton
Unit Testing, TDD and the Walking SkeletonUnit Testing, TDD and the Walking Skeleton
Unit Testing, TDD and the Walking SkeletonSeb Rose
 
Continuous Integration: Finding problems soonest
Continuous Integration: Finding problems soonestContinuous Integration: Finding problems soonest
Continuous Integration: Finding problems soonestShawn Jones
 
Myths and reality about software testing
Myths and reality about software testingMyths and reality about software testing
Myths and reality about software testingAlisha Henderson
 
What is the difference between manual testing and automation testing
What is the difference between manual testing and automation testingWhat is the difference between manual testing and automation testing
What is the difference between manual testing and automation testingEr Mahednra Chauhan
 

What's hot (20)

Automated Testing of Web Applications
Automated Testing of Web ApplicationsAutomated Testing of Web Applications
Automated Testing of Web Applications
 
Selenium Testing Project report
Selenium Testing Project reportSelenium Testing Project report
Selenium Testing Project report
 
Unit tests benefits
Unit tests benefitsUnit tests benefits
Unit tests benefits
 
10 Benefits of Automated Testing
10 Benefits of Automated Testing10 Benefits of Automated Testing
10 Benefits of Automated Testing
 
DevOps
DevOpsDevOps
DevOps
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Code review
Code reviewCode review
Code review
 
XP Injection
XP InjectionXP Injection
XP Injection
 
Continuous testing
Continuous testingContinuous testing
Continuous testing
 
Software testing
Software testingSoftware testing
Software testing
 
How to be proud when you are done
How to be proud when you are doneHow to be proud when you are done
How to be proud when you are done
 
Introduction to Automation Testing
Introduction to Automation TestingIntroduction to Automation Testing
Introduction to Automation Testing
 
Visual Studio 2010 Testing for Developers
Visual Studio 2010 Testing for DevelopersVisual Studio 2010 Testing for Developers
Visual Studio 2010 Testing for Developers
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Unit Testing, TDD and the Walking Skeleton
Unit Testing, TDD and the Walking SkeletonUnit Testing, TDD and the Walking Skeleton
Unit Testing, TDD and the Walking Skeleton
 
Continuous Integration: Finding problems soonest
Continuous Integration: Finding problems soonestContinuous Integration: Finding problems soonest
Continuous Integration: Finding problems soonest
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Myths and reality about software testing
Myths and reality about software testingMyths and reality about software testing
Myths and reality about software testing
 
What is the difference between manual testing and automation testing
What is the difference between manual testing and automation testingWhat is the difference between manual testing and automation testing
What is the difference between manual testing and automation testing
 
Automation With A Tool Demo
Automation With A Tool DemoAutomation With A Tool Demo
Automation With A Tool Demo
 

Similar to Becoming a better programmer - unit testing

Test Driven Development - a Practitioner’s Perspective
Test Driven Development - a Practitioner’s PerspectiveTest Driven Development - a Practitioner’s Perspective
Test Driven Development - a Practitioner’s PerspectiveMalinda Kapuruge
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit TestingSahar Nofal
 
Test Driven Development using QUnit
Test Driven Development using QUnitTest Driven Development using QUnit
Test Driven Development using QUnitsatejsahu
 
Week 14 Unit Testing.pptx
Week 14  Unit Testing.pptxWeek 14  Unit Testing.pptx
Week 14 Unit Testing.pptxmianshafa
 
{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptxAmalEldhose2
 
Introduction to-automated-testing
Introduction to-automated-testingIntroduction to-automated-testing
Introduction to-automated-testingBestBrains
 
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019Jason Tice
 
Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)Abhijeet Vaikar
 
Understanding TDD - theory, practice, techniques and tips.
Understanding TDD - theory, practice, techniques and tips.Understanding TDD - theory, practice, techniques and tips.
Understanding TDD - theory, practice, techniques and tips.Malinda Kapuruge
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven developmentEinar Ingebrigtsen
 
Test driven development
Test driven developmentTest driven development
Test driven developmentHarry Potter
 
Test driven development
Test driven developmentTest driven development
Test driven developmentLuis Goldster
 
Test driven development
Test driven developmentTest driven development
Test driven developmentTony Nguyen
 
Test driven development
Test driven developmentTest driven development
Test driven developmentYoung Alista
 
Test driven development
Test driven developmentTest driven development
Test driven developmentJames Wong
 
Test driven development
Test driven developmentTest driven development
Test driven developmentFraboni Ec
 

Similar to Becoming a better programmer - unit testing (20)

Methodology: IT test
Methodology: IT testMethodology: IT test
Methodology: IT test
 
Test Driven Development - a Practitioner’s Perspective
Test Driven Development - a Practitioner’s PerspectiveTest Driven Development - a Practitioner’s Perspective
Test Driven Development - a Practitioner’s Perspective
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit Testing
 
Test Driven Development using QUnit
Test Driven Development using QUnitTest Driven Development using QUnit
Test Driven Development using QUnit
 
Week 14 Unit Testing.pptx
Week 14  Unit Testing.pptxWeek 14  Unit Testing.pptx
Week 14 Unit Testing.pptx
 
Istqb foundation level day 1
Istqb foundation level   day 1Istqb foundation level   day 1
Istqb foundation level day 1
 
{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx{10.0} Test Driven Development.pptx
{10.0} Test Driven Development.pptx
 
Introduction to-automated-testing
Introduction to-automated-testingIntroduction to-automated-testing
Introduction to-automated-testing
 
Tdd
TddTdd
Tdd
 
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
 
Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)
 
Understanding TDD - theory, practice, techniques and tips.
Understanding TDD - theory, practice, techniques and tips.Understanding TDD - theory, practice, techniques and tips.
Understanding TDD - theory, practice, techniques and tips.
 
Chapter6
Chapter6Chapter6
Chapter6
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 

More from Duy Tan Geek

Amazon Elastic Load Balancing
Amazon Elastic Load BalancingAmazon Elastic Load Balancing
Amazon Elastic Load BalancingDuy Tan Geek
 
Cloud - FOSS & Challenge
Cloud - FOSS & ChallengeCloud - FOSS & Challenge
Cloud - FOSS & ChallengeDuy Tan Geek
 
AWS, is it interesting?
AWS, is it interesting?AWS, is it interesting?
AWS, is it interesting?Duy Tan Geek
 
Cloud DC Transforming
Cloud DC TransformingCloud DC Transforming
Cloud DC TransformingDuy Tan Geek
 
Practical TDD in Septeni Technology
Practical TDD in Septeni TechnologyPractical TDD in Septeni Technology
Practical TDD in Septeni TechnologyDuy Tan Geek
 
Build Quality In with TDD
Build Quality In with TDDBuild Quality In with TDD
Build Quality In with TDDDuy Tan Geek
 
Sharing bridge SE working experience of myself
Sharing bridge SE working experience of myselfSharing bridge SE working experience of myself
Sharing bridge SE working experience of myselfDuy Tan Geek
 
Game development with Cocos2d-x Engine
Game development with Cocos2d-x EngineGame development with Cocos2d-x Engine
Game development with Cocos2d-x EngineDuy Tan Geek
 
HTML5 mobile games
HTML5 mobile gamesHTML5 mobile games
HTML5 mobile gamesDuy Tan Geek
 
Game engine introduction and approach
Game engine introduction and approachGame engine introduction and approach
Game engine introduction and approachDuy Tan Geek
 
10 things you need to know about doing business with Japanese
10 things you need to know about doing business with Japanese10 things you need to know about doing business with Japanese
10 things you need to know about doing business with JapaneseDuy Tan Geek
 
Enjoy Japanese work style
Enjoy Japanese work styleEnjoy Japanese work style
Enjoy Japanese work styleDuy Tan Geek
 
A cup of coffee worth 10 dollars is what we are going to sell!
A cup of coffee worth 10 dollars is what we are going to sell!A cup of coffee worth 10 dollars is what we are going to sell!
A cup of coffee worth 10 dollars is what we are going to sell!Duy Tan Geek
 
Introduction to pmp
Introduction to pmpIntroduction to pmp
Introduction to pmpDuy Tan Geek
 
Beyond project management
Beyond project managementBeyond project management
Beyond project managementDuy Tan Geek
 
The way to set automation testing
The way to set automation testingThe way to set automation testing
The way to set automation testingDuy Tan Geek
 
Quality Management Introduction
Quality Management IntroductionQuality Management Introduction
Quality Management IntroductionDuy Tan Geek
 
Techniques in black box testing
Techniques in black box testingTechniques in black box testing
Techniques in black box testingDuy Tan Geek
 
Mobile App Testing
Mobile App TestingMobile App Testing
Mobile App TestingDuy Tan Geek
 

More from Duy Tan Geek (20)

Amazon Elastic Load Balancing
Amazon Elastic Load BalancingAmazon Elastic Load Balancing
Amazon Elastic Load Balancing
 
Cloud - FOSS & Challenge
Cloud - FOSS & ChallengeCloud - FOSS & Challenge
Cloud - FOSS & Challenge
 
AWS, is it interesting?
AWS, is it interesting?AWS, is it interesting?
AWS, is it interesting?
 
Cloud DC Transforming
Cloud DC TransformingCloud DC Transforming
Cloud DC Transforming
 
Practical TDD in Septeni Technology
Practical TDD in Septeni TechnologyPractical TDD in Septeni Technology
Practical TDD in Septeni Technology
 
Build Quality In with TDD
Build Quality In with TDDBuild Quality In with TDD
Build Quality In with TDD
 
Sharing bridge SE working experience of myself
Sharing bridge SE working experience of myselfSharing bridge SE working experience of myself
Sharing bridge SE working experience of myself
 
Game development with Cocos2d-x Engine
Game development with Cocos2d-x EngineGame development with Cocos2d-x Engine
Game development with Cocos2d-x Engine
 
HTML5 mobile games
HTML5 mobile gamesHTML5 mobile games
HTML5 mobile games
 
Game engine introduction and approach
Game engine introduction and approachGame engine introduction and approach
Game engine introduction and approach
 
10 things you need to know about doing business with Japanese
10 things you need to know about doing business with Japanese10 things you need to know about doing business with Japanese
10 things you need to know about doing business with Japanese
 
Enjoy Japanese work style
Enjoy Japanese work styleEnjoy Japanese work style
Enjoy Japanese work style
 
A cup of coffee worth 10 dollars is what we are going to sell!
A cup of coffee worth 10 dollars is what we are going to sell!A cup of coffee worth 10 dollars is what we are going to sell!
A cup of coffee worth 10 dollars is what we are going to sell!
 
Leader ship value
Leader ship valueLeader ship value
Leader ship value
 
Introduction to pmp
Introduction to pmpIntroduction to pmp
Introduction to pmp
 
Beyond project management
Beyond project managementBeyond project management
Beyond project management
 
The way to set automation testing
The way to set automation testingThe way to set automation testing
The way to set automation testing
 
Quality Management Introduction
Quality Management IntroductionQuality Management Introduction
Quality Management Introduction
 
Techniques in black box testing
Techniques in black box testingTechniques in black box testing
Techniques in black box testing
 
Mobile App Testing
Mobile App TestingMobile App Testing
Mobile App Testing
 

Recently uploaded

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 

Recently uploaded (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 

Becoming a better programmer - unit testing

  • 2. About my company: •  Founded: Oct/2003 •  Headquarter: Tokyo •  Services: Web & Smartphone development •  Number of employees: 60 SeeSaa   Tokyo   Viet  Nam   Kyoto  
  • 5. About me: Nguyen   The  Cuong   Android   Developer   im.thecuong   HUT  
  • 6. Agenda: What  is  Unit  Test  ?   Why  should  we  do  Unit  Test  ?   When,  Where  &  Who  do  Unit  Test  ?   How  to  write  a  good  Unit  Test  
  • 9. Unit Test Unit  Tes)ng   is  a  process  of   wri)ng  test  for   specific  part  of   code/system.       A  Unit  is  the  smallest   possible  part  of   applica)on/system   under  test.   Tes)ng  is  a  process  of    checking/evalua)ng  an   aJribute/characteris)cs/ capability  of  a  method/object/ program…     and  determining  that  actual   behavior  meets  with  expected   behavior.  
  • 10. Why should we do Unit Test ? •  How  about  Logger,  Debugger  ?   Faster  debugging,  isn’t  it  ?   •  Not  sure,  even  slower!   Faster  development,  isn’t  it  ?   •  Let  see  an  example:   Faster  tes)ng  ?  
  • 11. Example Testing max of list keyword ?
  • 12. Why should we do Unit Test ? •  Instead  of  wri)ng  code  to  do  something,  you’re  star)ng  by   outlining  all  the  condi)ons  you’re  subjec)ng  the  code  to  and   what  outputs  you’d  expect  from  that   Designing  soUware  components  robustly   •  Avoid  regression  errors   •  You  test  the  code  once  and  the  con)nuously  aUerwards   •  For  people  who  are  going  to  maintain  or  develop  your  code   Reduce  future  code  
  • 13. • Of  course,  are  developers   Who  create  Unit  Test  ?     • Right  aUer  get  &  read  details  design/ requirement.   Where  in  project  development  ?  
  • 14. • Depends  on  size  of  the  project  ?   • Depends  on  kind  of  the  project  ?   • Depends  on  level  of  the  developer  ?   When  do,  when  don’t  ?  
  • 15. •  Process: •  Get & Read detail design document •  Choose a function to develop, then follow to the diagram •  Take attention: whenever refactoring your code, you should run unit test accordingly. Along with adding new code, you need to perform corresponding tests as well. How to write a good Unit Test
  • 16. Structure: •  Set up all conditions for testing •  Call the method (or trigger) being tested •  Verify that the result is correct •  Teardown: clean up modified records How to write a good Unit Test
  • 17. Some tips: •  Make each test independent to all the others •  Test one thing only in one test case •  One function may have multiple unit tests according to the usage and outputs of the function •  Don’t forget to refactor the test code •  With little time and much to test you can’t afford lengthy and ineffective checks. Make test case simple, concentrate on the core behavior of your product and use as little code as you can. •  Creating maintainable & readable tests How to write a good Unit Test
  • 18. Conclusion Without doubt, unit testing can significantly increase the quality of your project