PL/SQL has unit testing support and tooling, but my sense is that it’s far from the world of Java or Ruby. In most modern OO languages unit testing is just a part of the landscape. TDD is evolving to BDD with tools like RSpec and modern web frameworks come with unit testing support built in from Wicket to Rails.

It’s a little different in the Oracle world. Steve Feuerstein the evangelist for TDD and unit testing in PL/SQL mentions:

utPLSQL is used by many development shops, but not nearly enough to make it a standard in the PL/SQL environment.

The difference is JUnit is a defacto standard in the Java world. Steve developed utPLSQL to allow for automated unit testing in PL/SQL and has been pushing the idea ever since.

utPLSQL is a basic xUnit framework with assertions, setup and teardown. The interface is simple with no red/green bars just a ‘success’ message in ASCII art. There is a GUI front end runner called OUnit, but it hasn’t been updated in quite some time. The current leading edge unit testing tool is a commercial offering from TOAD called Quest Code Tester for Oracle.

Steve Feuerstein is the developer behind the tool. At first glance it looks like a nice option especially since we’re a TOAD shop. I’ll probably delegate it out to one of our developers to really look into it. The questions I still have are:

  • Write a failing test. Write the code to make it pass. Refactor. How painful is manual refactoring in a procedural language?
  • How do you hook up the test runs to a continuous integration server? And are you tied to the TOAD tool?
  • How do you deal with all the actual dependencies on data in tables for tests.
  • How do you avoid slow running tests?