utPLSQL/utPLSQL-SQLDeveloper

Run tests with code coverage

jgebal opened this issue · 2 comments

Currently utPLSQL can be invoked in two ways:

  • run tests
  • run coverage
    Ideally it should be:
  • run tests
  • run tests with coverage

So that:

  • test runner and test run progress is always visible
  • coverage can be inspected alongside test run

The option to run tests with coverage could replace current coverage menu option.

It would be great to be able to run tests with coverage from test runner UI. A new button next to run button could facilitate that.

You're right @jgebal. It does make much more sense this way, since code coverage is always executing tests.

Starting Position

The realtime reporter requires utPLSQL version 3.1.4 or later. This SQL Developer extension is designed to work with every utPLSQL 3 version. You can disable the realtime reporter in the preferences and then utPLSQL is called via a worksheet and the result is shown in the script output pane (result extracted from DBMS_OUTPUT). In this scenario it does not make sense to run utPLSQL with the code coverage reporter. It's doable, but it is most probably unwanted to have the code coverage HTML code also presented in the script output pane.

The code coverage reporter has the three optional parameters. a_coverage_schemes, a_include_objects and a_exclude_objects. These parameters can be defined in the "Code coverage report" dialog. Even if the default values are good, it is sometimes necessary to amend the values.

When running the code coverage reporter, the "Code coverage report" dialog stays open, so you can press the "Cancel" button to abort the run.

This "Code coverage report" dialog is still useful/necessary.

Solution Approach

I plan to do the following:

1. Code Coverage... in context menu of connections window and editor

If the realtime reporter is enabled, the code coverage runs there. The "Code coverage dialog" closes as soon as the report is started (no cancel option anymore). At the end of the run the code coverage report is extracted and shown in the default browser.

If the realtime reporter is not enabled, then the code coverage behaves as in the current version 1.1.1.

2. Add Code Coverage button in realtime reporter

"Code coverage dialog" is shown for all tests. Dialog works as described above.

3 Add Code Coverage... in context menu of realtime reporter

"Code coverage dialog" is shown for selected tests. Dialog works as described above.

Assessment

This solution approach is not exactly what @jgebal proposed, but it behaves the same way. The main difference is, that the context menu item Code Coverage... is not renamed to Run utPLSQL test with code coverage....