SlideShare a Scribd company logo
Unit Testing 
By Mohamad Asmar a.k.a DaiGooR
Me! 
Mohamed AsmerDeveloper 
daigoor@gmail.com 
www.daigoor.com@daigoor 
(+970) 598 917 280
Developer life ! 
the more pressure you feel, the fewer tests you writes. The fewer tests you write, the less productive you are and the less stable your code becomes. The less productive and accurate you are, the more pressure you feel.
Def. 
Wikipedia :unit testingis asoftware testingmethod by which individual units ofsource code 
In a simple way … validate each and every unit of the software perform as designed.
Def. Cont. 
A Unit is the smallest part of code 
›{function or procedure} 
›The smallest part that can be compiled by it self.
Ex 
public int stringToInt( String str ){ return Integer.parseInt(str); } 
stringToInt(null); 
stringToInt(“TEXT”) 
stringToInt(“1234567890987654321”)
Why ? 
Without it defects will appear at the end of the cycle! 
Trace bugs is time consuming , hard and complex 
Check new feature if they are feasible 
Check input and output values 
Correct outputs fast
Why ? -_- 
Reduce future cost ! 
Faster development 
Better design 
Faster debugging 
Excellent regression tool + 
it provide sort of documentation
Categories 
White-Box : function exe and checked 
Black-Box : input/output & app-interface
Types 
Positive test (end user testing) 
›Valid parameter 
Negative test 
›Not valid parameter
Ex 
public int stringToInt( String str ){ return Integer.parseInt(str); } 
stringToInt(null)//N 
stringToInt(“TEXT”)//N 
stringToInt(“1234567890987654321”)//N 
stringToInt(“1234”)//P
When to write the test? 
“Whenever you are tempted to type something into a print statement or a debugger expression, write it as a test instead.”...
story 
:$
Traditional Testing Strategies 
Print Statements 
Use of Debugger 
Debugger Expressions
Ex. 
... List<?> getVersionsForProductId(Long id){ … return List<?> } 
The Tests That AreNeeded 
Startingfromtheeasiesttothehardest: 
Ifthere’snoproductforthatid,thenanexceptionisthrown. 
Ifthere’snoversionsforavalidproductid,thenanemptylistisreturned. 
Ifthereareversionsforaproductid,thenanon-emptylistofalltheversionsisreturned.
Live Show 
Eclipse 
IntelliJ Idea
Keep Unit tests small and fast We should run them after each checkin 
keep them UN-dependent They should not depend on each other 
They should be simple 
Fix error immediately
Its all about unit There should be a test class per each class .. no more no less ! You should not right an application to test another application. 
Start with the simple test 
Code convention

More Related Content

What's hot

03 conditions loops
03   conditions loops03   conditions loops
03 conditions loops
Manzoor ALam
 
Introduction to unit testing in python
Introduction to unit testing in pythonIntroduction to unit testing in python
Introduction to unit testing in python
Anirudh
 
Test Driven Development With Python
Test Driven Development With PythonTest Driven Development With Python
Test Driven Development With Python
Siddhi
 
Using Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingUsing Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingMike Clement
 
Python Testing Fundamentals
Python Testing FundamentalsPython Testing Fundamentals
Python Testing Fundamentals
cbcunc
 
Google mock for dummies
Google mock for dummiesGoogle mock for dummies
Google mock for dummies
Harry Potter
 
Unit testing 101
Unit testing 101Unit testing 101
Unit testing 101
Erkin Ünlü
 
Control statements in java
Control statements in javaControl statements in java
Control statements in java
Madishetty Prathibha
 
Java Control Statements
Java Control StatementsJava Control Statements
Java Control Statements
KadarkaraiSelvam
 
Golang dot-testing-lite
Golang dot-testing-liteGolang dot-testing-lite
Golang dot-testing-lite
Richárd Kovács
 
White Box Testing (Introduction to)
White Box Testing (Introduction to)White Box Testing (Introduction to)
White Box Testing (Introduction to)
Henry Muccini
 
Template Method Design Pattern
Template Method Design PatternTemplate Method Design Pattern
Template Method Design Pattern
Srikanth Shreenivas
 
Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...
Timo Stollenwerk
 
JUnit 4 Can it still teach us something? - Andrzej Jóźwiak - Kariera IT Łodź ...
JUnit 4 Can it still teach us something? - Andrzej Jóźwiak - Kariera IT Łodź ...JUnit 4 Can it still teach us something? - Andrzej Jóźwiak - Kariera IT Łodź ...
JUnit 4 Can it still teach us something? - Andrzej Jóźwiak - Kariera IT Łodź ...
Andrzej Jóźwiak
 
Control structures in java
Control structures in javaControl structures in java
Control structures in java
VINOTH R
 
Exception handling in python
Exception handling in pythonException handling in python
Unit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran JanardhanaUnit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran Janardhana
Ravikiran J
 

What's hot (19)

07 flow control
07   flow control07   flow control
07 flow control
 
03 conditions loops
03   conditions loops03   conditions loops
03 conditions loops
 
Introduction to unit testing in python
Introduction to unit testing in pythonIntroduction to unit testing in python
Introduction to unit testing in python
 
Md04 flow control
Md04 flow controlMd04 flow control
Md04 flow control
 
Test Driven Development With Python
Test Driven Development With PythonTest Driven Development With Python
Test Driven Development With Python
 
Using Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingUsing Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit Testing
 
Python Testing Fundamentals
Python Testing FundamentalsPython Testing Fundamentals
Python Testing Fundamentals
 
Google mock for dummies
Google mock for dummiesGoogle mock for dummies
Google mock for dummies
 
Unit testing 101
Unit testing 101Unit testing 101
Unit testing 101
 
Control statements in java
Control statements in javaControl statements in java
Control statements in java
 
Java Control Statements
Java Control StatementsJava Control Statements
Java Control Statements
 
Golang dot-testing-lite
Golang dot-testing-liteGolang dot-testing-lite
Golang dot-testing-lite
 
White Box Testing (Introduction to)
White Box Testing (Introduction to)White Box Testing (Introduction to)
White Box Testing (Introduction to)
 
Template Method Design Pattern
Template Method Design PatternTemplate Method Design Pattern
Template Method Design Pattern
 
Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...
 
JUnit 4 Can it still teach us something? - Andrzej Jóźwiak - Kariera IT Łodź ...
JUnit 4 Can it still teach us something? - Andrzej Jóźwiak - Kariera IT Łodź ...JUnit 4 Can it still teach us something? - Andrzej Jóźwiak - Kariera IT Łodź ...
JUnit 4 Can it still teach us something? - Andrzej Jóźwiak - Kariera IT Łodź ...
 
Control structures in java
Control structures in javaControl structures in java
Control structures in java
 
Exception handling in python
Exception handling in pythonException handling in python
Exception handling in python
 
Unit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran JanardhanaUnit Testing with JUnit4 by Ravikiran Janardhana
Unit Testing with JUnit4 by Ravikiran Janardhana
 

Viewers also liked

Rotation & Revolution
Rotation & RevolutionRotation & Revolution
Rotation & Revolutionkmacdevitt
 
Andrea Bocelli..
Andrea Bocelli..Andrea Bocelli..
Andrea Bocelli..RoThia
 
Aula revoluo russa editora moderna
Aula revoluo russa editora modernaAula revoluo russa editora moderna
Aula revoluo russa editora modernasesi8
 
Pedacinhos da minha vida
Pedacinhos da minha vidaPedacinhos da minha vida
Pedacinhos da minha vidaluciana2808
 
Mrs Jackson's Sight Words for Thanksgiving
Mrs Jackson's Sight Words for ThanksgivingMrs Jackson's Sight Words for Thanksgiving
Mrs Jackson's Sight Words for ThanksgivingLee Kraus
 
Little Ann Predicament
Little Ann PredicamentLittle Ann Predicament
Little Ann Predicamentjeanslover1225
 
S1170009 final-stage5
S1170009 final-stage5S1170009 final-stage5
S1170009 final-stage5
s1170009
 
Assis, m tu, só tu, puro amor
Assis, m   tu, só tu, puro amorAssis, m   tu, só tu, puro amor
Assis, m tu, só tu, puro amorNicolas Pelicioni
 
Decreto n° 3994-A
Decreto n° 3994-ADecreto n° 3994-A
Decreto n° 3994-A
Adriano Peres
 
O Presente
O PresenteO Presente
O Presente
Donizete Soares
 
My Fake Grandma Rocks
My Fake Grandma RocksMy Fake Grandma Rocks
My Fake Grandma Rocksnzyvonne
 
Portifolio 2
Portifolio 2Portifolio 2
Portifolio 2
ongplay
 
Optimal regulatory regime and competition
Optimal regulatory regime and competitionOptimal regulatory regime and competition
Optimal regulatory regime and competition
anucrawfordphd
 
2014 09-04 - ler aprender gn 3 ceb - vencedor - ups - beatriz duarte 7 - 8b ...
2014 09-04 - ler aprender gn 3 ceb - vencedor - ups - beatriz duarte  7 - 8b ...2014 09-04 - ler aprender gn 3 ceb - vencedor - ups - beatriz duarte  7 - 8b ...
2014 09-04 - ler aprender gn 3 ceb - vencedor - ups - beatriz duarte 7 - 8b ...O Ciclista
 

Viewers also liked (20)

Rotation & Revolution
Rotation & RevolutionRotation & Revolution
Rotation & Revolution
 
Andrea Bocelli..
Andrea Bocelli..Andrea Bocelli..
Andrea Bocelli..
 
Aula revoluo russa editora moderna
Aula revoluo russa editora modernaAula revoluo russa editora moderna
Aula revoluo russa editora moderna
 
Pedacinhos da minha vida
Pedacinhos da minha vidaPedacinhos da minha vida
Pedacinhos da minha vida
 
Mrs Jackson's Sight Words for Thanksgiving
Mrs Jackson's Sight Words for ThanksgivingMrs Jackson's Sight Words for Thanksgiving
Mrs Jackson's Sight Words for Thanksgiving
 
Samba enredo
Samba enredoSamba enredo
Samba enredo
 
Little Ann Predicament
Little Ann PredicamentLittle Ann Predicament
Little Ann Predicament
 
S1170009 final-stage5
S1170009 final-stage5S1170009 final-stage5
S1170009 final-stage5
 
Voluntarios ceara
Voluntarios cearaVoluntarios ceara
Voluntarios ceara
 
Animais
AnimaisAnimais
Animais
 
Assis, m tu, só tu, puro amor
Assis, m   tu, só tu, puro amorAssis, m   tu, só tu, puro amor
Assis, m tu, só tu, puro amor
 
Decreto n° 3994-A
Decreto n° 3994-ADecreto n° 3994-A
Decreto n° 3994-A
 
O Presente
O PresenteO Presente
O Presente
 
Rádio
RádioRádio
Rádio
 
La biblia y la ciencia
La biblia y la cienciaLa biblia y la ciencia
La biblia y la ciencia
 
My Fake Grandma Rocks
My Fake Grandma RocksMy Fake Grandma Rocks
My Fake Grandma Rocks
 
Amor e luz
Amor e luzAmor e luz
Amor e luz
 
Portifolio 2
Portifolio 2Portifolio 2
Portifolio 2
 
Optimal regulatory regime and competition
Optimal regulatory regime and competitionOptimal regulatory regime and competition
Optimal regulatory regime and competition
 
2014 09-04 - ler aprender gn 3 ceb - vencedor - ups - beatriz duarte 7 - 8b ...
2014 09-04 - ler aprender gn 3 ceb - vencedor - ups - beatriz duarte  7 - 8b ...2014 09-04 - ler aprender gn 3 ceb - vencedor - ups - beatriz duarte  7 - 8b ...
2014 09-04 - ler aprender gn 3 ceb - vencedor - ups - beatriz duarte 7 - 8b ...
 

Similar to Unit testing

DSR Testing (Part 1)
DSR Testing (Part 1)DSR Testing (Part 1)
DSR Testing (Part 1)
Steve Upton
 
Software Testing for Data Scientists
Software Testing for Data ScientistsSoftware Testing for Data Scientists
Software Testing for Data Scientists
Ajay Ohri
 
maXbox Starter 36 Software Testing
maXbox Starter 36 Software TestingmaXbox Starter 36 Software Testing
maXbox Starter 36 Software Testing
Max Kleiner
 
Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Babul Mirdha
 
TDD reloaded - JUGTAA 24 Ottobre 2012
TDD reloaded - JUGTAA 24 Ottobre 2012TDD reloaded - JUGTAA 24 Ottobre 2012
TDD reloaded - JUGTAA 24 Ottobre 2012
Pietro Di Bello
 
Behaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About TestingBehaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About Testing
dn
 
Bdd and-testing
Bdd and-testingBdd and-testing
Bdd and-testing
malcolmt
 
[XCode] Automating UI Testing
[XCode] Automating UI Testing[XCode] Automating UI Testing
[XCode] Automating UI Testing
Phineas Huang
 
Unit Testing like a Pro - The Circle of Purity
Unit Testing like a Pro - The Circle of PurityUnit Testing like a Pro - The Circle of Purity
Unit Testing like a Pro - The Circle of Purity
Victor Rentea
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
guestc8093a6
 
Testing - Is This Even a Thing?
Testing - Is This Even a Thing?Testing - Is This Even a Thing?
Testing - Is This Even a Thing?
Nick George
 
Tdd in practice
Tdd in practiceTdd in practice
Tdd in practice
Andrew Meredith
 
C++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing FrameworkC++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing Framework
Humberto Marchezi
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testing
pleeps
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)
Gianluca Padovani
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
priya_trivedi
 
Why unit testingl
Why unit testinglWhy unit testingl
Why unit testingl
Priya Sharma
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
priya_trivedi
 
Mutation Testing: Testing your tests
Mutation Testing: Testing your testsMutation Testing: Testing your tests
Mutation Testing: Testing your tests
Stephen Leigh
 
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,..."Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...Vladimir Ivanov
 

Similar to Unit testing (20)

DSR Testing (Part 1)
DSR Testing (Part 1)DSR Testing (Part 1)
DSR Testing (Part 1)
 
Software Testing for Data Scientists
Software Testing for Data ScientistsSoftware Testing for Data Scientists
Software Testing for Data Scientists
 
maXbox Starter 36 Software Testing
maXbox Starter 36 Software TestingmaXbox Starter 36 Software Testing
maXbox Starter 36 Software Testing
 
Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)
 
TDD reloaded - JUGTAA 24 Ottobre 2012
TDD reloaded - JUGTAA 24 Ottobre 2012TDD reloaded - JUGTAA 24 Ottobre 2012
TDD reloaded - JUGTAA 24 Ottobre 2012
 
Behaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About TestingBehaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About Testing
 
Bdd and-testing
Bdd and-testingBdd and-testing
Bdd and-testing
 
[XCode] Automating UI Testing
[XCode] Automating UI Testing[XCode] Automating UI Testing
[XCode] Automating UI Testing
 
Unit Testing like a Pro - The Circle of Purity
Unit Testing like a Pro - The Circle of PurityUnit Testing like a Pro - The Circle of Purity
Unit Testing like a Pro - The Circle of Purity
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Testing - Is This Even a Thing?
Testing - Is This Even a Thing?Testing - Is This Even a Thing?
Testing - Is This Even a Thing?
 
Tdd in practice
Tdd in practiceTdd in practice
Tdd in practice
 
C++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing FrameworkC++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing Framework
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testing
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
 
Why unit testingl
Why unit testinglWhy unit testingl
Why unit testingl
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
 
Mutation Testing: Testing your tests
Mutation Testing: Testing your testsMutation Testing: Testing your tests
Mutation Testing: Testing your tests
 
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,..."Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
"Formal Verification in Java" by Shura Iline, Vladimir Ivanov @ JEEConf 2013,...
 

Recently uploaded

GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 

Recently uploaded (20)

GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 

Unit testing

  • 1. Unit Testing By Mohamad Asmar a.k.a DaiGooR
  • 2. Me! Mohamed AsmerDeveloper daigoor@gmail.com www.daigoor.com@daigoor (+970) 598 917 280
  • 3. Developer life ! the more pressure you feel, the fewer tests you writes. The fewer tests you write, the less productive you are and the less stable your code becomes. The less productive and accurate you are, the more pressure you feel.
  • 4. Def. Wikipedia :unit testingis asoftware testingmethod by which individual units ofsource code In a simple way … validate each and every unit of the software perform as designed.
  • 5. Def. Cont. A Unit is the smallest part of code ›{function or procedure} ›The smallest part that can be compiled by it self.
  • 6. Ex public int stringToInt( String str ){ return Integer.parseInt(str); } stringToInt(null); stringToInt(“TEXT”) stringToInt(“1234567890987654321”)
  • 7. Why ? Without it defects will appear at the end of the cycle! Trace bugs is time consuming , hard and complex Check new feature if they are feasible Check input and output values Correct outputs fast
  • 8. Why ? -_- Reduce future cost ! Faster development Better design Faster debugging Excellent regression tool + it provide sort of documentation
  • 9.
  • 10. Categories White-Box : function exe and checked Black-Box : input/output & app-interface
  • 11. Types Positive test (end user testing) ›Valid parameter Negative test ›Not valid parameter
  • 12. Ex public int stringToInt( String str ){ return Integer.parseInt(str); } stringToInt(null)//N stringToInt(“TEXT”)//N stringToInt(“1234567890987654321”)//N stringToInt(“1234”)//P
  • 13. When to write the test? “Whenever you are tempted to type something into a print statement or a debugger expression, write it as a test instead.”...
  • 15. Traditional Testing Strategies Print Statements Use of Debugger Debugger Expressions
  • 16. Ex. ... List<?> getVersionsForProductId(Long id){ … return List<?> } The Tests That AreNeeded Startingfromtheeasiesttothehardest: Ifthere’snoproductforthatid,thenanexceptionisthrown. Ifthere’snoversionsforavalidproductid,thenanemptylistisreturned. Ifthereareversionsforaproductid,thenanon-emptylistofalltheversionsisreturned.
  • 17. Live Show Eclipse IntelliJ Idea
  • 18. Keep Unit tests small and fast We should run them after each checkin keep them UN-dependent They should not depend on each other They should be simple Fix error immediately
  • 19. Its all about unit There should be a test class per each class .. no more no less ! You should not right an application to test another application. Start with the simple test Code convention