140 likes | 510 Views
The Plan. Groovy makes testing Java better.MotivationIntroduce GroovyApply Groovy to TestingMock ObjectsTestNGGrand Demo. The Setting. Java shopSubversion ? for version controlMaven 2 ? for most buildsGroovy ? for various tasksMany apps running against a common database and set of librarie
E N D
1. Unit Testing Java using Groovy and Mock Objects Walker Hale
Human Genome Sequencing Center
Baylor College of Medicine
2. The Plan Groovy makes testing Java better.
Motivation
Introduce Groovy
Apply Groovy to Testing
Mock Objects
TestNG
Grand Demo
3. The Setting Java shop
Subversion — for version control
Maven 2 — for most builds
Groovy — for various tasks
Many apps running against a common database and set of libraries
4. An Ideal Deliverable in Our Shop Code checked into version control
Builds with maven 2
Passes all unit tests
5. The Plot The Motivation
More unit testing!
The Insight
Small changes in the difficulty or unpleasantness of a task produce disproportionately large changes in how much that task is performed.
Enter Groovy
6. Groovy in 15 Minutes Almost all Java code is Groovy code
no inner classes
http://groovy.codehaus.org/Differences+from+Java
Groovy adds:
Fun syntactic sugar
Lazy method dispatch
Methods to the standard Java library classes
Closures
Groovy-specific classes
Interactive shell
7. Syntax Sugar
8. Syntax Sugar
9. Lazy Dispatch & Expanding JDK
10. Closures 1
11. Closures 2
12. Closures 3
13. Testing in Groovy Compiled (not limited) with JUnit 3.8.2
Adds
GroovyTestCase
New assertions, such as shouldFail
GroovyTestSuite
Simple command line operation
URLs
http://groovy.codehaus.org/Testing+Guide
http://groovy.codehaus.org/Unit+Testing
14. Demo Time!
15. Resources http://groovy.codehaus.org/
Documentation
Differences+from+Java
Testing+Guide
http://searchgroovy.org/