When I started to blog, I set myself the goal to publish one article per month. Maybe it was too ambitious, maybe I’ll have to learn to write shorter blog posts (which might not be possible because the reason I blog is to get a deeper understanding of a topic and reflect on it – something hardly doable with just scratching the surface).

Fact is I wasn’t able to publish for nearly 3 months and while I have some topics rumbling in my head I won’t just throw some unbaked thoughts on a blank page to satisfy a self-made deadline. Or grow a bigger audience.

This kind of little, personal posts is the only thing I’m willing to try (thanks Nate for your encouragement).
At the moment it feels a bit like writing a diary, but I will take it as an experiment.

The thing which kept me from writing for several weeks now is an amazing open source project named utPLSQL. It’s a unit-testing framework for PL/SQL and I started using it about a year ago when I needed a tool to help me getting a very much “grown” legacy project into a stable state.

After finding a bug around windows line breaks (yes, you can develop Oracle databases on Windows) and contributing a fix I had the pleasure to get in contact with the great guys working on the project. They were incredibly nice and helpful and so it was very natural to stay in contact.

Long story short – I finally ended up being the main contributor for the java-api and command-line-interface. It definitely helped that I could build upon a very good foundation and I learned an insane amount of new things which not only helped me in my job but also widened my horizon as developer.

Yesterday we successfully released version 3.1.0 of java-api and cli. I couldn’t include everything I wanted, but we pushed the project further and it was both fun and satisfying. There are some very positive effects of contributing to open source software I experienced, but that’s stuff for a different post.

To finally give this article at least a bit of technical value I will provide some short examples of the improvements of the new command-line-interface.

Custom Reporters

While utPLSQL v3 always supported custom reporters (besides the many built-in core-reporters), 3.1.0 is the first version of the cli where you can include them. It’s now not necessary anymore for the cli to know about the existence of a reporter, it will just assume there is one if you name it:

utplsql run user/pass@host:port/database -f=my_custom_reporter

You can use all parameters you can use for the core-reporters without restriction.

However you won’t be able to pass custom parameters to a custom reporter at the moment, so your custom reporter should not require constructor arguments. That’s a feature which will be addressed in a future release.

Local assets for CoverageHTMLReporter

Until 3.1.0 the output of the CoverageHTMLReporter required you to have an active online connection, because the assets to make that HTML report pretty were referenced from its GitHub page.

Now the necessary assets are integrated in cli and when you run your tests with the CoverageHTMLReporter they will be extracted to a folder named after the given output-file name with suffix “-assets”:

 
utplsql run user/pass@host:port/database -f=ut_coverage_html -o=coverage.html
ls -l
> coverage.html-assets/
> coverage.html

Real-time feedback

While previous versions of the cli had the default JDBC fetchSize of 10, the 3.1.0 cli will handle fetching differently for printing to screen and printing to file:

  • Printing to screen is done immediately with fetchSize 1
  • Printing to file is done in large bulks with fetchSize 100 to improve performance with many fast tests

NLS awareness from environment

This is something you’d expect when working a lot with Oracle on Linux: To tell your Oracle database to use specific NLS settings you just have to set “NLS_LANG”, “LC_ALL” or “LANG” environment variable.

The new cli is now aware of these environment variables and will adjust the java-locale and therefore the NLS settings through JDBC accordingly:

export LC_ALL=en_US.utf-8

The charset-part of LC_ALL is ignored.

There is more to come

utPLSQL is an incredibly powerful tool if you work and develop on Oracle databases. It has many features and tools, is in a very mature state and is actively developed by an awesome community.

There’s no reason not to let it help your database project.


2 Comments

Strongholds of confidence: self-testing your database | Clean Database Development · March 31, 2018 at 12:57 am

[…] I am engaged in the Open Source Unit-Testing framework utPLSQL I want to quickly show you how straightforward […]

Strongholds of Confidence: Self-Testing Your Database | OnCall DBA · April 5, 2018 at 6:49 am

[…] I am involved in the Open Source Unit-Testing framework utPLSQL I want to quickly show you how straightforward […]

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.