SlideShare a Scribd company logo
Unit Test in a nutshell 
Short presentation of a method to verify isolated units of code 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
About me 
Roberto Bettazzoni 
Agile Coach 
eXtreme Programming Trainer 
! 
Certified Scrum Professional 
>30 years of coding (and still proudly counting) 
! 
roberto.bettazzoni@agile42.com 
linkedin.com/in/robertobettazzoni 
@bettazzoni 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test 
Method to verify isolated units of code 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test 
user 
code 
Acceptance Criteria test 
Functional test 
Unit test 
Unit tests are written 
by coders for coders 
to test the code design 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test 
Method to verify isolated units of code 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test 
Method to verify isolated units of code 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test 
assert( condition ) 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test library 
assert( bool condition ) 
assertEqual( <T> a, <T> b ) 
assertEqual( float a, float b, float precision) 
assertThrow( exceptionType, function) 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test 
Method to verify isolated units of code 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Test Isolation 
A 
B 
C 
D 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Test Isolation 
Run 4 tests: A, B, C, D 
A 
B 
C 
D 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Test Isolation 
A 
B 
C 
D 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Test Isolation 
Run 3 tests: A, B, D 
A 
B 
D 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Test Isolation 
Run 3 tests: D, A, B 
D 
A 
B 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test library 
test() 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test library 
setup() - test() - teardown() 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test library 
Test Class also known as TestCase or TestFixture 
{ 
setup() {} 
teardown() {} 
! 
test_method_1() 
test_method_2() 
test_method_3() 
} 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test library 
Test Class also known as TestCase or TestFixture 
setup() - test_method_1() - teardown() 
setup() - test_method_2() - teardown() 
setup() - test_method_3() - teardown() 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test 
Method to verify isolated units of code 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test - What is a unit of code? 
Classes 
Methods 
Functions 
Blocks of code 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Code Isolation (or Unit Isolation) 
A 
B 
C 
D 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Code Isolation (or Unit Isolation) 
A 
B 
C 
D 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Take a guess 
What makes a “good unit test”? 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Take a guess 
What makes a “good unit test”? 
Readability 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Food for thoughts 
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License

More Related Content

PDF
Introduction of unit test to management
PDF
Scrum in a nutshell
PDF
TDD Dojo - Test Driven Development Coding Dojo
PPT
Tech talks #1- Unit testing and TDD
PDF
Presentation of agile engineering practices
PPTX
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
PPTX
Agile Testing by Example
PDF
What is Agile Testing?
Introduction of unit test to management
Scrum in a nutshell
TDD Dojo - Test Driven Development Coding Dojo
Tech talks #1- Unit testing and TDD
Presentation of agile engineering practices
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Agile Testing by Example
What is Agile Testing?

What's hot (20)

PDF
Agile Testing Framework - The Art of Automated Testing
PDF
Writing Testable Code
PPTX
Agile testing - Testing From Day 1
PDF
Certified Professional Master Agile Testing information and highlights
PDF
Test Automation Strategies for the Agile World
PDF
QA in Agile World
PDF
Agile engineering practices – a short overview
PPTX
#TesterbhiCoder - Every Tester should get into coding - Selenium automation
PDF
#BugATAhon2016 #WhoHasKeeda
PPTX
Agile tour ncr test360_degree - agile testing on steroids
PPTX
(Agile) engineering best practices - What every project manager should know
PPTX
Agile test tools
PDF
ATA CP-MAT program highlights
PDF
Large-Scale Agile Test Automation Strategies in Practice
PDF
Agile testing principles and practices - Anil Karade
PPTX
Agile Testing - presentation for Agile User Group
PPTX
The DevOps Dance - Shift Left, Shift Right - Get It Right
PDF
A Concise QA Process
PPT
Test Automation Strategies For Agile
PDF
What is Agile Testing?
Agile Testing Framework - The Art of Automated Testing
Writing Testable Code
Agile testing - Testing From Day 1
Certified Professional Master Agile Testing information and highlights
Test Automation Strategies for the Agile World
QA in Agile World
Agile engineering practices – a short overview
#TesterbhiCoder - Every Tester should get into coding - Selenium automation
#BugATAhon2016 #WhoHasKeeda
Agile tour ncr test360_degree - agile testing on steroids
(Agile) engineering best practices - What every project manager should know
Agile test tools
ATA CP-MAT program highlights
Large-Scale Agile Test Automation Strategies in Practice
Agile testing principles and practices - Anil Karade
Agile Testing - presentation for Agile User Group
The DevOps Dance - Shift Left, Shift Right - Get It Right
A Concise QA Process
Test Automation Strategies For Agile
What is Agile Testing?
Ad

Similar to Unit test in a nutshell (20)

PPTX
Unit testing
PPTX
The Test way
PDF
Identify and Exploit Behavioral Boundaries for Unit Testing
PPTX
Building unit tests correctly with visual studio 2013
PPT
Assessing Unit Test Quality
PPTX
Automating The Process For Building Reliable Software
PPTX
Unit Testing & Test Driven Development
PDF
Unit testing and scaffolding
PPTX
Unit testing
ODP
Improve your development skills with Test Driven Development
PPTX
Unit Testing and TDD 2017
PDF
Unit testing - A&BP CC
PPTX
1.1 Chapter_22_ Unit Testing-testing (1).pptx
PDF
Unit testing [4] - Software Testing Techniques (CIS640)
PPT
unit testing pppttttttttttttttttttttttttttttttttttttttttttttttt
PDF
Unit Testing Guide. Helps to understand the basics of unit testing .
PPTX
Testing & should i do it
PPTX
Building unit tests correctly
PPT
Introduction to test programming
PPTX
2016 10-04: tdd++: tdd made easier
Unit testing
The Test way
Identify and Exploit Behavioral Boundaries for Unit Testing
Building unit tests correctly with visual studio 2013
Assessing Unit Test Quality
Automating The Process For Building Reliable Software
Unit Testing & Test Driven Development
Unit testing and scaffolding
Unit testing
Improve your development skills with Test Driven Development
Unit Testing and TDD 2017
Unit testing - A&BP CC
1.1 Chapter_22_ Unit Testing-testing (1).pptx
Unit testing [4] - Software Testing Techniques (CIS640)
unit testing pppttttttttttttttttttttttttttttttttttttttttttttttt
Unit Testing Guide. Helps to understand the basics of unit testing .
Testing & should i do it
Building unit tests correctly
Introduction to test programming
2016 10-04: tdd++: tdd made easier
Ad

More from Roberto Bettazzoni (16)

PDF
Trasformare il debito tecnico in un vantaggio competitivo
PDF
The mythical technical debt. (Brooks, please, forgive me)
PDF
Giornat Mondiale della Retrospettiva 2020 - Riassunto Meetup Remoto
PDF
Complexity indicators: estimation precision and test types
PDF
Why you need to change your way of working
PDF
Presentation TDD in Python
PDF
Cynefin Lego Game Agenda (versione 2.0 in Italiano)
PDF
Pair programming and pair training
PDF
Presentazione eXtreme Programming
PDF
Agile e Open Source
PDF
Esempio di code kata
PDF
Introduzione alle metodologie e pratiche Agili ... ma l'agile c'entra qualcos...
PDF
Una fugace occhiata al Test Driven Development (2006)
PDF
The BDD live show (ITA)
PDF
Programmazione android per esseri umani
PDF
Useful Lean Tools: Value Stream Mapping and Kanban
Trasformare il debito tecnico in un vantaggio competitivo
The mythical technical debt. (Brooks, please, forgive me)
Giornat Mondiale della Retrospettiva 2020 - Riassunto Meetup Remoto
Complexity indicators: estimation precision and test types
Why you need to change your way of working
Presentation TDD in Python
Cynefin Lego Game Agenda (versione 2.0 in Italiano)
Pair programming and pair training
Presentazione eXtreme Programming
Agile e Open Source
Esempio di code kata
Introduzione alle metodologie e pratiche Agili ... ma l'agile c'entra qualcos...
Una fugace occhiata al Test Driven Development (2006)
The BDD live show (ITA)
Programmazione android per esseri umani
Useful Lean Tools: Value Stream Mapping and Kanban

Recently uploaded (20)

PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
history of c programming in notes for students .pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Introduction to Artificial Intelligence
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
System and Network Administration Chapter 2
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Nekopoi APK 2025 free lastest update
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Transform Your Business with a Software ERP System
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
L1 - Introduction to python Backend.pptx
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Odoo POS Development Services by CandidRoot Solutions
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
history of c programming in notes for students .pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
Introduction to Artificial Intelligence
Adobe Illustrator 28.6 Crack My Vision of Vector Design
System and Network Administration Chapter 2
Design an Analysis of Algorithms I-SECS-1021-03
Nekopoi APK 2025 free lastest update
PTS Company Brochure 2025 (1).pdf.......
Transform Your Business with a Software ERP System
Internet Downloader Manager (IDM) Crack 6.42 Build 41
How to Choose the Right IT Partner for Your Business in Malaysia
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
L1 - Introduction to python Backend.pptx
How to Migrate SBCGlobal Email to Yahoo Easily
Design an Analysis of Algorithms II-SECS-1021-03
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Odoo POS Development Services by CandidRoot Solutions

Unit test in a nutshell

  • 1. Unit Test in a nutshell Short presentation of a method to verify isolated units of code agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 2. About me Roberto Bettazzoni Agile Coach eXtreme Programming Trainer ! Certified Scrum Professional >30 years of coding (and still proudly counting) ! roberto.bettazzoni@agile42.com linkedin.com/in/robertobettazzoni @bettazzoni agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 3. unit test Method to verify isolated units of code agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 4. unit test user code Acceptance Criteria test Functional test Unit test Unit tests are written by coders for coders to test the code design agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 5. unit test Method to verify isolated units of code agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 6. unit test Method to verify isolated units of code agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 7. unit test assert( condition ) agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 8. unit test library assert( bool condition ) assertEqual( <T> a, <T> b ) assertEqual( float a, float b, float precision) assertThrow( exceptionType, function) agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 9. unit test Method to verify isolated units of code agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 10. Test Isolation A B C D agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 11. Test Isolation Run 4 tests: A, B, C, D A B C D agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 12. Test Isolation A B C D agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 13. Test Isolation Run 3 tests: A, B, D A B D agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 14. Test Isolation Run 3 tests: D, A, B D A B agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 15. unit test library test() agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 16. unit test library setup() - test() - teardown() agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 17. unit test library Test Class also known as TestCase or TestFixture { setup() {} teardown() {} ! test_method_1() test_method_2() test_method_3() } agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 18. unit test library Test Class also known as TestCase or TestFixture setup() - test_method_1() - teardown() setup() - test_method_2() - teardown() setup() - test_method_3() - teardown() agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 19. unit test Method to verify isolated units of code agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 20. unit test - What is a unit of code? Classes Methods Functions Blocks of code agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 21. Code Isolation (or Unit Isolation) A B C D agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 22. Code Isolation (or Unit Isolation) A B C D agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 23. Take a guess What makes a “good unit test”? agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 24. Take a guess What makes a “good unit test”? Readability agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  • 25. Food for thoughts agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License