that worked before
DESCRIPTION
TDD with XPagesTRANSCRIPT
THAT WORKED BEFOREJUnit Testing and TDD in XPages
Christan Güdemann
WebGate Consulting AG / OpenNTF
www.webgate.biz / www.openntf.org
@guedeWebGate
FRIDAY, 15.07
Only this short change and the customer is happy!
ON MONDAY…. 11:22
Outch! Nothing works!
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
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)
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
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
DEMO
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.
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!
WHY I LOVE TDD
• I’m definitely relaxed because the code does what I expect that the code should do
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
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