Modifying database stubs

You can modify database stubs in HCL OneTest API.

When you open a database stub in Test Factory perspective, the Database Stub Editor screen is displayed. The following table describes the tabs that are available on this screen:

Tab Functionality
Summary This tab contains global information about the currently selected database stub.

The tab contains the following:

  • An editing options toolbar, which is context sensitive (for information about this, refer to The editing options toolbar).
  • A Persistent check box for specifying whether a database stub is persistent or non-persistent (for information about this, refer to Creating and modifying database stubs).
  • Option buttons for controlling default invocation matching and error behavior for any stored procedures in the currently selected database stub.
  • Summary information about the physical and simulation databases associated with the currently selected database stub.
Pass-through This tab provides the pass-through capability for database stubs. A database stub can call a live database depending on the following pass-through settings:
  • Enable pass-through. If unselected, the database stub calls the virtual database. If selected, all the pass-through settings are enabled. For more information, see each setting description for its behavior.
  • Pass-through unlearned tables. If selected, any ResultSet-based statements that contain tables that are not already contained in the stub are replayed on the real database instead of the virtual database. If not selected, the behavior remains as it is now for query statements. The default is on for a new database stub.
  • Pass-through unlearned stored procedures. If selected, any stored procedure call that is not already contained in the stub, is replayed on the real database instead of the virtual database. If not selected, the behavior remains as it is now for stored procedures. The default is on for a new database stub.
  • Pass-through unlearned INSERT/UPDATE/DELETE statements. If selected, any Data Manipulation Language (DML) statement containing a table that was not learned is replayed on the real database instead of the virtual one. If not selected, the behavior remains as it is now for DML statements. Default is off for a new database stub.
  • Automatically Learn Queries after pass-through (workbench only). If a query statement is passed through to the real database, the returned results are automatically learned by the database stub. The default is off for a new database stub. You must select the Persistent option, and run the database stub must be run from the HCL OneTest API workbench for this option to work.
  • Empty Results. Select which tables you want to pass-through if there are no results returned when executed against the virtual database. This can be done on a table-by-table basis. The list of tables that you can select contains all the learned tables in the database stub. By not selecting a table, empty results returned by the database stub are acceptable for queries containing that table. For information about using the pass-through settings, see Example: Using pass-through in database stubs.
Queries

This tab lists any SQL queries that were recorded during learn mode.

The tab includes an Editing Options toolbar, which is context sensitive (for information about this, refer to The editing options toolbar) You can also access these editing options by right-clicking any part of the window on the stub.

Tables

This tab displays any database tables contained in the stub. For each table, the table name and the row and column counts are displayed.

The tab includes an Editing Options toolbar, which is context sensitive (for more information, see The editing options toolbar.)

Stored procedures
With this tab, you can:
  • Add new stored procedures
  • Add new invocations to an existing stored procedure.
  • Modify invocation matching and error behavior of a stored procedure
The tab contains the following:
  • An Editing Options toolbar, which is context sensitive (for information about this, see The editing options toolbar.)
  • A Procedure list for selecting a stored procedure in the currently selected database stub.
  • An Edit button to enable you to use an external application (for example, Microsoft Excel) to create or edit a stored procedure.
  • Option buttons for specifying matched and unmatched invocation behaviors.
  • An Invocations toolbar that enables you to add, reorder, and delete invocations for the currently selected stored procedure.
  • An Invocations table that displays the input parameters to the currently selected stored procedure and a summary of the outputs from the stored procedure.
Sequences

This tab displays any sequences contained in the currently selected database stub. For each sequence, the name and start value are displayed.

The table includes an Editing Options toolbar, which is context sensitive (for information about this, see The editing options toolbar.)

Logging This tab enables you to define how much information is recorded while the currently selected stub is being executed.

Any information recorded will be logged in HCL OneTest API project results database and on the Test Factory perspective Console window.

Options are as follows:

  • None (no information is logged).
  • Normal (standard information is logged).
  • Debug (verbose information is logged)
Documentation This tab enables you to enter extra information about the currently selected stub and some of this extra information will be displayed in HCL® Quality Server Start Stub dialog (for information about this dialog, refer to Starting stubs).

Although you do not have to enter such information, it may help future users of your stub and it may also help you to identify in HCL® Quality Server which stub you want to start if you have created several for the same database.

For more information about using this tab, which is a standard tab on many dialog boxes in HCL OneTest API, see API Tester Reference.

The following describes how to use Summary tab.