20

Click here to load reader

Tatft

Embed Size (px)

DESCRIPTION

Why you should write tests for your application.

Citation preview

Page 1: Tatft

TATFT

Page 2: Tatft

Joren

Page 3: Tatft

@joren

Page 4: Tatft

TDD

Page 5: Tatft

Why?

Page 6: Tatft

Test what?

• Test what should happen

• Test what should NOT happen

Page 7: Tatft

Red green refactoring• Add a test

• Run all tests

• Write Some code

• Run the tests again

• Refactor code

• Start over again

Page 8: Tatft

Regression tests

• Change environment

• Change code

• Is everything still working?

Page 9: Tatft

Different levels of testing

• Unit

• Functional

• Integration/BDD

Page 10: Tatft

Unit testing

• Most basic

• Database level

• Validations

Page 11: Tatft

Functional testing

• Lifecycle of objects

• Controllers

Page 12: Tatft

BDD

Page 13: Tatft

Integration tests - BDD

• Overall application functionalities

• Tell a story

• Walk through your application

Page 14: Tatft

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

Page 15: Tatft

Test data

• Mock, stub

• Fixtures

• Factories

Page 16: Tatft

Tools

Page 17: Tatft

Cruisecontrol

Page 18: Tatft

Git blame

Page 19: Tatft

Cucumber, Selenium

Page 20: Tatft

Any questions?