Code Testing Features in SQL Navigator 6

advertisement
Code Testing Features in SQL Navigator 6.3
Starting with v6.3, SQL Navigator provides an improved stored program execution GUI/workflow,
which incorporates some Code Testing features based on the API to Quest Code Tester for Oracle
(QCTO). Code Testing in SQL Navigator is limited to the ability to create, edit and run simple test
cases, such as verifying that the values of output parameters match specified values and that the
program raises no exceptions or an exception with the specified code.
New Execution GUI
Like in previous versions, to run a stored program the user has to press F9 or the equivalent toolbar
button (“the green triangle”). Unlike those versions, following F9 or Execute Procedure/Function
from toolbar SQL Navigator 6.3 displays a new sub-tab (named “Run”). This tab is intended to
provide the user the ability to select an entry point (for packages), enter the input values of the
parameters and choose various options, such as profiling, directing the results to DBMS_OUTPUT
etc. In addition, the Run tab contains a new Code Test panel:
As in previous versions, the user has to enter the input parameters and then press F9 or Execute
Procedure/Function again to actually run the procedure/function. After the execution, the output
parameters and function result will show in the parameter grid as a new (read-only) column:
Note that the grid has the following “check-box” columns:
Def – ticked means that no input value is passed (default is used, if defined)
Null – ticked means that the input or output value is NULL
Exp – ticked means that the input value is a PL/SQL expression
Creating, Editing and Running a Test
To be able to create and run test cases, the user needs to install QCTO repository first. Unless it’s
already installed, most controls in the Code Test panel will be disabled.
Creating a test case from Run tab can be accomplished in one of two ways. The first and the easiest
one is simply to tick the “Auto-create test case after code execution” check box and then run the
procedure/function. This will immediately create a test case after execution is complete based on
the parameter values (both input and output) currently displayed in the grid. The second way is to
create it manually by pressing the New button. This will bring up the Test Case Properties dialog:
As you can see, the parameter grid is pre-populated with the values from the Run tab. The name
field is also pre-populated with some random text. Normally the user doesn’t have to change
anything, just press OK to save or Cancel if they don’t want to. However, they may do any changes to
the parameters (e.g., specify Expected output as an expression), change the name, specify the error
code to expect (i.e. the test will fail if an error with the specified code doesn’t occur) or the expected
elapsed time (i.e. the test will fail if the actual elapsed time exceeds the expected value).
After a test is created, it can be edited by pressing the Edit button on the Run tab (this will bring the
same Test Case Properties dialog) and run by pressing the Run Test button. After the test is run, its
status is updated in the Run tab:
Or, if the test fails, it will look like this:
The other buttons in the Code Test panel have the following meaning:
Delete – deletes the current test case
Test -> Param – copies values of the input parameters from the current test case into the parameter
grid
Param -> Test – copies values of the parameters (input and output) from the parameter grid into the
current test case
Manage – displays the Code Test window (see below) for the current object
Managing Test Cases
The Code Test window (also known as Test Manager) displays all test cases currently defined for an
object, grouped by entry point if it’s a package. It allows the user to create new test cases, edit
them, run multiple test cases and delete them. It looks like this:
As a convenience feature, Test Manager provides ability to search for a particular test case either by
part of its name or some text contained in its parameters. To search, simply enter the text in the
“Search for:” text box, select where to search in the “in:” combo box and press the Search button.
To run a test or tests, they have to be selected using the check boxes on the left hand side. As test
cases run, their status in the Status column will change:
Download