background image
<< Populating the Datapool | Populating the Lookup Tables >>
<< Populating the Datapool | Populating the Lookup Tables >>

Generating Stubs and Lookup Tables

106
Chapter 4 - Testing COM Components
4
Click
OK
to close the Datapool Properties dialog box.
5
Click
Close
to close the progress bar.
The following code fragment shows the datapool name and the parameter (column)
names embedded in the test script:
Note:
For more information about datapools, see Datapools on page 23, the Test Script
Services for Visual Basic manual, and the online Help for Rational TestManager.
Generating Stubs and Lookup Tables for the Unit Test
With QualityArchitect, you can create stubs for any component called by the
method-under-test. COM stubs are generated from classes that are stereotyped as
coclasses.
When you generate stubs, QualityArchitect creates Visual Basic class files that you can
copy into your Visual Basic project and use in place of actual components. Simply
replace the actual component with the stub and recompile the project.
Stub generation also creates a lookup table for each method in the stub called by the
method-under-test. Lookup tables are based on Rational datapool technology.
Whereas a datapool is used to test inputs and expected behavior, a lookup table is
used with stubs to simulate the behavior of an actual component.
Because the
MoveMoney
method calls methods in the
Account
class, you can either
generate a stub or run the tests directly against the actual
Account
class.
dp.Open "_MoveMoney_Perform_D"
'Loop over datapool and perform test.
While dp.Fetch
'Keep counter of number of rows fetched.
NumRows = NumRows + 1
'Get the column data from the datapool.
lPrimeAccount = dp.Value("lPrimeAccount")
lSecondAccount = dp.Value("lSecondAccount")
lAmount = dp.Value("lAmount")
lTranType = dp.Value("lTranType")
expRet = dp.Value("expectedReturn")
expErr = dp.Value("expectedError")
Datapool name
Column names