17-9. Redirecting utPLSQL Test Results to a File

Problem

You are interested in writing the results of a unit test to a file.

Solution

Change the setting of the setreporter option of utPLSQL so that output is redirected to a file instead of DBMS_OUTPUT. Once the configuration has been altered, execute the unit tests for which you would like to have the output captured to the file. After you've run your tests, close the file and change the configuration back to its default. In the following lines of code, all of the steps that are necessary for redirecting test results to a file are exhibited. For example, suppose that the database has a directory that has already been enabled for use with the database named FILE_SYSTEM.

SQL>  BEGIN   utconfig.setfiledir('FILE_SYSTEM'); ...

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.