background image
<< Sample Application | Templates for Stub Generation - EJB >>
<< Sample Application | Templates for Stub Generation - EJB >>

Generating Stubs

20
Chapter 2 - Basic Concepts
The lookup table contains one or more columns for each parameter of the operation
being stubbed. QualityArchitect uses the values in the columns to determine how the
operation should behave. If the operation is supposed to return a value, the value is
shown in the
expectedReturn
column. If the operation is supposed to throw an
exception, the type of exception is shown in the
expectedException
column. Any
Java class that extends java.lang.Throwable is a valid value for the
expectedException
column.
The stub looks up the row containing the inputs matching the parameter values
passed in by the component-under-test--that is the caller of the stub--and either
returns the value in the
expectedReturn
column or throws the exception in the
expectedException
column.
To generate stubs:
1
In the Rose browser, right-click the implementation class you are testing and click
QualityArchitect > Generate Stubs
.
Note:
COM stubs are generated from classes stereotyped as <<coclass>> from the
COM Type Library.
2
Select a directory for storing the stubs.
For more information about stubs for EJBs, see Generating Stubs and Lookup Tables
for the Unit Test
on page 56. Fo
r more information about stubs for COM
components, see Generating Stubs and Lookup Tables for the Unit Test on page 106.
A lookup table is created automatically, with the name
ClassName
_
OperationName
_L--for example
ExecuteTransaction_getBalance_L
.
3
Use the datapool manager to populate the lookup table with data.
For information about populating lookup tables for EJBs, see Populating the Lookup
Tables
on page 57.
For information about populating lookup tables for COM
components, see Populating the Lookup Tables on page 107.
Note:
Stubs must be deployed on the same computer as the test script. Otherwise,
playback will fail.