SlideShare ist ein Scribd-Unternehmen logo
1 von 61
Assorted TDD tips
Wojciech Bulaty
March 2013
Wojtek Bulaty
4 years TDD
Pair programming
XP
7 things I wish somebody told me
when I was starting with TDD
My story – what I learned?
For beginners and strugglers
Scratch the surface today
TDD IS A TOOL
No 1
●
Cheap
●
Light
●
No electricity
●
Needs strong hands
●
Etc…
●
More expensive
●
Heavier
●
Needs electricity
●
No need for strong hands
●
Etc.…
Good tool? Bad tool?
Depends on the context (constraints)!
Want to use the “TDD” tool?
Think Constraints!
Time & budget
Skills
Long term/short term goals
Informed decisions means less
risky decisions
Less risky decisions means more
success and less failure
Tests are good! Tests are bad!
TDD is a tool
TDD IS A SKILL
No 2
Pain?
More problems than benefits
TDD was supposed to be fun!
TDD is a skill
Learn it!
Software developer
Java
OO
Multithreading
TDD
Pain?
You are doing it wrong!
TDD IS SOFTWARE DESIGN
No 3
Mocks
Focus on OO signals
SOLID
Acceptance tests
Less coupling
TDD as a design tool
Try it at home
Look at the differences
TDD design
Small feedback loop
TDD IS DOCUMENTATION
No. 4
Good documentation
●
Always up to date
●
Executable
●
Refactorable
●
OO
– SOLID
– DRY
– etc…
●
Text documents? Wiki? …?
Tests are like that!
Me likey!
Sky
Very good documentation
Sky documentation example
TimeWindowEnforcementTest.html
It is called Yatspec!
TimeWindowEnforcementTest.html
Tests document!
Remember about it
TDD FOCUS ON GOALS
No. 5
Start with goals
What do I really want to do?
When do I know I am done?
public class UserMailerTest {
@Test
public void notifiesSupportTeamWhenExceptionIsThrownWhenSendingMail() {
}
}
public class UserMailerTest {
@Test
public void notifiesSupportTeamWhenExceptionIsThrownWhenSendingMail() {
}
}
public class UserMailerTest {
@Test
public void notifiesSupportTeamWhenExceptionIsThrownWhenSendingMail() {
}
}
public class UserMailerTest {
@Test
public void notifiesSupportTeamWhenExceptionIsThrownWhenSendingMail() {
verify(supportTeam).reportException(exception);
}
}
public class UserMailerTest {
@Test
public void notifiesSupportTeamWhenExceptionIsThrownWhenSendingMail() {
userMailer.passwordChanged(username, email);
verify(supportTeam).reportException(exception);
}
}
public class UserMailerTest {
@Test
public void notifiesSupportTeamWhenExceptionIsThrownWhenSendingMail() {
doThrow(exception).when(javaMail).send(anyString(), eq(email));
userMailer.passwordChanged(username, email);
verify(supportTeam).reportException(exception);
}
}
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;
public class UserMailerTest {
private final SupportTeam supportTeam = mock(SupportTeam.class);
private final JavaMail javaMail = mock(JavaMail.class);
private final RuntimeException exception = new RuntimeException();
private final String username = "john";
private final String email = "john.tdd@gmail.com";
private final UserMailer userMailer = new UserMailer(supportTeam, javaMail);
@Test
public void notifiesSupportTeamWhenExceptionIsThrownWhenSendingMail() {
doThrow(exception).when(javaMail).send(anyString(), eq(email));
userMailer.passwordChanged(username, email);
verify(supportTeam).reportException(exception);
}
}
Shorter paths to your goals!
YAGNI
TESTS INCREASE COUPLING
No 6
Loose coupling?
Me likey!
Unit tests
Mocks? Implementation details!
Stubs & State? Still coupled to units!
Refactoring? Nein!
Good? Bad?
Remember about trade-offs!
Module tests
Less coupling than units
More test infrastructure
Refactoring? A bit?
Good? Bad?
Remember about trade-offs!
Acceptance tests
End to end tests
etc...
As little coupling as possible
Big testing infrastructure
Refactoring? No problems!
Modify prod code
How many tests fail?
Definition of coupling man!
Sky
Duplication in tests
Unmaintainable unit tests
Tests increase coupling?
Keep that in mind!
Remember about trade-offs!
PRACTICE KATA
No. 7
“Practice makes perfect”
Professionals practice
TDD Kata / TDD Toy
Code retreat
What I learned so far
●
TDD is a skill – learn it
●
TDD is a tool – know when to use it
●
TDD is software design - sometimes
●
TDD is documentation – very likely
●
TDD focus on goals – yep!
●
Tests increase coupling – seriously!
●
Practice Kata – No jokes here :/
Want moar?
●
Growing Object-Oriented Software Guided by Tests
●
Loads of other books – read them all
●
http://martinfowler.com/
●
http://test-driven-development.com
Feedback
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

UK star ultimate testing survival
UK star ultimate testing survivalUK star ultimate testing survival
UK star ultimate testing survivalViktor Slavchev
 
The Art of Questioning to improve Software Testing, Agile and Automating
The Art of Questioning to improve Software Testing, Agile and AutomatingThe Art of Questioning to improve Software Testing, Agile and Automating
The Art of Questioning to improve Software Testing, Agile and AutomatingAlan Richardson
 
Obejct Oriented SCM - OOSCM
Obejct Oriented SCM - OOSCMObejct Oriented SCM - OOSCM
Obejct Oriented SCM - OOSCMHernan Wilkinson
 
Demise of test scripts rise of test ideas
Demise of test scripts rise of test ideasDemise of test scripts rise of test ideas
Demise of test scripts rise of test ideasRichard Robinson
 
Confessions of an Accidental Security Tester
Confessions of an Accidental Security TesterConfessions of an Accidental Security Tester
Confessions of an Accidental Security TesterAlan Richardson
 
The Evil Tester's Guide to HTTP proxies Tutorial
The Evil Tester's Guide to HTTP proxies TutorialThe Evil Tester's Guide to HTTP proxies Tutorial
The Evil Tester's Guide to HTTP proxies TutorialAlan Richardson
 
Reliable tests with selenium web driver
Reliable tests with selenium web driverReliable tests with selenium web driver
Reliable tests with selenium web driverPawelPabich
 
Exceptions: Why, When, How and Where!
Exceptions: Why, When, How and Where!Exceptions: Why, When, How and Where!
Exceptions: Why, When, How and Where!Hernan Wilkinson
 
Lessons Learned When Automating
Lessons Learned When AutomatingLessons Learned When Automating
Lessons Learned When AutomatingAlan Richardson
 
Experiences with Semi-Scripted Exploratory Testing
Experiences with Semi-Scripted Exploratory TestingExperiences with Semi-Scripted Exploratory Testing
Experiences with Semi-Scripted Exploratory TestingSimon Morley
 
Lifelong Analysis Skills for Explorers and Process Junkies alike!
Lifelong Analysis Skills for Explorers and Process Junkies alike!Lifelong Analysis Skills for Explorers and Process Junkies alike!
Lifelong Analysis Skills for Explorers and Process Junkies alike!Simon Morley
 
Unit Test Lab - Why Write Unit Tests?
Unit Test Lab - Why Write Unit Tests?Unit Test Lab - Why Write Unit Tests?
Unit Test Lab - Why Write Unit Tests?Danny van Kasteel
 
TestWorksConf: Experience exploratory testing
TestWorksConf: Experience exploratory testingTestWorksConf: Experience exploratory testing
TestWorksConf: Experience exploratory testingMaaret Pyhäjärvi
 
Exploratory Testing Explained
Exploratory Testing ExplainedExploratory Testing Explained
Exploratory Testing ExplainedTechWell
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated TestsTrisha Gee
 
Technical Testing Webinar
Technical Testing WebinarTechnical Testing Webinar
Technical Testing WebinarAlan Richardson
 
Graham Thomas - Software Testing Secrets We Dare Not Tell - EuroSTAR 2013
Graham Thomas - Software Testing Secrets We Dare Not Tell - EuroSTAR 2013Graham Thomas - Software Testing Secrets We Dare Not Tell - EuroSTAR 2013
Graham Thomas - Software Testing Secrets We Dare Not Tell - EuroSTAR 2013TEST Huddle
 
Continuous Security Testing
Continuous Security TestingContinuous Security Testing
Continuous Security TestingSteven Mak
 
Adopting technical practices 2013
Adopting technical practices 2013Adopting technical practices 2013
Adopting technical practices 2013Steven Mak
 

Was ist angesagt? (20)

UK star ultimate testing survival
UK star ultimate testing survivalUK star ultimate testing survival
UK star ultimate testing survival
 
The Art of Questioning to improve Software Testing, Agile and Automating
The Art of Questioning to improve Software Testing, Agile and AutomatingThe Art of Questioning to improve Software Testing, Agile and Automating
The Art of Questioning to improve Software Testing, Agile and Automating
 
Obejct Oriented SCM - OOSCM
Obejct Oriented SCM - OOSCMObejct Oriented SCM - OOSCM
Obejct Oriented SCM - OOSCM
 
Demise of test scripts rise of test ideas
Demise of test scripts rise of test ideasDemise of test scripts rise of test ideas
Demise of test scripts rise of test ideas
 
Confessions of an Accidental Security Tester
Confessions of an Accidental Security TesterConfessions of an Accidental Security Tester
Confessions of an Accidental Security Tester
 
The Evil Tester's Guide to HTTP proxies Tutorial
The Evil Tester's Guide to HTTP proxies TutorialThe Evil Tester's Guide to HTTP proxies Tutorial
The Evil Tester's Guide to HTTP proxies Tutorial
 
Reliable tests with selenium web driver
Reliable tests with selenium web driverReliable tests with selenium web driver
Reliable tests with selenium web driver
 
Exceptions: Why, When, How and Where!
Exceptions: Why, When, How and Where!Exceptions: Why, When, How and Where!
Exceptions: Why, When, How and Where!
 
Lessons Learned When Automating
Lessons Learned When AutomatingLessons Learned When Automating
Lessons Learned When Automating
 
Experiences with Semi-Scripted Exploratory Testing
Experiences with Semi-Scripted Exploratory TestingExperiences with Semi-Scripted Exploratory Testing
Experiences with Semi-Scripted Exploratory Testing
 
Lifelong Analysis Skills for Explorers and Process Junkies alike!
Lifelong Analysis Skills for Explorers and Process Junkies alike!Lifelong Analysis Skills for Explorers and Process Junkies alike!
Lifelong Analysis Skills for Explorers and Process Junkies alike!
 
Agile test
Agile testAgile test
Agile test
 
Unit Test Lab - Why Write Unit Tests?
Unit Test Lab - Why Write Unit Tests?Unit Test Lab - Why Write Unit Tests?
Unit Test Lab - Why Write Unit Tests?
 
TestWorksConf: Experience exploratory testing
TestWorksConf: Experience exploratory testingTestWorksConf: Experience exploratory testing
TestWorksConf: Experience exploratory testing
 
Exploratory Testing Explained
Exploratory Testing ExplainedExploratory Testing Explained
Exploratory Testing Explained
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
 
Technical Testing Webinar
Technical Testing WebinarTechnical Testing Webinar
Technical Testing Webinar
 
Graham Thomas - Software Testing Secrets We Dare Not Tell - EuroSTAR 2013
Graham Thomas - Software Testing Secrets We Dare Not Tell - EuroSTAR 2013Graham Thomas - Software Testing Secrets We Dare Not Tell - EuroSTAR 2013
Graham Thomas - Software Testing Secrets We Dare Not Tell - EuroSTAR 2013
 
Continuous Security Testing
Continuous Security TestingContinuous Security Testing
Continuous Security Testing
 
Adopting technical practices 2013
Adopting technical practices 2013Adopting technical practices 2013
Adopting technical practices 2013
 

Ähnlich wie Assorted TDD tips

2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easierChristian Hujer
 
An insight to test driven development and unit testing
An insight to test driven development and unit testingAn insight to test driven development and unit testing
An insight to test driven development and unit testingDharmendra Prasad
 
Testing And Drupal
Testing And DrupalTesting And Drupal
Testing And DrupalPeter Arato
 
Developer Tests - Things to Know (Vilnius JUG)
Developer Tests - Things to Know (Vilnius JUG)Developer Tests - Things to Know (Vilnius JUG)
Developer Tests - Things to Know (Vilnius JUG)vilniusjug
 
Google test training
Google test trainingGoogle test training
Google test trainingThierry Gayet
 
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
 
Building unit tests correctly with visual studio 2013
Building unit tests correctly with visual studio 2013Building unit tests correctly with visual studio 2013
Building unit tests correctly with visual studio 2013Dror Helper
 
The Art of Unit Testing Feedback
The Art of Unit Testing FeedbackThe Art of Unit Testing Feedback
The Art of Unit Testing FeedbackDeon Huang
 
Some testing - Everything you should know about testing to go with @pedro_g_s...
Some testing - Everything you should know about testing to go with @pedro_g_s...Some testing - Everything you should know about testing to go with @pedro_g_s...
Some testing - Everything you should know about testing to go with @pedro_g_s...Sergio Arroyo
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019Paulo Clavijo
 
Art of unit testing: how to do it right
Art of unit testing: how to do it rightArt of unit testing: how to do it right
Art of unit testing: how to do it rightDmytro Patserkovskyi
 
EFE MatrixExternal Strategic FactorsWeight (0.0–1.0; 0=n.docx
EFE MatrixExternal Strategic FactorsWeight (0.0–1.0; 0=n.docxEFE MatrixExternal Strategic FactorsWeight (0.0–1.0; 0=n.docx
EFE MatrixExternal Strategic FactorsWeight (0.0–1.0; 0=n.docxgidmanmary
 
Unit Testing and TDD 2017
Unit Testing and TDD 2017Unit Testing and TDD 2017
Unit Testing and TDD 2017Xavi Hidalgo
 
7 stages of unit testing
7 stages of unit testing7 stages of unit testing
7 stages of unit testingJorge Ortiz
 
S313352 optimizing java device testing with automatic feature discovering
S313352 optimizing java device testing with automatic feature discoveringS313352 optimizing java device testing with automatic feature discovering
S313352 optimizing java device testing with automatic feature discoveringromanovfedor
 
Dev labs alliance top 20 testng interview questions for sdet
Dev labs alliance top 20 testng interview questions for sdetDev labs alliance top 20 testng interview questions for sdet
Dev labs alliance top 20 testng interview questions for sdetdevlabsalliance
 
Developer Test - Things to Know
Developer Test - Things to KnowDeveloper Test - Things to Know
Developer Test - Things to Knowvilniusjug
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development CodeOps Technologies LLP
 

Ähnlich wie Assorted TDD tips (20)

2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier
 
An insight to test driven development and unit testing
An insight to test driven development and unit testingAn insight to test driven development and unit testing
An insight to test driven development and unit testing
 
Testing And Drupal
Testing And DrupalTesting And Drupal
Testing And Drupal
 
Developer Tests - Things to Know (Vilnius JUG)
Developer Tests - Things to Know (Vilnius JUG)Developer Tests - Things to Know (Vilnius JUG)
Developer Tests - Things to Know (Vilnius JUG)
 
Google test training
Google test trainingGoogle test training
Google test training
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)
 
Building unit tests correctly with visual studio 2013
Building unit tests correctly with visual studio 2013Building unit tests correctly with visual studio 2013
Building unit tests correctly with visual studio 2013
 
The Art of Unit Testing Feedback
The Art of Unit Testing FeedbackThe Art of Unit Testing Feedback
The Art of Unit Testing Feedback
 
Some testing - Everything you should know about testing to go with @pedro_g_s...
Some testing - Everything you should know about testing to go with @pedro_g_s...Some testing - Everything you should know about testing to go with @pedro_g_s...
Some testing - Everything you should know about testing to go with @pedro_g_s...
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019
 
Art of unit testing: how to do it right
Art of unit testing: how to do it rightArt of unit testing: how to do it right
Art of unit testing: how to do it right
 
EFE MatrixExternal Strategic FactorsWeight (0.0–1.0; 0=n.docx
EFE MatrixExternal Strategic FactorsWeight (0.0–1.0; 0=n.docxEFE MatrixExternal Strategic FactorsWeight (0.0–1.0; 0=n.docx
EFE MatrixExternal Strategic FactorsWeight (0.0–1.0; 0=n.docx
 
Presentation Unit Testing process
Presentation Unit Testing processPresentation Unit Testing process
Presentation Unit Testing process
 
Unit Testing and TDD 2017
Unit Testing and TDD 2017Unit Testing and TDD 2017
Unit Testing and TDD 2017
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
7 stages of unit testing
7 stages of unit testing7 stages of unit testing
7 stages of unit testing
 
S313352 optimizing java device testing with automatic feature discovering
S313352 optimizing java device testing with automatic feature discoveringS313352 optimizing java device testing with automatic feature discovering
S313352 optimizing java device testing with automatic feature discovering
 
Dev labs alliance top 20 testng interview questions for sdet
Dev labs alliance top 20 testng interview questions for sdetDev labs alliance top 20 testng interview questions for sdet
Dev labs alliance top 20 testng interview questions for sdet
 
Developer Test - Things to Know
Developer Test - Things to KnowDeveloper Test - Things to Know
Developer Test - Things to Know
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development
 

Kürzlich hochgeladen

Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Kürzlich hochgeladen (20)

Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Assorted TDD tips

Hinweis der Redaktion

  1. Starting with a bit information on me. My name is Wojtek Bulaty. I recently joined Equity Derivatives IT department as a Java Developer. I will address your questions at the end of presentation.
  2. I will just scratch the surface today. If you want to go deeper I will recommend some books and websites at the end fop the presentation.
  3. The first thing I would like you understand is that TDD is just another tool. Let us start with a real world example.
  4. I need to screw some screws. How do we do that?
  5. I can use a normal screw driver or an electric screw driver . Both of them do the same thing. Which is one better ? I would say it depends on the context . Some call is “constraints”.
  6. What if I ordered a small shelf from IKEA. Which tool should I use? In my opinion the normal screw driver seems like a good fit.
  7. What if I ordered 10 pieces of furniture that need assembling. I would probably choose the electric one.
  8. What if there is no electic ity where I work? In that case the electric one probably is out of the question.
  9. So, which tool sis the good tool, and which is the bad one? It all depends on the context.
  10. Jakies wykresy tutaj? Time and budget?
  11. For example: trading time for long term maintainable code. Do I want to spend the time now and do TDD and end up with maintainable code or shall I just hack some shell scripts and thin k about maintainability later? For example: you are very likely to spend more time on tests than on production code when you are doing TDD. Can you afford that? Or may be you should ask yourself: can I afford not doing that? I hear people talking here and there, tests are good an others tests are bad. I wo u ld say they are not good nor bad . They are just a too l . You need to know when and how to use it. TODO: troche obrazkow tutuaj zamiast tego tekstu
  12. The second thing I would like you to think about is: TDD is a skill.
  13. 4 years ago I used to work with a team in Poland in Krakow. They used to say they did TDD. When I joined them there was 30% code coverage by tests. Half of the team wrote tests, the other half did not. Most of the half that did write the tests did not start with the tests though. They started with production code and then wrote tests. This resulted in mixed feelings about the whole TDD approach. The team did not like the tests. They were hard to read, write and update. They did not seem to catch any bugs that went to production. Those tests were just pure pain. After couple of months working on a the project I attended an internal training on TDD. It was eye opening. The guys there showed me the most common errors we made in our tests in the new project. I started to understand why nobody liked the tests we had. We were not good at writing good tests, that was it! I read couple of books on TDD. I started following peoples blogs. Those guys from the training joined out team as well, so I had a change to do some pairing with them. That was the time I understood that TDD is not about writing some code that will exercise your production code and do some assertions on the results. It is about producing executable documentation, maintainable test code, etc., etc., etc. I found that it takes time to learn the basics of TDD same as it did take time to learn to basics of Object Oriented programming. So, I would like you to consider what skills do you have as a software developer. I call myself a Java developer. I know a bit about Oracle, OOP, DDD, Multithreading. I know couple of more things but I would not put them on my CV. One of the things I do put though is TDD.
  14. We did not know how to do TDD. We did not know how to write tests. TDD is not just about whiting some code to exercise the production code. There is a lot of rules you should follow: Keep tests simple – our were not Each test just one piece of functionality …
  15. Example ?
  16. Example?
  17. When I joined the Network Model Infrastructure team at Sky I was supposed to work on 9 applications. It was a completely new domain for me. Talking with a protocol called SNMP to all that expensive broadband devices in exchanges. The lifecycle of a broadband customer at Sky. For example, what happens when somebody signs up for Sky. There some manual process like a guys walking in the exchange and plugging in some cables, that is modelled in a database. There is some configuration that needs to be done automatically on a “special” STINGER device. Etc. The domain was huge. What was my typical way of learning about an area of the domain? I looked at the acceptance test suits for the systems. For example if I wanted to know how do we configure a STINGER device and what messages do we send to other Sky systems when a customer joins Sky I just looked at test called “provision customer”. All information I needed usually was in there. So even if all other members of the team were on holidays I could still know more or less how the systems I support work. This is different to standard Word documentation that it is always up to date. Also, lower level tests documented more fine grained functionalities. There was a lot of unit tests that documented why and how exactly the communication with an ISAM broadband device works in scenarios like network errors or timeouts on the device side.
  18. Add an image demonstrating coupling with tests
  19. You can practice TDD with code KATAs. For example, I want to make a comparison between my cooking, and my TDD. I started learning how to cook about the same time when I started learning TDD. Let us discuss the leek soup I made loads of times :) The first time I made it I did not look at any recipes, I just followed my heart. It was awesome, tasted very good! The second time I made it, it was almost impossible to eat and I was wondering what happened. It was horrible. But I did everything almost exactly the same? Then I started looking into the recipes and found that some things should be added to a leek soup and some not. Some spices are needed in a leek soup, some should be avoided. The ratio of water, leeks, butter was also a very important thing. Slight variations in those thing could make the soup very good or very bad. After following the recipe several times for couple of different soups I started to see the patterns. Even though I have still a lot to learn, I know a bit more how to make a good soup without a recipe. I just can see if it is going to be the kind of soup I like just by looking at the ingredients! It more or less looks like I am in the third stage of competence when it comes to preparing a leek soup ;) haha How did I get there? Using the tool called “recipes”! How can you get to the next level of competence in software development? Using the tools and practicing as well. The best tool I have found so far is called TDD! Once you are competent you probably will not need the tool , you will just “feel” when something is good or not, you might find that it acctualy slows you down. But for beginners, TDD is in my opinion a very good way of working. Following the very simple rules of TDD allows you to unconsciously produce code that is more likely of high quality and compliant with the harder to understand rules of high cohesion and loose coupling. Following the very simple “red-green-refactor” and “test should be simple” rules is more likely to produce code that is compliant with the harder to understand (or easier misinterpret) SOLID rules , etc.
  20. There is a lot of things I learned about TDD, acceptance tests, test infrastructure etc. outside my work hours. I did that by solving different kinds of programming problems by doing TDD at home. For example, a lot of times during recruitment processes I got unattended programming tests. Most of them were not even intended to be solved by starting with tests. But I did that and learned a lot. How can you get to the next level of competence in software development? Using the tools and practicing as well. The best tool I have found so far is called TDD! Once you are competent you probably will not need the tool , you will just “feel” when something is good or not, you might find that it actually slows you down. But for beginners, TDD is in my opinion a very good way of working. Following the very simple rules of TDD allows you to unconsciously produce code that is more likely of high quality and compliant with the harder to understand rules of high cohesion and loose coupling. Following the very simple “red-green-refactor” and “test should be simple” rules is more likely to produce code that is compliant with the harder to understand (or easier misinterpret) SOLID rules , etc.