Test Motherfucker...Test
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Test Motherfucker...Test

on

  • 1,384 views

Slides from

Slides from

Statistics

Views

Total Views
1,384
Views on SlideShare
1,212
Embed Views
172

Actions

Likes
0
Downloads
9
Comments
0

3 Embeds 172

http://greach.es 161
http://librosweb.es 10
https://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Test Motherfucker...Test Presentation Transcript

  • 1. First things first• Mario García • Freelance • Happily working with Grails every day • Blamed for a felony I didn’t commit I ran away to Ireland...still there!! marioggar desmontandojava.blogspot.com mariogarcia
  • 2. What is this about? because we don’t need to test...do we?
  • 3. What is this about? WE ARE NOT PERFECT
  • 4. When do we realize? WTF!!
  • 5. Why I test?• Do they make me flawless? Nop, In fact they remind me every day how bad I am• Do they avoid bugs?me to detect them Nop, but they help before is too late
  • 6. Sample Code• https://github.com/mariogarcia/maroulette
  • 7. Integration Tests Why first???
  • 8. Why first?• ... because you do all your important stuff in services, Don’t you MTF?
  • 9. What to test?• External systems integration: • Database • Web-services / Rest • Queue system • ...
  • 10. Weapons• Grails “inbuilt” integration tests• 2.0.x > * Interactive mode & Guard Plugin• Spock• Fixtures• Build Test Data
  • 11. Grails Integration Tests• By default• JUnit Based• The application is “UP AND RUNNING”• Use the interactive mode to save time
  • 12. Plugins• Spock • More natural way of writing tests • Parameter tables ROCKS!!! • Helps you to document!!!
  • 13. Plugins• Fixtures Plugin • We can create common testing datasets• Build Test Data Plugin • Sometimes we don’t care about field values • Just give me a valid persisted instance!!
  • 14. Plugins• Spock: http://grails.org/plugin/spock• Fixtures: http://grails.org/plugin/spock• Build Test Data: http://grails.org/plugin/spock• Guard: http://grails.org/plugin/guard
  • 15. Grails Integration Tests
  • 16. Unit Testing The easiest one?
  • 17. Usual Suspects• Controllers• Taglibs• UrlMappings• Filters• Other silly things...
  • 18. Typical Case• Testing a controller • What the output view is gonna be if • everything went ok ? • everything went wrong ? • Should the user see any message? • Etc...
  • 19. Weapons• Grails Mocking • Don’t test controllers with real services • Use Mixins instead to simulate them • Learn to create expectations
  • 20. Weapons• Spock Tables to the rescue!!! • Natural way of doing use cases in your controllers
  • 21. Grails Unit Testing
  • 22. Functional Testing Is it working as the user expected? Game Over!
  • 23. Functional testing• Plugins • Functional Testing • http://www.grails.org/plugin/functional-test • Geb • http://www.grails.org/plugin/geb
  • 24. Functional Testing
  • 25. Please, don’t hate JS it’s cute, isn’t it?
  • 26. Testing JS • http://grails.org/plugin/jasmine • http://grails.org/plugin/angularjs-resources• casperjs • https://github.com/ulrich/grails-casper-plugin
  • 27. Q&AAsk now or be quiet forever!!!