1. Introduction to Hamcrest and LambdaJ Cristian Cooi
2. 1. BDD (Agile) 2. Ce este hamcrest 3. Ce este lambdaj 4.
Beneficii
3. Ce este BDD Stories & Scenarios As a [X] I want [Y] So
that [Z]
4. Acceptance Testing Driven Development Atenia business Scrise
de ntreaga echip pentru toat echipa Testele pic pn este implementat
story-ul Test Driven Development Atenia partea tehnic Scrise de
developeri pentru developeri Testele pic pn este implementat
funcionalitatea
5. Ambele sunt scrise naintea codului aplicaiei Arat foarte
similar ... Dar nu se pot substiti una pe cealalt
6. Story Title: Customer pays bills through internet banking As
a customer, I want to pay bills through internet banking, So that I
dont have to make a trip to each supplier. Scenario 1 Scenario 1:
There is enough credit Given the account is in credit And the user
is properly authenticated When the customer attempts to make a
payment to a supplier And he inputs the correct bill details Then
ensure the transaction is recorded And ensure the amount of money
is debited
7. HAMCREST http://hamcrest.org Hamcrest it is not a testing
library: it just happens that matchers are very useful for testing.
Permite scrierea codului ntr-un limbaj aproape natural Anagram de
la matchers LAMBDAJ http://code.google.com/p/l ambdaj/ Acceseaz
colecii fr bucle (for, while etc.) Operaii: filtrare, conversie,
sortare, i nvocare de metode etc.
8. JUnit Clarity assertEquals(a, 3); assertThat(a, is(3));
Hamcrest Speed Not necessarily applicable for isNull() or
isNotNull() assertThat(list, hasItems(banana, minion,
unicorn));
9. Core is Logical allOf - like Java && anyOf - like
Java || not Object equalTo - test object equality using
Object.equals notNullValue, nullValue - test for null
10. Collections hasEntry, hasKey, hasValue - test a map
contains an entry, key or value hasItem, hasItems - test a
collection contains elements Number closeTo - test floating point
values are close to a given value greaterThan,
greaterThanOrEqualTo, lessThan, lessThanOrEqualTo - test ordering
Text equalToIgnoringCase containsString, endsWith, startsWith -
test string matching
11. Imports
12. hasItem, hasItems Varianta clasic
13. hasItem, hasItems Folosind hamcrest
14. hasItems (cnd verificarea pic)
15. hasEntry, hasValue, hasKey
16. Numbers
17. Tiny automation code
18. ntrebri?
19. Imports
20. Este conceput pentru manipularea coleciilor Poate folosi
Hamcrest pentru matching
21. Lizibilitate Coleciile sunt foarte comune Iteraiile nu sunt
extraordinar de simple ...i sunt greu de citit Operaii lambdaj:
conversie, filtrare, sortare, extragere etc.
22. Comparaii matematice (cu hamcrest) Sume
23. Invocarea unei metode Varianta clasic Folosind LambdaJ
24. Select
25. Select
26. Cel mai tnr Papoi
27. Colecii Null sau goale n forEach Clase finale Very large
collections
28. ntrebri?
29. Integrare cu metodologiile Agile (BDD) Claritate Vitez Curb
de nvare rapid Aplicaii numeroase