Why unit test with Groovy?
What makes Groovy particularly appealing with respect to other scripting platforms is its seamless integration with the Java platform. Because it's based on the Java language (unlike other alternate languages for the JRE, which
Tutorial Details:
The secret to Groovy's success, in this regard, is its syntax, which is Java syntax, but with far fewer rules. For example, Groovy doesn't require semicolons, and it makes variable types and access modifiers optional. Moreover, Groovy makes use of the standard Java libraries you're already familiar with, including Collections and File/IO. And, finally, you can utilize any Java library from within Groovy, including JUnit.
The fact is, Groovy's relaxed Java-like syntax, its reuse of standard Java libraries, and its rapid build-and-run cycle make it an ideal candidate for rapidly developing unit tests. But don't just take my word for it; let's see it in code!
JUnit and Groovy
Unit testing Java code in Groovy couldn't be easier, and there are many options for getting started. The most straightforward choice is to stick with the industry standard, JUnit. The simplicity and power of JUnit are unrivaled, its ubiquity as a helpful Java development tool is unparalleled, and there's nothing stopping the combination of JUnit and Groovy, so why reinvent the wheel? In fact, once you've seen JUnit and Groovy together in action, I'll bet you'll never turn back! The key thing to remember here is that you can do all the same things with JUnit in Groovy that you can do in the Java language; albeit with far fewer keystrokes.
Read
Tutorial at: Click here to view the tutorial
Rate Tutorial: Practically Groovy: Unit test your Java code faster with Groovy
View Tutorial: Practically Groovy: Unit test your Java code faster with Groovy
Related
Tutorials:
Results of
first-ever JVM server benchmark revealed - JavaWorld - December 1997
Results of
first-ever JVM server benchmark revealed - JavaWorld - December 1997 |
JavaWorld - Distributed
applet-based
massively parallel processing
(DAMPP) - January
1997
JavaWorld - Distributed
applet-based
massively parallel processing
(DAMPP) - January
1997 |
Java threads may not use all your CPUs - JavaWorld August 2000
Java threads may not use all your CPUs - JavaWorld August 2000 |
Tweak your IO performance
for faster runtime - JavaWorld November
2000
Tweak your IO performance
for faster runtime - JavaWorld November
2000 |
Optimize a query on a Map - JavaWorld November 2000
Optimize a query on a Map - JavaWorld November 2000 |
JUnit best
practices - JavaWorld December
2000
JUnit best
practices - JavaWorld December
2000 |
Performance books put to the test - JavaWorld March 2001
Performance books put to the test - JavaWorld March 2001 |
Pattern your way
to automated regression testing
Pattern your way
to automated regression testing |
Test networked
code the easy way
Test networked
code the easy way |
Maven ties together tools for better code management
Maven ties together tools for better code management |
Bug patrol
Bug patrol |
Worth
reading
Worth
reading |
Control your test-environment with DbUnit and Anthill
The inception of the Extreme Programming methodology has brought test-driven development and continuous integration into mainstream Java development practices. Applying these techniques to Java server-side development can quickly become a nightmare if you |
OpenSign
OpenSign
OpenSign is a java applet for signing text in a webbrowser using a PKCS-12 key-files or keys located in MS Crypto API CSP's in a Win32 environment.
The applet is based on code kindly provided by IT-Practice and everyone is encouraged to subm |
alt.lang.jre: Take a shine to JRuby
JRuby combines the object-oriented strength of Smalltalk, the expressiveness of Perl, and the flexibility of the Java class libraries into a single, efficient rapid development framework for the Java platform. In this third installment in the alt.lang.jre |
Groovy, Java\'s New Scripting Language
Groovy, Java\'s New Scripting Language
When some Java developers hear about Groovy, their first reaction often is, as mine was, "Oh, no, not another scripting language for Java." We already have, after all, JavaScript and Rhino, Jython, Jelly, BeanShell, |
Build scripts with Groovy and Ant
Build scripts with Groovy and Ant
Summary
In nearly all developers' toolboxes, Ant is the standard build tool for Java applications, thanks to its open, standard, and multiplatform structure. Though it represents a great improvement in automating produc |
Using the ASM Toolkit for Bytecode Manipulation
Using the ASM Toolkit for Bytecode Manipulation
Sometimes Java developers need to generate or change Java bytecode in the runtime. Is can be necessary for AOP or debugging, or even for performance optimization. There are several frameworks available that |
Practically Groovy: Unit test your Java code faster with Groovy
Why unit test with Groovy?
What makes Groovy particularly appealing with respect to other scripting platforms is its seamless integration with the Java platform. Because it's based on the Java language (unlike other alternate languages for the JRE, which |
Practically Groovy: JDBC programming with Groovy
Take your practical knowledge of Groovy one step further this month, as Andrew Glover shows you how to use GroovySql to build a simple data-reporting application. GroovySql combines closures and iterators to ease Java Database Connectivity (JDBC) programm |
|
|
|