How can we create a report for showing the test result output of utplsql testing. The output of utplsql appears on screen when we run ut.run('package_name'). How can we store it somewhere and display it in report format in apex application .
-
See similar questions: [one](https://stackoverflow.com/questions/15803779/showing-trigger-dbms-output-put-line-in-oracle-apex), [two](https://stackoverflow.com/questions/58443983/returning-a-value-using-dbms-output-put-line-and-out-parameter-in-an-oracle-proc). It's not a very good design. But I would try adding a second page process which calls `dbms_output.get_lines` and adds the output lines to an Apex Collection. Then display the collection as a report. – kfinity May 29 '20 at 17:48
1 Answers
You can run it as a query as well:
select * from table(ut.run('package_name'))
This gives the output as a query result, which you can use in your reports as you like. I'm often using nothing else, just have a query like this running on repeat in PL/SQL developer.
Note that there are other ways to run the tests as well. First of all, you can use different reporters that output the tests in different formats, from human-readable to formatted for specific automated testing tools, as well as integrations with the most popular database management tools, like TOAD, DataGrip and of course SQL Developer.
Also, there is a command line interface from which you probably could dump the output to files.
The documentation provides the chapter Running unit tests, (3.1.10) that demonstrates various ways.

- 114,394
- 18
- 182
- 210