Et tout un tas d'autres choses ;)
Fabien Hiegel
Mohammed Lamzira
Thomas Carpaye
Selon vous ?
Juste ça ?
TDD !!!
Il veut dire
quoi le T déjà ?
Selon vous ?
Fast
Isolated
Repetable
Self verifying
Timely
@Test
void should_be_able_to_send_an_email() {
// GIVEN
Session session = Session.getInstance(new Properties(), null);
Message msg = createMessage(session);
// WHEN
sendMessage(session, msg);
// THEN
MimeMessage[] messages = mailServer.getReceivedMessages();
assertThat(messages).hasSize(1);
assertThat(messages[0].getSubject()).isEqualTo(EMAIL_SUBJECT);
assertThat(messages[0].getContent().toString().trim()).isEqualTo(EMAIL_TEXT);
assertThat(messages[0].getFrom()[0].toString()).isEqualTo(EMAIL_TO);
}
Baby steps
RED
Make it fail
No code without a failing test
GREEN
REFACTOR
Make it work
As simply as possible
Make it
Better
Vous devez écrire un test qui échoue avant d’écrire tout code de production
Vous ne devez pas écrire plus d’un test suffisant pour échouer, ou qui échouera à la compilation
Vous ne devez pas écrire plus de code que nécessaire pour faire passer le test en cours
is NOT about testing
is NOT about test first
is a methodology
is about design and development
is your assistant
Demo
Kata
Write a function that returns true or false depending on whether its input integer is a leap year or not.
A leap year is divisible by 4, but is not otherwise divisible by 100, unless it is also divisible by 400.
For example, 2001 is a typical common year
and 1996 is a typical leap year,
whereas 1900 is an atypical common year
and 2000 is an atypical leap year.
Refactoring
TPP
https://codingdojo.org/kata/RPN/
Kata
https://github.com/xpmatteo/birthday-greetings-kata
Kata
https://github.com/sandromancuso/Bank-kata
Kata
As you meant it