Unit testing PL/SQL stored procedures with JRuby (Part I)

Synopsis

My PL/SQL code that's running on Oracle doesn't have proper unit tests so far. The main reasons for this are
- lack of tooling (neither utplsql nor QuestCodeTester nor the SQL Developer built-in has satisfied me so far)
- lack of time (lame excuse, I know)

So I decided to once more tackle the problem.

Past experiences

Until now, I've tried the following approaches:

utPLSQL

Pro

- runs directly in the database => no additional setup necessary
- syntax errors in the unit tests / procedure calls are caught by the compiler
- same language for Code Under Test and unit tests

Con

- PL/SQL is quite limited in its expressiveness
- Integration in a CI environment for automatic builds / reporting build failures requires additional work

MRI Ruby with oci8 and Cucumber Spec files

Pro

- Ruby (it's such a wonderful language, really)
- Gherkin syntax for spec files

Con

- complicated deployment in CI environment (requires at least an Oracle instant client installation)
- even more complicated to set up on Windows (requires Devkit to compile the native extension oci8)

.NET with SpecFlow

Pro

- excellent IDE (Visual Studio)
- Gherkin syntax for spec files

Con

- Windows only (although Mono might be viable, but setting this up with ODP.NET / Oracle client seems quite complicated)
- C# is quite verbose (F# might be an alternative, though)

Java with Maven, JUnit / Cucumber-JVM

Pro

- real cross-platform
- easy deployment (no need for the Oracle client - just include ojdbc7.jar)
- Gherkin syntax for spec files

Con

- Java is incredibly verbose (Scala / Kotlin might be an alternative, though)
- Maven (enough said)

A new horizon

Requirements

My new solution should be:
- easy to deploy (no full-blown Oracle client necessary)
- really cross-platform (Windows, Linux, Mac OS X; Docker integration not strictly necessary, but would be very nice)
 - joyful (this excludes Java as a language, Maven as a build tool, and several others)

Choice

For now, I'll go with:
- JRuby (Ruby + JVM = dream team)
- Gradle (although I might switch to Rake)
- RSpec (although I might switch to Cucumber if I want a more high-level solution)


413 Words

2016-12-09T08:35:00.002-08:00