Test Driven Development - TDD & ATDD
Test Driven Development - TDD & ATDD
Test Driven Development - TDD & ATDD
Development Approaches
Ad
hoc testing Pseudo-code programming process (PPP) Model Driven Development (MDD) Test Driven Development (TDD) Behaviour Driven Development (BDD) Domain Driven Design (DDD) Etc
Ad hoc testing
An informal and non-methodical approach to perform testing. Only conducted once unless a defect is found. Performed without a plan of action and any actions taken are not typically documented. Testers may not have detailed knowledge of product requirements. Referred to as random testing and monkey testing.
writing a routine, you describe what that routine should do in plain English. when you're satisfied that you understand what the routine should do, you turn that pseudo-code into comments that describe the code you're about to write.
Then,
Software
engineering approach that uses model to create a product. provides a set of guidelines for the structuring of specifications, which are expressed as models.
It
TDD = Test First Development + Refactoring Testing a method in a class you are writing, while you are writing that class. Better code, In less time, With no defects.
New USER STORY = New CODE Writing TESTS BEFORE writing the CODE Which means that we write the test for code we wich had. code we wish we had CWWWH 6
An evolution of TDD with a better syntax and mechanics for expressing the desired functionality with tests/specifications. Testing a scenario requirement rather than an atomic
Write scenarios in a format that can be run against the software to ascertain whether the software behaves as desired.
Eric Evans (EE): Fundamentally, DDD is the principle that we should be focusing on the deep issues of the domain our users are engaged in, that the best part of our minds should be devoted to understanding that domain, and collaborating with experts in that domain to wrestle it into a conceptual form that we can use to build powerful, flexible software.
TDD
Test Driven Development
Debug VS Test
Edsger Dijkstra
The tests do not demonstrate the absence of errors in software, only their presence
Brian Kernighan
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it
11
TDD
12
TDD CYCLE
13
TDD CYCLE
Test-Code-Refactor The
term refactoring is used to better communicate that the last step is about transforming the current design toward a better design.
Martin Fowler a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior
14
Fast:
Run tests or subsets of these tests quickly (we run them all the time) Independent: No test is dependent to another test, the test execution order is irrelevant Repeatable: Executed N times, same result Self-checking: A test should automatically detect whether he succeeded or not Timely: written at the same time as the code they are testing (with TDD they are written in first!)
15
BENEFITS
TDD shortens the programming feedback loop TDD provides detailed specification (tests) TDD promotes the development of high-quality code TDD provides concrete evidence that your software works TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable TDD supports evolutionary development Etc. .
16
TDD is a technique for improving the softwares internal quality Acceptance TDD helps us keep our products external quality on track by giving it the correct features and functionality. Then, we need to learn how to build the thing right - TDD. Also, we need to learn how to build the right thing - ATDD.
17
18
WORKSHOP
#!%...SPEC #
itShouldStartWhenKeyIsTurnedRight.
itShouldStopWhenKeyIsTurnedLeft.
itShouldThrowAnCouldNotStartExceptionWhen
WrongArgumentIsGiven.
itShouldSendSMSNotificationWhenWrongArgu
mentIsGiven.
20
21
QUESTIONS?