TATFT
Joren
@joren
TDD
Why?
Test what?

• Test what should happen

• Test what should NOT happen
Red green refactoring
• Add a test

• Run all tests

• Write Some code

• Run the tests again

• Refactor code

• Start over again
Regression tests

• Change environment

• Change code

• Is everything still working?
Different levels of testing

• Unit

• Functional

• Integration/BDD
Unit testing

• Most basic

• Database level

• Validations
Functional testing


• Lifecycle of objects

• Controllers
BDD
Integration tests - BDD

• Overall application functionalities

• Tell a story

• Walk through your application
Tell a story
Feature: Authenticating
 In order to ensure safety of our app
 As a developer
 I want be sure authentication can't be compromised

   Scenario: Authenticating with wrong password
    Given I've created a user for my reseller account "Openminds"
    When I go to the homepage
      And I fill in the following:
      | Login    | me@example.com |
      | Password | foobar         |
    And I press "Log in"
    Then I should see "Couldn't log you in"
Test data

• Mock, stub

• Fixtures

• Factories
Tools
Cruisecontrol
Git blame
Cucumber, Selenium
Any questions?

Tatft