You use the Recording Studio perspective of the IBM® DevOps Test Integrations and APIs (Test Integrations and APIs) to create
a database stub while SQL events are being recorded from a database.
To create a database stub, you must record SQL statements from a live
application to populate the stub with data from the live database. Each SQL SELECT
statement that is recorded will be analyzed by Test Integrations and APIs and the
corresponding results from the live system will be copied into the database stub that is being
"learned" during recording. Test Integrations and APIs attempts
to copy the data matching the SQL WHERE clause.
For example,
if the recording contains only the reading of one customer, the database stub will contain only data
about that customer. Alternatively, if the recording contains the reading of, say, all customers
with the first name "John", the database stub will contain the same data.
Note: If
there is no primary key on a database table that is being "learned", the simulation database might
contain duplicate records when the learning is complete. A warning message is displayed in the
Recording Studio warning message block and the server activity log if Test Integrations and APIs detects a
table without any primary keys.
To create a database stub from recorded SQL events:
- In the Recording Studio perspective, select
(for recording) the database that you want to stub.
- Click the Record button
(
) on the Events View toolbar. The Create Stubbed Database Whilst Recording? dialog is displayed.
Note: The
dialog shows the last inserted values, if any. You can retain the values or edit
them.
- Click the Yes, record the SQL
and create a virtual database option button.
- Click the Create a database stub
and start it option button or the Create a database
stub but don't start it option button.
- In the Stub name field, enter a name
for the stub.
- Click Start Recording.
- Run a test case or a test case suite against
the live system to populate the stub with sufficient data to make
it useful.
You will be able to add more
data to the stub later. During recording, Recording Studio will display
information relating to stub creation, such as messages about database
table creation. However, the stub will not be created until you
stop recording.
- On the Create Stubbed Database Whilst Recording?
dialog, click Stop Recording.
If you had selected the Create a database stub and
start it option or the Create a database stub but don't
start it option, the stub is now created.
If
you had selected the Keep learning option, you must execute
another (or perhaps many more) stub recording sessions to generate
sufficient SQL to create the stub.
In the Test Factory perspective, the newly
created database stub is displayed under the relevant logical resource
on the component tree.
You can
now start, stop, or modify the new database stub.