Click here to load reader
Upload
joren-de-groof
View
1.166
Download
1
Embed Size (px)
DESCRIPTION
Why you should write tests for your application.
Citation preview
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
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 | [email protected] | | Password | foobar |
And I press "Log in" Then I should see "Couldn't log you in"
Tell a story
Test data
• Mock, stub
• Fixtures
• Factories
Tools
Cruisecontrol
Git blame
Cucumber, Selenium
Any questions?