that worked before

14

Click here to load reader

Upload: christian-guedemann

Post on 07-Jul-2015

174 views

Category:

Technology


2 download

DESCRIPTION

TDD with XPages

TRANSCRIPT

Page 1: That worked before

THAT WORKED BEFOREJUnit Testing and TDD in XPages

Page 2: That worked before

Christan Güdemann

WebGate Consulting AG / OpenNTF

www.webgate.biz / www.openntf.org

[email protected]

@guedeWebGate

Page 3: That worked before

FRIDAY, 15.07

Only this short change and the customer is happy!

Page 4: That worked before

ON MONDAY…. 11:22

Outch! Nothing works!

Page 5: That worked before

PLEASE TEST!

Users View

Is the UI functional

Are all data validated

If I click a will happen b

Developers View

Is my code doing what I

excpect?

Are errors handled correct

Is all my code tested

Page 6: That worked before

TEST FIRST?

The TDD Mantra

Write a test

Make the test compile

The test must fail

Fix the code as fast as possible

Remove duplications

(http://de.wikipedia.org/wiki/Testgetriebene_Entwicklung)

Page 7: That worked before

TDD – WRITE A TEST

A Test document what I expect from a piece of code

int amountCHF = bank.changeEuro2CHF( 100 );

assertEquals( 120, amountCHF)

PS: This test is done by the Swiss Federal bank each day

Page 8: That worked before

I CAN DO THIS WITH XPAGES?

• YES – thanks to OpenNTF;)

• Download org.openntf.junit.xsp and install it on server and designer

http://openntf.org/main.nsf/project.xsp?r=project/org.openntf.junit.xsp

Page 9: That worked before

DEMO

Page 10: That worked before

GOT YOUR POINT BUT HOW TO CONVINCE MY TEAM?

• Writing tests is waste of time we do not have

• That we have never done before

• And there is another website that documents TDD bullshit.

Page 11: That worked before

TIME FOR AN EXPERIMENT

• WebGate Consulting hat the project “goodmeeting.biz” driven according the TDD rules

• In the middle of the first iteration we had to refactor a major part– DONE in 60 Minuten – No errors!

Page 12: That worked before

WHY I LOVE TDD

• I’m definitely relaxed because the code does what I expect that the code should do

Page 13: That worked before

AND TDD HELP YOU ALSO IN THIS TOPICS!

• Explore how a new API works? – Write some tests

• Each new version can be tested against your tests

• Understand what your co workers want to do? – Read the tests

Page 14: That worked before

LITERATUR

• Test Driven Development by Example (Kent Beck)

http://www.amazon.de/Driven-Development-Example-Addison-Wesley-Signature/dp/0321146530/ref=sr_1_1?ie=UTF8&qid=1415217300&sr=8-1&keywords=tdd+by+example