With Spock, application testing is only logical

Tapestry creator says developers must test, and who would argue with Spock?

Software developers often have a lot of excuses for not doing application testing, says consultant Howard M. Lewis Ship, creator of the Apache Tapestry Web development framework. But he is not buying any of them.

During a presentation Tuesday at the Emerging Technologies for the Enterprise conference in Philadelphia, Ship listed reasons developers do not test their code:

  • It is hard to get started.
  • Code is too monolithic.
  • More code is more code.
  • Test code is hard to maintain.
  • The tests broke and nobody fixed them.
  • Developers believe their code is already perfect.

But Ship stressed the importance of testing just the same, despite any burdens it might entail. For testing Java and Groovy apps, Ship advocates a framework that shares a name with perhaps the most beloved science fiction character of all time: Spock, of "Star Trek" TV and movie fame.

"What if we had a system where we had test code that was actually readable? What if we had a system where the test code was concise, so you cut through all the clutter," Ship asked. "What if failures themselves were really well-described so you could figure out exactly what's wrong?"

This is where Spock comes in. Created four years ago, the open source Spock framework serves as a Groovy domain-specific language for testing and rests atop of the JUnit 4 Java testing framework. "Its goals are to keep your tests concise and maintainable," Ship said.

More about software testing

Get an overview of three testing methodologies -- Test driven development, Behavior driven development, and Acceptance test driven development -- then try testing a Spring application with the Scala-based Specs2 Spring framework.

Want more Java enterprise news? Get the Enterprise Java newsletter delivered to your inbox.

Ship is not a developer of Spock but is nonetheless a champion of the framework. He also acknowledges alternatives, such as the Cucumber framework.

Whether developers use Spock or some other testing framework, they need to test their code. Reducing errors in code and getting software to work correctly before it is deployed and causes big problems is only logical. With software testing, developers' builds are more likely to live long and prosper -- and ultimately saving developers time and effort.

This story, "With Spock, application testing is only logical," was originally published at InfoWorld.com. Get the first word on what the important tech news really means with the InfoWorld Tech Watch blog. For the latest developments in business technology news, follow InfoWorld.com on Twitter.

Copyright © 2013 IDG Communications, Inc.

InfoWorld Technology of the Year Awards 2023. Now open for entries!