A presentation about how writing tests can help you learn a language. So at the same time we, I and Tomasz Borek, praise Tests and Test Driven Development as well as the beautiful language Scala.
13. Test jednostkowy
nie "gada z bazą"
nie potrzeba mu Internetu,
szybki,
odpowiednio nazwany,
jasny, przejrzysty, klarowny,
testuje jedną rzecz,
nie dwie, nie tysiąc
14. Struktura testu
behaviour of "Something"
it should "have expressive name" in {
// given
val anObject : UnderTest = new UnderTest();
// when
val result = anObject.testedMethod();
// then
result should be ("expressive");
}
15. Struktura testu
behaviour of "Something"
it should "have expressive name" in {
// given
val anObject = new UnderTest
// when
val result = anObject.testedMethod()
// then
result should be ("expressive")
}
34. Cechy = Traits
behavior of "Sword of Nyarlathotep"
it should "roll DMG using D20"
it should "have base damage +10 DMG"
it should "add 'panic' magic effect"
37. Podsumowanie - Testy
● Droga do TDD
● Testy przed != TDD
● Cykl
● Błąd kompilacji == Pierwszy Red
● Testy jednostkowe, nie integracyjne
● Testy jako Dokumentacja
● Given When Then
38. Podsumowanie - Linki
● SCKRK / Code Kata / Kraków Scala
● Tomasz Kaczanowski - practicalunittesting.com
● ScalaTest docs
● Scala docs
● Martin Odersky - Programming in Scala
● Cay Horstmann - Scala for The Impatient
● "Bruce Eckel's Atomic Scala" in pending ...
39. THANKS!
// todo implement this
behaviour of "those who ask questions"
they should "ask them politely" in pending
they should "ask them loudly" in pending
they should "go eat" in pending
Konrad Malawski - twitter: @ktosopl
Tomasz Borek - @gmail.com
SFI 2013