Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Test Motherfucker...Test
1.
2. 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
3. What is this about?
because we don’t need to test...do we?
6. 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
12. Grails Integration Tests
• By default
• JUnit Based
• The application is “UP AND RUNNING”
• Use the interactive mode to save time
13. Plugins
• Spock
• More natural way of writing tests
• Parameter tables ROCKS!!!
• Helps you to document!!!
14. 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!!
19. 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...
20. Weapons
• Grails Mocking
• Don’t test controllers with real services
• Use Mixins instead to simulate them
• Learn to create expectations
21. Weapons
• Spock Tables to the rescue!!!
• Natural way of doing use cases in your
controllers