Difference between revisions of "Using Groovy in Testing"
From CitconWiki
Jump to navigationJump to search (New page: The bulk of the session introduced the Groovy language. Benefits of using Groovy for writing developer tests were summarised as: * test code shorter and sweeter (than Java) * interactiv...) |
|||
Line 2: | Line 2: | ||
Benefits of using Groovy for writing developer tests were summarised as: | Benefits of using Groovy for writing developer tests were summarised as: | ||
− | * | + | * Test code is shorter and sweeter (than Java) |
− | * interactive shell | + | * You can use GroovyConsole or the interactive shell (groovysh) to try things out live |
− | * JUnit 4 support including Theories | + | * JUnit 3.8 built-in |
+ | * Powerful assertion capability built-in to Groovy (though for JUnit4 assertions, you need to use static imports) | ||
+ | * JUnit 4 support including Parameterized tests and Theories [http://groovy.codehaus.org/Using+JUnit+4+with+Groovy Groovy Doco] | ||
* TestNG support | * TestNG support | ||
− | * | + | * Full Java library support |
− | * | + | * Built-in support making it easy to parse XML and access databases for data-driven tests |
− | + | * Groovy's built in mocking is easy to use (but often you can get by with Closures, maps or expandos) | |
− | * | + | * Groovy is great for creating testing DSLs |
− | |||
* Groovy's fun!! | * Groovy's fun!! | ||
To use as a JUnit test, the simplest way is to extend GroovyTestCase. With the Groovy plugins installed, you can use Groovy JUnits in the same way as Java JUnits. | To use as a JUnit test, the simplest way is to extend GroovyTestCase. With the Groovy plugins installed, you can use Groovy JUnits in the same way as Java JUnits. |
Revision as of 21:15, 1 July 2008
The bulk of the session introduced the Groovy language.
Benefits of using Groovy for writing developer tests were summarised as:
- Test code is shorter and sweeter (than Java)
- You can use GroovyConsole or the interactive shell (groovysh) to try things out live
- JUnit 3.8 built-in
- Powerful assertion capability built-in to Groovy (though for JUnit4 assertions, you need to use static imports)
- JUnit 4 support including Parameterized tests and Theories Groovy Doco
- TestNG support
- Full Java library support
- Built-in support making it easy to parse XML and access databases for data-driven tests
- Groovy's built in mocking is easy to use (but often you can get by with Closures, maps or expandos)
- Groovy is great for creating testing DSLs
- Groovy's fun!!
To use as a JUnit test, the simplest way is to extend GroovyTestCase. With the Groovy plugins installed, you can use Groovy JUnits in the same way as Java JUnits.