January 06, 2010
Screencasts of Oracle PL/SQL unit testing with Ruby
In my previous post I already described how to do Oracle PL/SQL unit testing with Ruby. I now have named it as ruby-plsql-spec unit testing framework. But probably you didn’t want to read such long text or maybe it seemed for you too difficult to try it out therefore I prepared two screencasts to show how easy and fun it is :)
Testing simple function
The first example is based on classic BETWNSTR function example from utPLSQL tutorial.
Testing procedure that changes tables
Second example is based on Quest Code Tester for Oracle testing tables demo screencast. So you can see both unit testing frameworks in action and can compare which you like better :)
Test driven development
In both these screencasts I demonstrated how to do test driven development of PL/SQL
- Write little test of indended functionality before writing code.
- Write implementation of new functionality until this test passes and verify that all existing tests pass as well.
- Refactor implementation when needed and verify that all tests still pass.
From my experience TDD style of development can improve design and testability of code and also make you think before coding what you actually want to implement. But existing visual PL/SQL testing tools (Quest Code Tester, SQL Developer 2.1) do not quite support TDD style of development, they expect that there is already existing code that should be tested. Therefore this is one more ruby-plsql-spec advantage if you would like to do TDD style development in PL/SQL.
More information
Examples shown in screencasts are available in ruby-plsql-spec GitHub repository. And if you want to see more examples how to use ruby-plsql library for PL/SQL unit testing then you can take a look at ruby-plsql own RSpec tests or read previous posts about ruby-plsql.