SlideShare une entreprise Scribd logo
1  sur  28
TDD – from dreams to reality

© 2013 Tieto Corporation

Saulius Narkevičius. Viačeslav Pozdniakov.
Viačeslav

Saulius

Programming architect

24 hours developer

(~ 23 years of programing)

(~ 9 years of programing)

University lector

University lector

Assembler, …, Java, ...

Scala, Haskell, Java, ...

Desktop / Web

Desktop / Web

UI / Middleware / Database

Databases / Middleware

Waterfall / Agile / Whatever

Agile / Whatever

© 2013 Tieto Corporation
Three TDD steps

© 2013 Tieto Corporation

1. Failing test

2. Production
code

3. Refactor
Drives simple
code design
Safety net for
refactoring

TDD dream

Fast
feedback

Keeps
developers head
“empty” –
everything is in
code
© 2013 Tieto Corporation

Documentation
Super feature request:

© 2013 Tieto Corporation

“Calculate average of two
integer values”
Java solution 20 seconds later

© 2013 Tieto Corporation

int averageOf(int a, int b) {
return (a + b) / 2;
}
Does not compile –
No averageOf()
exists yet!

1. Red – write a failing test

© 2013 Tieto Corporation

@Test public void smokeTestAverage() {
assertThat(averageOf(2, 4), is(3));
}
Test passes
successfully

2. Green – just enough production code
@Test public void smokeTestAverage() {
assertThat(averageOf(2, 4), is(3));
}

© 2013 Tieto Corporation

int averageOf(int a, int b) {
return 3;
}
Nothing to
refactor yet

3. Refactor – make code cleaner
@Test public void smokeTestAverage() {
assertThat(averageOf(2, 4), is(3));
}

© 2013 Tieto Corporation

int averageOf(int a, int b) {
return 3;
}
Hmm, code is
really dumb…

Repeat: red, green, refactor
@Test public void smokeTestAverage() {
assertThat(averageOf(2, 4), is(3));
assertThat(averageOf(10, 20), is(15));
}

© 2013 Tieto Corporation

int averageOf(int a, int b) {
return (a == 10) ? 15 : 3;
}
Done!!!
Took longer with
tests :(

Let’s triangulate
@Test public void smokeTestAverage() {
assertThat(averageOf(2, 4), is(3));
assertThat(averageOf(10, 20), is(15));
assertThat(averageOf(-8, -16), is(-12));
}

© 2013 Tieto Corporation

int averageOf(int a, int b) {
return (a + b) / 2;
}
FAILED: Expected
2147483647 but
was -1

Edge cases
@Test public void edgeCasesForAverage() {
assertThat(averageOf(MAX, MAX), is(MAX));
assertThat(averageOf(MIN, MIN), is(MIN));
}

© 2013 Tieto Corporation

int averageOf(int a, int b) {
return (a + b) / 2;
}
Tests pass
successfully

Avoid overflow by using subtraction

© 2013 Tieto Corporation

@Test public void edgeCasesForAverage() {
assertThat(averageOf(MAX, MAX), is(MAX));
assertThat(averageOf(MIN, MIN), is(MIN));
}

int averageOf(int a, int b) {
int high = (a > b ? a : b);
int low = (a > b ? b : a);
return low + ((high - low) / 2);
}
FAILED:
Expected 0 but was
-2147483648

One more edge case

© 2013 Tieto Corporation

@Test public void edgeCasesForAverage() {
assertThat(averageOf(MAX, MAX), is(MAX));
assertThat(averageOf(MIN, MIN), is(MIN));
assertThat(averageOf(MIN, MAX), is(0));
}
int averageOf(int a, int b) {
int high = (a > b ? a : b);
int low = (a > b ? b : a);
return low + ((high - low) / 2);
}
When TDD shines
→ Clear requirements
→ Requirements do not change every hour
→ Sample tests are in place
→ Test execution is fast and one click away

→ Testing environment similar to production.

© 2013 Tieto Corporation
→ What to test?
→ Building data sets for tests

TDD in the
real world

→ Sample tests to start from
→ Legacy code may not be testable
→ What not to test?

© 2013 Tieto Corporation
“What to test?” is a wrong question
→ We are not testing but specifying sample usage scenarios
→ What do you want to specify / describe?
→ Testing frameworks speak “Specs”:
•

RSpec, Cucumber, Jasmine, Concordion, ...

→ TDD thought leaders done this years ago:
•

Dan North, Dave Astels, Robert C Martin (a.k.a. Uncle Bob), ...

→ Naming is everything (see: Specification by Example)

© 2013 Tieto Corporation
Sample test
@Test public void testCreatBookWithFullData() {
tester.login();
tester.startPage(BookEditPage.class);
FormTester formTester = tester.newFormTester("newBookForm");
formTester.setValue("main.container:title", “Some book title");
formTester.setValue("main.container:author", “Some author");
formTester.setValue("main.container:year", "1999");
formTester.setValue("main.container:publisherPageUrl", "www.newBook.lt");
formTester.setValue("main.container:pages", "222");
formTester.setValue("main.container:publisherName", “Some publisher");
formTester.setValue("main.container:series", “Very interesting series");
formTester.setValue("main.container:originalName", “some original name");
formTester.submit("submit");
tester.assertRenderedPage(BookPage.class);
tester.assertLabel("title", " Some book title");
tester.assertLabel("authorPanel:authors:0:author.link:author", "Some author");
tester.assertContains("some original name");
tester.assertLabel("years.link:year", "1999");
tester.assertLabel("publisher.link:publisher.name", "Some publisher");
tester.assertLabel("pages", "222");
© 2013 Tieto Corporation

}
Same test as spec
public void creating_new_book_scenario() {
givenCurrentUserIsAnAdministrator();
Book newBook = createNewBook();
show(BookEditPage.class);
fillFormFieldsWith(newBook);
submitForm();
expectCurrentPageIs(BookPage.class);
expectCurrentPageDisplaysAttributesOf(newBook);

© 2013 Tieto Corporation

}
Data sets for specs
// create or load from test DB

© 2013 Tieto Corporation

interface TypicalUsers {
User admin();
User guest();
User reviewer();
User author();
}
interface TypicalBooks {
Book basicBook();
Book bookWithThreeAuthors();
Book bookWithReview();
}
Sample spec for persistence

© 2013 Tieto Corporation

@Test public void orm_mappings_are_ok () {
loadAndPrintSomeEntitiesOf(Book.class);
}
Sample spec for UI

© 2013 Tieto Corporation

@Test public void renders_successfully() {
new WicketTester().startPage(NewClientPage.class);
}
Sample spec for business logic (WS)

© 2013 Tieto Corporation

@Test public void extending_book_loan() {
process(requestToBookLoanHandler(”extend_loan_request.xml"));
expectResponse(”loan_approved_response.xml");
}
Writing testable code
Is writing tests easy?
Yes, it is.

The art is in writing testable production code!

→ See short guide: “Writing Testable Code”

© 2013 Tieto Corporation
What not to specify:
technical viewpoint
→ Getters, setters and member variables
→ One line functions
→ GUI – make as thin and dumb as possible
→ Frameworks – things you do not control
→ Things which are hard to code - by trial and error.

© 2013 Tieto Corporation
What not to specify:
process viewpoint
→ Accelerated Agile – buzzword from Dan North
→ Some ingredients of accelerated agile:
•
•
•
•

developers become domain experts
short iterations (days, hours) – less chance for bugs
deliver as soon as possible – even without specs
discover knowledge from real usage

→ Write specs for code which survived real usage

→ Works for some projects

© 2013 Tieto Corporation
Know what
to specify

Think
“specs”
not “tests”

© 2013 Tieto Corporation

Use TDD
wisely

Know what
not to
specify

TDD:
from DREAMS to
Simple smoke
REALITY

Simplify writing
specs by “Writing
Testable Code”

specs are a
good investment

Real specs
come from
real usage
© 2013 Tieto Corporation

Questions?

Contenu connexe

Tendances

A Brief Introduction To Reactive Extensions
A Brief Introduction To Reactive ExtensionsA Brief Introduction To Reactive Extensions
A Brief Introduction To Reactive ExtensionsJames World
 
Building responsive application with Rx - confoo - tamir dresher
Building responsive application with Rx - confoo - tamir dresherBuilding responsive application with Rx - confoo - tamir dresher
Building responsive application with Rx - confoo - tamir dresherTamir Dresher
 
Azure SQL Database - Connectivity Best Practices
Azure SQL Database - Connectivity Best PracticesAzure SQL Database - Connectivity Best Practices
Azure SQL Database - Connectivity Best PracticesJose Manuel Jurado Diaz
 
Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012Sandeep Joshi
 
Understanding reactive programming with microsoft reactive extensions
Understanding reactive programming  with microsoft reactive extensionsUnderstanding reactive programming  with microsoft reactive extensions
Understanding reactive programming with microsoft reactive extensionsOleksandr Zhevzhyk
 
利用Init connect做mysql clients stat 用户审计
 利用Init connect做mysql clients stat 用户审计 利用Init connect做mysql clients stat 用户审计
利用Init connect做mysql clients stat 用户审计Dehua Yang
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsKonrad Malawski
 
MongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-esMongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-esMongoDB
 
Improving android experience for both users and developers
Improving android experience for both users and developersImproving android experience for both users and developers
Improving android experience for both users and developersPavel Lahoda
 
Droidcon2013 android experience lahoda
Droidcon2013 android experience lahodaDroidcon2013 android experience lahoda
Droidcon2013 android experience lahodaDroidcon Berlin
 
End to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaEnd to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaBabacar NIANG
 
Mastering Spring Boot's Actuator with Madhura Bhave
Mastering Spring Boot's Actuator with Madhura BhaveMastering Spring Boot's Actuator with Madhura Bhave
Mastering Spring Boot's Actuator with Madhura BhaveVMware Tanzu
 
apidays LIVE Australia 2020 - Building distributed systems on the shoulders o...
apidays LIVE Australia 2020 - Building distributed systems on the shoulders o...apidays LIVE Australia 2020 - Building distributed systems on the shoulders o...
apidays LIVE Australia 2020 - Building distributed systems on the shoulders o...apidays
 
Improved alerting with Prometheus and Alertmanager
Improved alerting with Prometheus and AlertmanagerImproved alerting with Prometheus and Alertmanager
Improved alerting with Prometheus and AlertmanagerJulien Pivotto
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for AndroidTomáš Kypta
 

Tendances (20)

A Brief Introduction To Reactive Extensions
A Brief Introduction To Reactive ExtensionsA Brief Introduction To Reactive Extensions
A Brief Introduction To Reactive Extensions
 
Building responsive application with Rx - confoo - tamir dresher
Building responsive application with Rx - confoo - tamir dresherBuilding responsive application with Rx - confoo - tamir dresher
Building responsive application with Rx - confoo - tamir dresher
 
Angular mix chrisnoring
Angular mix chrisnoringAngular mix chrisnoring
Angular mix chrisnoring
 
Typescript barcelona
Typescript barcelonaTypescript barcelona
Typescript barcelona
 
Azure SQL Database - Connectivity Best Practices
Azure SQL Database - Connectivity Best PracticesAzure SQL Database - Connectivity Best Practices
Azure SQL Database - Connectivity Best Practices
 
Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012
 
Angular2 rxjs
Angular2 rxjsAngular2 rxjs
Angular2 rxjs
 
Rxjs marble-testing
Rxjs marble-testingRxjs marble-testing
Rxjs marble-testing
 
Understanding reactive programming with microsoft reactive extensions
Understanding reactive programming  with microsoft reactive extensionsUnderstanding reactive programming  with microsoft reactive extensions
Understanding reactive programming with microsoft reactive extensions
 
利用Init connect做mysql clients stat 用户审计
 利用Init connect做mysql clients stat 用户审计 利用Init connect做mysql clients stat 用户审计
利用Init connect做mysql clients stat 用户审计
 
JavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good PartsJavaOne 2013: Java 8 - The Good Parts
JavaOne 2013: Java 8 - The Good Parts
 
MongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-esMongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-es
 
Improving android experience for both users and developers
Improving android experience for both users and developersImproving android experience for both users and developers
Improving android experience for both users and developers
 
Droidcon2013 android experience lahoda
Droidcon2013 android experience lahodaDroidcon2013 android experience lahoda
Droidcon2013 android experience lahoda
 
End to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaEnd to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux Saga
 
Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発
 
Mastering Spring Boot's Actuator with Madhura Bhave
Mastering Spring Boot's Actuator with Madhura BhaveMastering Spring Boot's Actuator with Madhura Bhave
Mastering Spring Boot's Actuator with Madhura Bhave
 
apidays LIVE Australia 2020 - Building distributed systems on the shoulders o...
apidays LIVE Australia 2020 - Building distributed systems on the shoulders o...apidays LIVE Australia 2020 - Building distributed systems on the shoulders o...
apidays LIVE Australia 2020 - Building distributed systems on the shoulders o...
 
Improved alerting with Prometheus and Alertmanager
Improved alerting with Prometheus and AlertmanagerImproved alerting with Prometheus and Alertmanager
Improved alerting with Prometheus and Alertmanager
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
 

En vedette

Can ho quan thu duc gia 12,6trieu.m2, dang nhan dat cho.
Can ho quan thu duc gia 12,6trieu.m2, dang nhan dat cho.Can ho quan thu duc gia 12,6trieu.m2, dang nhan dat cho.
Can ho quan thu duc gia 12,6trieu.m2, dang nhan dat cho.ngothangcr
 
140conf Presentation: Live Your Lifestream in 140 Characters
140conf Presentation: Live Your Lifestream in 140 Characters140conf Presentation: Live Your Lifestream in 140 Characters
140conf Presentation: Live Your Lifestream in 140 CharactersDaniel Honigman
 
SEPT-DECEMBER 2007 FINAL PROJECT
SEPT-DECEMBER 2007 FINAL PROJECTSEPT-DECEMBER 2007 FINAL PROJECT
SEPT-DECEMBER 2007 FINAL PROJECTormaryg
 

En vedette (8)

WordCamp RVA
WordCamp RVAWordCamp RVA
WordCamp RVA
 
La pensée politique de Raoul Follereau
La pensée politique de Raoul FollereauLa pensée politique de Raoul Follereau
La pensée politique de Raoul Follereau
 
El eco de_la_vida
El eco de_la_vidaEl eco de_la_vida
El eco de_la_vida
 
Can ho quan thu duc gia 12,6trieu.m2, dang nhan dat cho.
Can ho quan thu duc gia 12,6trieu.m2, dang nhan dat cho.Can ho quan thu duc gia 12,6trieu.m2, dang nhan dat cho.
Can ho quan thu duc gia 12,6trieu.m2, dang nhan dat cho.
 
Tiipz Pitch
Tiipz PitchTiipz Pitch
Tiipz Pitch
 
140conf Presentation: Live Your Lifestream in 140 Characters
140conf Presentation: Live Your Lifestream in 140 Characters140conf Presentation: Live Your Lifestream in 140 Characters
140conf Presentation: Live Your Lifestream in 140 Characters
 
Neptune
NeptuneNeptune
Neptune
 
SEPT-DECEMBER 2007 FINAL PROJECT
SEPT-DECEMBER 2007 FINAL PROJECTSEPT-DECEMBER 2007 FINAL PROJECT
SEPT-DECEMBER 2007 FINAL PROJECT
 

Similaire à Tieto tdd from-dreams_to_reality_s.narkevicius_v.pozdniakov_2013 (1)

Java best practices
Java best practicesJava best practices
Java best practicesRay Toal
 
Is writing performant code too expensive?
Is writing performant code too expensive? Is writing performant code too expensive?
Is writing performant code too expensive? Tomasz Kowalczewski
 
Testing in android
Testing in androidTesting in android
Testing in androidjtrindade
 
Keep your Wicket application in production
Keep your Wicket application in productionKeep your Wicket application in production
Keep your Wicket application in productionMartijn Dashorst
 
Networking and Data Access with Eqela
Networking and Data Access with EqelaNetworking and Data Access with Eqela
Networking and Data Access with Eqelajobandesther
 
Android Automated Testing
Android Automated TestingAndroid Automated Testing
Android Automated Testingroisagiv
 
OOP2017: Containerized End-2-End Testing – automate it!
OOP2017: Containerized End-2-End Testing – automate it!OOP2017: Containerized End-2-End Testing – automate it!
OOP2017: Containerized End-2-End Testing – automate it!Tobias Schneck
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningCarol McDonald
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Guillaume Laforge
 
Priming Java for Speed at Market Open
Priming Java for Speed at Market OpenPriming Java for Speed at Market Open
Priming Java for Speed at Market OpenAzul Systems Inc.
 
Get Back in Control of Your SQL with jOOQ at #Java2Days
Get Back in Control of Your SQL with jOOQ at #Java2DaysGet Back in Control of Your SQL with jOOQ at #Java2Days
Get Back in Control of Your SQL with jOOQ at #Java2DaysLukas Eder
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentationipolevoy
 
ios,objective tutorial
ios,objective tutorial ios,objective tutorial
ios,objective tutorial Bhavik Patel
 

Similaire à Tieto tdd from-dreams_to_reality_s.narkevicius_v.pozdniakov_2013 (1) (20)

Java best practices
Java best practicesJava best practices
Java best practices
 
Is writing performant code too expensive?
Is writing performant code too expensive? Is writing performant code too expensive?
Is writing performant code too expensive?
 
Testing in android
Testing in androidTesting in android
Testing in android
 
Java after 8
Java after 8Java after 8
Java after 8
 
Keep your Wicket application in production
Keep your Wicket application in productionKeep your Wicket application in production
Keep your Wicket application in production
 
Networking and Data Access with Eqela
Networking and Data Access with EqelaNetworking and Data Access with Eqela
Networking and Data Access with Eqela
 
Android Automated Testing
Android Automated TestingAndroid Automated Testing
Android Automated Testing
 
Dartprogramming
DartprogrammingDartprogramming
Dartprogramming
 
Writing Good Tests
Writing Good TestsWriting Good Tests
Writing Good Tests
 
OOP2017: Containerized End-2-End Testing – automate it!
OOP2017: Containerized End-2-End Testing – automate it!OOP2017: Containerized End-2-End Testing – automate it!
OOP2017: Containerized End-2-End Testing – automate it!
 
BDD in iOS with Cedar
BDD in iOS with CedarBDD in iOS with Cedar
BDD in iOS with Cedar
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 
Priming Java for Speed at Market Open
Priming Java for Speed at Market OpenPriming Java for Speed at Market Open
Priming Java for Speed at Market Open
 
Get Back in Control of your SQL
Get Back in Control of your SQLGet Back in Control of your SQL
Get Back in Control of your SQL
 
Get Back in Control of Your SQL with jOOQ at #Java2Days
Get Back in Control of Your SQL with jOOQ at #Java2DaysGet Back in Control of Your SQL with jOOQ at #Java2Days
Get Back in Control of Your SQL with jOOQ at #Java2Days
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 
ios,objective tutorial
ios,objective tutorial ios,objective tutorial
ios,objective tutorial
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 

Plus de Agile Lietuva

Agile Pusryčiai 2023 - „Skaitmeninė transformacija viešajame sektoriuje: nuo ...
Agile Pusryčiai 2023 - „Skaitmeninė transformacija viešajame sektoriuje: nuo ...Agile Pusryčiai 2023 - „Skaitmeninė transformacija viešajame sektoriuje: nuo ...
Agile Pusryčiai 2023 - „Skaitmeninė transformacija viešajame sektoriuje: nuo ...Agile Lietuva
 
Agile Pusryčiai 2023 - „Kaip užsitikrinti projekto sėkmę dar iki projekto pra...
Agile Pusryčiai 2023 - „Kaip užsitikrinti projekto sėkmę dar iki projekto pra...Agile Pusryčiai 2023 - „Kaip užsitikrinti projekto sėkmę dar iki projekto pra...
Agile Pusryčiai 2023 - „Kaip užsitikrinti projekto sėkmę dar iki projekto pra...Agile Lietuva
 
Agile pusryčiai 2023 - „Pirštas ant projekto pulso: CPO LT Agile patirtis ir ...
Agile pusryčiai 2023 - „Pirštas ant projekto pulso: CPO LT Agile patirtis ir ...Agile pusryčiai 2023 - „Pirštas ant projekto pulso: CPO LT Agile patirtis ir ...
Agile pusryčiai 2023 - „Pirštas ant projekto pulso: CPO LT Agile patirtis ir ...Agile Lietuva
 
Agile Pusryčiai 2023 - „Viešasis sektorius – neatskleistas inovacijų paklauso...
Agile Pusryčiai 2023 - „Viešasis sektorius – neatskleistas inovacijų paklauso...Agile Pusryčiai 2023 - „Viešasis sektorius – neatskleistas inovacijų paklauso...
Agile Pusryčiai 2023 - „Viešasis sektorius – neatskleistas inovacijų paklauso...Agile Lietuva
 
M. Kaminskas ir A. K. Remeikienė. LEAN projektas: sėkmės istorijos, iššūkiai ...
M. Kaminskas ir A. K. Remeikienė. LEAN projektas: sėkmės istorijos, iššūkiai ...M. Kaminskas ir A. K. Remeikienė. LEAN projektas: sėkmės istorijos, iššūkiai ...
M. Kaminskas ir A. K. Remeikienė. LEAN projektas: sėkmės istorijos, iššūkiai ...Agile Lietuva
 
B. den Haak. How to make OKRs Lean Again
B. den Haak. How to make OKRs Lean AgainB. den Haak. How to make OKRs Lean Again
B. den Haak. How to make OKRs Lean AgainAgile Lietuva
 
D. Aitcheson. How to make forecasts that are actually accurate.
D. Aitcheson. How to make forecasts that are actually accurate.D. Aitcheson. How to make forecasts that are actually accurate.
D. Aitcheson. How to make forecasts that are actually accurate.Agile Lietuva
 
Aleksandra Černiauskienė. Misija Bloomberg: Agile pagal amerikiečius
Aleksandra Černiauskienė. Misija Bloomberg: Agile pagal amerikiečiusAleksandra Černiauskienė. Misija Bloomberg: Agile pagal amerikiečius
Aleksandra Černiauskienė. Misija Bloomberg: Agile pagal amerikiečiusAgile Lietuva
 
Maija Aniskovič. Agile įtaka komandos motyvacijai.
Maija Aniskovič. Agile  įtaka komandos motyvacijai.Maija Aniskovič. Agile  įtaka komandos motyvacijai.
Maija Aniskovič. Agile įtaka komandos motyvacijai.Agile Lietuva
 
dr. E. Janiūnienė. Asociacijos Agile Lietuva atlikto Agile tyrimo pristatymas
dr. E. Janiūnienė. Asociacijos Agile Lietuva atlikto Agile tyrimo pristatymasdr. E. Janiūnienė. Asociacijos Agile Lietuva atlikto Agile tyrimo pristatymas
dr. E. Janiūnienė. Asociacijos Agile Lietuva atlikto Agile tyrimo pristatymasAgile Lietuva
 
M. Aniskovič. Laužome stereotipus: Agile gali drąsiai taikyti visi
M. Aniskovič. Laužome stereotipus: Agile gali drąsiai taikyti visiM. Aniskovič. Laužome stereotipus: Agile gali drąsiai taikyti visi
M. Aniskovič. Laužome stereotipus: Agile gali drąsiai taikyti visiAgile Lietuva
 
R. Krukonis. Reikalingas greitas rezultatas – pakeiskime projekto darbų organ...
R. Krukonis. Reikalingas greitas rezultatas – pakeiskime projekto darbų organ...R. Krukonis. Reikalingas greitas rezultatas – pakeiskime projekto darbų organ...
R. Krukonis. Reikalingas greitas rezultatas – pakeiskime projekto darbų organ...Agile Lietuva
 
M. Jovaišas. Viešojo sektoriaus lankstumas įgyvendinant transformacijas
M. Jovaišas. Viešojo sektoriaus lankstumas įgyvendinant transformacijasM. Jovaišas. Viešojo sektoriaus lankstumas įgyvendinant transformacijas
M. Jovaišas. Viešojo sektoriaus lankstumas įgyvendinant transformacijasAgile Lietuva
 
A. Kovaliov. Kas nėra Agile jaunystėje, tas neturi širdies. Kas nėra Watefall...
A. Kovaliov. Kas nėra Agile jaunystėje, tas neturi širdies. Kas nėra Watefall...A. Kovaliov. Kas nėra Agile jaunystėje, tas neturi širdies. Kas nėra Watefall...
A. Kovaliov. Kas nėra Agile jaunystėje, tas neturi širdies. Kas nėra Watefall...Agile Lietuva
 
V. Vasiliauskas. Nestandartinis atvejis: nuo Kanban prie Scrum
V. Vasiliauskas. Nestandartinis atvejis: nuo Kanban prie ScrumV. Vasiliauskas. Nestandartinis atvejis: nuo Kanban prie Scrum
V. Vasiliauskas. Nestandartinis atvejis: nuo Kanban prie ScrumAgile Lietuva
 
Leonard Vorobej. Agile projektų valdymas pradedantiesiems
Leonard Vorobej. Agile projektų valdymas pradedantiesiemsLeonard Vorobej. Agile projektų valdymas pradedantiesiems
Leonard Vorobej. Agile projektų valdymas pradedantiesiemsAgile Lietuva
 
Giedrė Žemulaitytė. Agile personalo skyriaus valdyme
Giedrė Žemulaitytė. Agile personalo skyriaus valdyme Giedrė Žemulaitytė. Agile personalo skyriaus valdyme
Giedrė Žemulaitytė. Agile personalo skyriaus valdyme Agile Lietuva
 
Gabija Fatėnaitė. Agile ir Scrum turinio kūrimo ir marketingo komandose
Gabija Fatėnaitė. Agile ir Scrum turinio kūrimo ir marketingo komandoseGabija Fatėnaitė. Agile ir Scrum turinio kūrimo ir marketingo komandose
Gabija Fatėnaitė. Agile ir Scrum turinio kūrimo ir marketingo komandoseAgile Lietuva
 
Gediminas Milieška. Agile kelionės: nuo transformacijos iki planavimo dideliu...
Gediminas Milieška. Agile kelionės: nuo transformacijos iki planavimo dideliu...Gediminas Milieška. Agile kelionės: nuo transformacijos iki planavimo dideliu...
Gediminas Milieška. Agile kelionės: nuo transformacijos iki planavimo dideliu...Agile Lietuva
 
Denis Vanpoucke. Agile kelionės:nuo transformacijos iki planavimo dideliu mastu
Denis Vanpoucke. Agile kelionės:nuo transformacijos iki planavimo dideliu mastuDenis Vanpoucke. Agile kelionės:nuo transformacijos iki planavimo dideliu mastu
Denis Vanpoucke. Agile kelionės:nuo transformacijos iki planavimo dideliu mastuAgile Lietuva
 

Plus de Agile Lietuva (20)

Agile Pusryčiai 2023 - „Skaitmeninė transformacija viešajame sektoriuje: nuo ...
Agile Pusryčiai 2023 - „Skaitmeninė transformacija viešajame sektoriuje: nuo ...Agile Pusryčiai 2023 - „Skaitmeninė transformacija viešajame sektoriuje: nuo ...
Agile Pusryčiai 2023 - „Skaitmeninė transformacija viešajame sektoriuje: nuo ...
 
Agile Pusryčiai 2023 - „Kaip užsitikrinti projekto sėkmę dar iki projekto pra...
Agile Pusryčiai 2023 - „Kaip užsitikrinti projekto sėkmę dar iki projekto pra...Agile Pusryčiai 2023 - „Kaip užsitikrinti projekto sėkmę dar iki projekto pra...
Agile Pusryčiai 2023 - „Kaip užsitikrinti projekto sėkmę dar iki projekto pra...
 
Agile pusryčiai 2023 - „Pirštas ant projekto pulso: CPO LT Agile patirtis ir ...
Agile pusryčiai 2023 - „Pirštas ant projekto pulso: CPO LT Agile patirtis ir ...Agile pusryčiai 2023 - „Pirštas ant projekto pulso: CPO LT Agile patirtis ir ...
Agile pusryčiai 2023 - „Pirštas ant projekto pulso: CPO LT Agile patirtis ir ...
 
Agile Pusryčiai 2023 - „Viešasis sektorius – neatskleistas inovacijų paklauso...
Agile Pusryčiai 2023 - „Viešasis sektorius – neatskleistas inovacijų paklauso...Agile Pusryčiai 2023 - „Viešasis sektorius – neatskleistas inovacijų paklauso...
Agile Pusryčiai 2023 - „Viešasis sektorius – neatskleistas inovacijų paklauso...
 
M. Kaminskas ir A. K. Remeikienė. LEAN projektas: sėkmės istorijos, iššūkiai ...
M. Kaminskas ir A. K. Remeikienė. LEAN projektas: sėkmės istorijos, iššūkiai ...M. Kaminskas ir A. K. Remeikienė. LEAN projektas: sėkmės istorijos, iššūkiai ...
M. Kaminskas ir A. K. Remeikienė. LEAN projektas: sėkmės istorijos, iššūkiai ...
 
B. den Haak. How to make OKRs Lean Again
B. den Haak. How to make OKRs Lean AgainB. den Haak. How to make OKRs Lean Again
B. den Haak. How to make OKRs Lean Again
 
D. Aitcheson. How to make forecasts that are actually accurate.
D. Aitcheson. How to make forecasts that are actually accurate.D. Aitcheson. How to make forecasts that are actually accurate.
D. Aitcheson. How to make forecasts that are actually accurate.
 
Aleksandra Černiauskienė. Misija Bloomberg: Agile pagal amerikiečius
Aleksandra Černiauskienė. Misija Bloomberg: Agile pagal amerikiečiusAleksandra Černiauskienė. Misija Bloomberg: Agile pagal amerikiečius
Aleksandra Černiauskienė. Misija Bloomberg: Agile pagal amerikiečius
 
Maija Aniskovič. Agile įtaka komandos motyvacijai.
Maija Aniskovič. Agile  įtaka komandos motyvacijai.Maija Aniskovič. Agile  įtaka komandos motyvacijai.
Maija Aniskovič. Agile įtaka komandos motyvacijai.
 
dr. E. Janiūnienė. Asociacijos Agile Lietuva atlikto Agile tyrimo pristatymas
dr. E. Janiūnienė. Asociacijos Agile Lietuva atlikto Agile tyrimo pristatymasdr. E. Janiūnienė. Asociacijos Agile Lietuva atlikto Agile tyrimo pristatymas
dr. E. Janiūnienė. Asociacijos Agile Lietuva atlikto Agile tyrimo pristatymas
 
M. Aniskovič. Laužome stereotipus: Agile gali drąsiai taikyti visi
M. Aniskovič. Laužome stereotipus: Agile gali drąsiai taikyti visiM. Aniskovič. Laužome stereotipus: Agile gali drąsiai taikyti visi
M. Aniskovič. Laužome stereotipus: Agile gali drąsiai taikyti visi
 
R. Krukonis. Reikalingas greitas rezultatas – pakeiskime projekto darbų organ...
R. Krukonis. Reikalingas greitas rezultatas – pakeiskime projekto darbų organ...R. Krukonis. Reikalingas greitas rezultatas – pakeiskime projekto darbų organ...
R. Krukonis. Reikalingas greitas rezultatas – pakeiskime projekto darbų organ...
 
M. Jovaišas. Viešojo sektoriaus lankstumas įgyvendinant transformacijas
M. Jovaišas. Viešojo sektoriaus lankstumas įgyvendinant transformacijasM. Jovaišas. Viešojo sektoriaus lankstumas įgyvendinant transformacijas
M. Jovaišas. Viešojo sektoriaus lankstumas įgyvendinant transformacijas
 
A. Kovaliov. Kas nėra Agile jaunystėje, tas neturi širdies. Kas nėra Watefall...
A. Kovaliov. Kas nėra Agile jaunystėje, tas neturi širdies. Kas nėra Watefall...A. Kovaliov. Kas nėra Agile jaunystėje, tas neturi širdies. Kas nėra Watefall...
A. Kovaliov. Kas nėra Agile jaunystėje, tas neturi širdies. Kas nėra Watefall...
 
V. Vasiliauskas. Nestandartinis atvejis: nuo Kanban prie Scrum
V. Vasiliauskas. Nestandartinis atvejis: nuo Kanban prie ScrumV. Vasiliauskas. Nestandartinis atvejis: nuo Kanban prie Scrum
V. Vasiliauskas. Nestandartinis atvejis: nuo Kanban prie Scrum
 
Leonard Vorobej. Agile projektų valdymas pradedantiesiems
Leonard Vorobej. Agile projektų valdymas pradedantiesiemsLeonard Vorobej. Agile projektų valdymas pradedantiesiems
Leonard Vorobej. Agile projektų valdymas pradedantiesiems
 
Giedrė Žemulaitytė. Agile personalo skyriaus valdyme
Giedrė Žemulaitytė. Agile personalo skyriaus valdyme Giedrė Žemulaitytė. Agile personalo skyriaus valdyme
Giedrė Žemulaitytė. Agile personalo skyriaus valdyme
 
Gabija Fatėnaitė. Agile ir Scrum turinio kūrimo ir marketingo komandose
Gabija Fatėnaitė. Agile ir Scrum turinio kūrimo ir marketingo komandoseGabija Fatėnaitė. Agile ir Scrum turinio kūrimo ir marketingo komandose
Gabija Fatėnaitė. Agile ir Scrum turinio kūrimo ir marketingo komandose
 
Gediminas Milieška. Agile kelionės: nuo transformacijos iki planavimo dideliu...
Gediminas Milieška. Agile kelionės: nuo transformacijos iki planavimo dideliu...Gediminas Milieška. Agile kelionės: nuo transformacijos iki planavimo dideliu...
Gediminas Milieška. Agile kelionės: nuo transformacijos iki planavimo dideliu...
 
Denis Vanpoucke. Agile kelionės:nuo transformacijos iki planavimo dideliu mastu
Denis Vanpoucke. Agile kelionės:nuo transformacijos iki planavimo dideliu mastuDenis Vanpoucke. Agile kelionės:nuo transformacijos iki planavimo dideliu mastu
Denis Vanpoucke. Agile kelionės:nuo transformacijos iki planavimo dideliu mastu
 

Dernier

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Dernier (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Tieto tdd from-dreams_to_reality_s.narkevicius_v.pozdniakov_2013 (1)

  • 1. TDD – from dreams to reality © 2013 Tieto Corporation Saulius Narkevičius. Viačeslav Pozdniakov.
  • 2. Viačeslav Saulius Programming architect 24 hours developer (~ 23 years of programing) (~ 9 years of programing) University lector University lector Assembler, …, Java, ... Scala, Haskell, Java, ... Desktop / Web Desktop / Web UI / Middleware / Database Databases / Middleware Waterfall / Agile / Whatever Agile / Whatever © 2013 Tieto Corporation
  • 3. Three TDD steps © 2013 Tieto Corporation 1. Failing test 2. Production code 3. Refactor
  • 4. Drives simple code design Safety net for refactoring TDD dream Fast feedback Keeps developers head “empty” – everything is in code © 2013 Tieto Corporation Documentation
  • 5. Super feature request: © 2013 Tieto Corporation “Calculate average of two integer values”
  • 6. Java solution 20 seconds later © 2013 Tieto Corporation int averageOf(int a, int b) { return (a + b) / 2; }
  • 7. Does not compile – No averageOf() exists yet! 1. Red – write a failing test © 2013 Tieto Corporation @Test public void smokeTestAverage() { assertThat(averageOf(2, 4), is(3)); }
  • 8. Test passes successfully 2. Green – just enough production code @Test public void smokeTestAverage() { assertThat(averageOf(2, 4), is(3)); } © 2013 Tieto Corporation int averageOf(int a, int b) { return 3; }
  • 9. Nothing to refactor yet 3. Refactor – make code cleaner @Test public void smokeTestAverage() { assertThat(averageOf(2, 4), is(3)); } © 2013 Tieto Corporation int averageOf(int a, int b) { return 3; }
  • 10. Hmm, code is really dumb… Repeat: red, green, refactor @Test public void smokeTestAverage() { assertThat(averageOf(2, 4), is(3)); assertThat(averageOf(10, 20), is(15)); } © 2013 Tieto Corporation int averageOf(int a, int b) { return (a == 10) ? 15 : 3; }
  • 11. Done!!! Took longer with tests :( Let’s triangulate @Test public void smokeTestAverage() { assertThat(averageOf(2, 4), is(3)); assertThat(averageOf(10, 20), is(15)); assertThat(averageOf(-8, -16), is(-12)); } © 2013 Tieto Corporation int averageOf(int a, int b) { return (a + b) / 2; }
  • 12. FAILED: Expected 2147483647 but was -1 Edge cases @Test public void edgeCasesForAverage() { assertThat(averageOf(MAX, MAX), is(MAX)); assertThat(averageOf(MIN, MIN), is(MIN)); } © 2013 Tieto Corporation int averageOf(int a, int b) { return (a + b) / 2; }
  • 13. Tests pass successfully Avoid overflow by using subtraction © 2013 Tieto Corporation @Test public void edgeCasesForAverage() { assertThat(averageOf(MAX, MAX), is(MAX)); assertThat(averageOf(MIN, MIN), is(MIN)); } int averageOf(int a, int b) { int high = (a > b ? a : b); int low = (a > b ? b : a); return low + ((high - low) / 2); }
  • 14. FAILED: Expected 0 but was -2147483648 One more edge case © 2013 Tieto Corporation @Test public void edgeCasesForAverage() { assertThat(averageOf(MAX, MAX), is(MAX)); assertThat(averageOf(MIN, MIN), is(MIN)); assertThat(averageOf(MIN, MAX), is(0)); } int averageOf(int a, int b) { int high = (a > b ? a : b); int low = (a > b ? b : a); return low + ((high - low) / 2); }
  • 15. When TDD shines → Clear requirements → Requirements do not change every hour → Sample tests are in place → Test execution is fast and one click away → Testing environment similar to production. © 2013 Tieto Corporation
  • 16. → What to test? → Building data sets for tests TDD in the real world → Sample tests to start from → Legacy code may not be testable → What not to test? © 2013 Tieto Corporation
  • 17. “What to test?” is a wrong question → We are not testing but specifying sample usage scenarios → What do you want to specify / describe? → Testing frameworks speak “Specs”: • RSpec, Cucumber, Jasmine, Concordion, ... → TDD thought leaders done this years ago: • Dan North, Dave Astels, Robert C Martin (a.k.a. Uncle Bob), ... → Naming is everything (see: Specification by Example) © 2013 Tieto Corporation
  • 18. Sample test @Test public void testCreatBookWithFullData() { tester.login(); tester.startPage(BookEditPage.class); FormTester formTester = tester.newFormTester("newBookForm"); formTester.setValue("main.container:title", “Some book title"); formTester.setValue("main.container:author", “Some author"); formTester.setValue("main.container:year", "1999"); formTester.setValue("main.container:publisherPageUrl", "www.newBook.lt"); formTester.setValue("main.container:pages", "222"); formTester.setValue("main.container:publisherName", “Some publisher"); formTester.setValue("main.container:series", “Very interesting series"); formTester.setValue("main.container:originalName", “some original name"); formTester.submit("submit"); tester.assertRenderedPage(BookPage.class); tester.assertLabel("title", " Some book title"); tester.assertLabel("authorPanel:authors:0:author.link:author", "Some author"); tester.assertContains("some original name"); tester.assertLabel("years.link:year", "1999"); tester.assertLabel("publisher.link:publisher.name", "Some publisher"); tester.assertLabel("pages", "222"); © 2013 Tieto Corporation }
  • 19. Same test as spec public void creating_new_book_scenario() { givenCurrentUserIsAnAdministrator(); Book newBook = createNewBook(); show(BookEditPage.class); fillFormFieldsWith(newBook); submitForm(); expectCurrentPageIs(BookPage.class); expectCurrentPageDisplaysAttributesOf(newBook); © 2013 Tieto Corporation }
  • 20. Data sets for specs // create or load from test DB © 2013 Tieto Corporation interface TypicalUsers { User admin(); User guest(); User reviewer(); User author(); } interface TypicalBooks { Book basicBook(); Book bookWithThreeAuthors(); Book bookWithReview(); }
  • 21. Sample spec for persistence © 2013 Tieto Corporation @Test public void orm_mappings_are_ok () { loadAndPrintSomeEntitiesOf(Book.class); }
  • 22. Sample spec for UI © 2013 Tieto Corporation @Test public void renders_successfully() { new WicketTester().startPage(NewClientPage.class); }
  • 23. Sample spec for business logic (WS) © 2013 Tieto Corporation @Test public void extending_book_loan() { process(requestToBookLoanHandler(”extend_loan_request.xml")); expectResponse(”loan_approved_response.xml"); }
  • 24. Writing testable code Is writing tests easy? Yes, it is. The art is in writing testable production code! → See short guide: “Writing Testable Code” © 2013 Tieto Corporation
  • 25. What not to specify: technical viewpoint → Getters, setters and member variables → One line functions → GUI – make as thin and dumb as possible → Frameworks – things you do not control → Things which are hard to code - by trial and error. © 2013 Tieto Corporation
  • 26. What not to specify: process viewpoint → Accelerated Agile – buzzword from Dan North → Some ingredients of accelerated agile: • • • • developers become domain experts short iterations (days, hours) – less chance for bugs deliver as soon as possible – even without specs discover knowledge from real usage → Write specs for code which survived real usage → Works for some projects © 2013 Tieto Corporation
  • 27. Know what to specify Think “specs” not “tests” © 2013 Tieto Corporation Use TDD wisely Know what not to specify TDD: from DREAMS to Simple smoke REALITY Simplify writing specs by “Writing Testable Code” specs are a good investment Real specs come from real usage
  • 28. © 2013 Tieto Corporation Questions?

Notes de l'éditeur

  1. SlxWho attended talk given by RaimondsSimanovskis?Who has written a single test last month?This talk is about things which are not covered in TDD-selling books
  2. Slx ir SlavaA lot of hand rising for reality check that we are not dreaming.We will together learn a lot from handrising.How many developers in the room?Add something fun
  3. SlavaWho practices pure TDD?
  4. SlavaWho would to live in such TDD dream?
  5. SlavaNuo 5 min.
  6. Slava
  7. Slava
  8. Slava
  9. Slava
  10. SlavaHere comes triangulation! You must have at least 2 examples before thinking about more generic approach.
  11. Slava
  12. Slava
  13. Slava
  14. Slava
  15. SlxWho works with really clear requirements?Saulesspinduliai, kumstis - liuks
  16. Slx - these items came out from face-to-face conversationsWho works with really clear requirements?Nuošiol prezentacijoje mes rupinsimes šiais klausimais.
  17. Slx - Who already thinks and talks about specs?
  18. Slx
  19. Slx
  20. SlavaTypical personas and entities are part of specificationOn the contrary: tests are encouradged to be isolated
  21. SlavaWho uses Object Relational Mapping framework?This is FAST FEEDBACK in the first place, and SPEC in a second place.
  22. SlavaWho uses web framework which allows such tests?NO LOGIC – just SAFETY NET
  23. SlavaWho uses web framework which allows such tests?NO LOGIC – just SAFETY NET
  24. SlxTest First approach make production code testable
  25. SlavaDo not test things which are tested indirectly
  26. SlxFrom TDD/BDD purists.Test are not thrown away – just written after feedback. Usually for the core part of the system.Who wrote nearly-bug-free software without tests?Baisusgreitis
  27. SlxFrom TDD/BDD purists.Test are not thrown away – just written after feedback. Usually for the core part of the system.Who wrote nearly-bug-free software without tests?
  28. SlavaWho uses web framework which allows such tests?NO LOGIC – just SAFETY NET