17-6. Building a utPLSQL Test Suite

Problem

You have created numerous unit test procedures that you must run every time you modify your code. Running each test individually is both time-consuming and error-prone, as you may forget to run a test or two. You need a simple method to run all of your tests at once.

Solution

Use the utsuite.add command of utPLSQL to build a test suite, use the utPackage.add command to add individual unit tests to it, and then run the result. For example, here's how to build a suite to run the unit tests you developed in Recipes 17-3 and 17-4.

Create the test suite.

exec utSuite.add ('My Test Suite', 'Test all my functions');

Add individual unit tests to the suite.

exec utPackage.add ('My Test Suite', 'calc_quarter_hour'); ...

Get Oracle and PL/SQL Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.