17-3. Building a utPLSQL Test Package

Problem

You would like to build a unit test package for one or more of the PL/SQL objects in your database schema.

Solution

You want to build a utPLSQL test package to test an object in your database. A test package consists of two separate files, a package header and a package body.

Create a header for the test package and save it in a file with the same name you have given the header and with a .pks suffix. A header file contains three procedures: ut_setup, ut_teardown, and the procedure that performs the unit tests of the target object in your database. For example, suppose you want to create a unit test package to test the code for the CALC_QUARTERLY_HOURS function of Recipe 17-1. This package header ...

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.