A Simple Intro To
quick
questions
to start!
had a client who
knew what he
needed?
question 1
been in a project
with no change in
requirements?
question 2
predicted every
problem 3 months
in advance?
question 3
Agile Context
of Testing
respond to change!
A
B
A
B
C
change
risk
reduce the risk!
reduce the risk!
use the
agile
iterative
cycle
reduce the risk!
test
continuously
fast feedback
know what works at
any given moment
Types of Tests
Functional Tests
Examples
Story Tests
Prototypes
Simulations
Unit Tests
Component Tests
Exploratoy Testing
Scenarios
Usability Testing
UAT
A/B
Performance & Load Testing
Security Testing
“ility Testing”
Automated
& Manual
Automated
Manual
Tools
Q2 Q3
Q1 Q4
Business Facing
Technology Facing
SupportingtheTeam
CritiqueProduct
Functional Tests
Examples
Story Tests
Prototypes
Simulations
Unit Tests
Component Tests
Exploratoy Testing
Scenarios
Usability Testing
UAT
A/B
Performance & Load Testing
Security Testing
“ility Testing”
Automated
& Manual
Automated
Manual
Tools
Q2 Q3
Q1 Q4
Business Facing
Technology Facing
SupportingtheTeam
CritiqueProduct
Coding
Unit Testing
Program Unit
Design
Physical Design
Logical Design
User
Requirements
Integration
Testing
System Testing
Acceptance
Testing
Verifies
Verifies
Verifies
Verifies
hard
expensive
slow
easy
cheap
fast
more
less
UI
Integration
Unit
What Is A
Unit Test?
Unit Tests
• Tests a single unit of code (typically a method)
• Tests the unit of code in ISOLATION
• Tests that the code behaves as expected
Unit Tests
• It’s still code
• Code that tests code
• Exercise SUT, check behaviour
• Concepts: Test Class, Test Method
Test Structure
ARRANGE ACT ASSERT
Test Structure
ARRANGE
ACT
ASSERT
Unit Tests
• Should be fast (< 10 ms)
• Should be consistent (same result always)
• Should run in memory (no db, file access)
• Should run in any order (no dependencies on other
tests)
Impacts
• Fast Feedback
• Cleaner design
• Code and componente decoupling
• Confidence
• Executable documentation, with usage samples
• Reduce regression
TDD vs.
Unit Testing
unit testing
is not
TDD
TDD
is
unit testing
(in a particular order)
TDD in
three
steps
TDD is
different approach
to coding
Demo
https://github.com/MiguelAlho/TddCalculator
References
Books
• Pragmatic Unit Testing In C# with Nunit
• Growing software guided by tests
• The art of unit Testing
• Testable Javascript
• Quality Code
• Xunit Patterns
Tdd01 a simple intro to tdd

Tdd01 a simple intro to tdd