Property testing property("The reverse of the reverse of an array is that array") <- forAll { (xs : [Int]) in return (xs.reverse().reverse() == xs) > "Left identity" ^&&^ (xs == xs.reverse().reverse()) > "Right identity" }
BDD style → Behavior driven developmennt → RSpec describe HelloWorld do context “When testing the HelloWorld class” do it "should say 'Hello World' when we call the say_hello method" do hw = HelloWorld.new message = hw.say_hello expect(message).to eq "Hello World!" end end end
TDD → Test driven development → TDD is dead. Long live testing https://dhh.dk/ 2014/tdd-is-dead-long-live-testing.html Less emphasis on unit tests, because we're no longer doing test-first as a design practice, and more emphasis on, yes, slow, system tests.
Still → It's good to have unit test → Does not matter if TDD or not. As long as we have tests → Validate quickly and reliably → Help your future self or other maintainers
4. Mock → Mock during development → Mock during testing final class Deps { static let salonRepo: SalonRepoAware = SalonRepo() static let userRepo: UserRepoAware = UserRepo() static let cardRepo: CardRepoAware = CardRepo() }