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

Generating Stubs and Lookup Tables

56
Chapter 3 - Testing Enterprise JavaBeans
Generating Test Scripts with the EJB Session Recorder
If you have already built or partially built a component, you can use the EJB Session
Recorder to interact with the component and generate test scripts. For details, see
Using the EJB Session Recorder on page 82.
Generating Stubs and Lookup Tables for the Unit Test
With QualityArchitect, you can create stubs for session beans and test any component
that calls that session bean.
When you generate stubs for session beans, QualityArchitect creates Java source files
for the home interface, the remote interface, and the implementation class itself. After
generating stubs, you can deploy them on your application server, where they replace
the real session beans.
Note:
Stubs must be deployed on the same computer as the test script.
Templates used for generating EJB session stubs include:
s
Session_Bean.template
s
Session_Home.template
s
Session_Remote.template
s
MethodBodyWithoutLookUp.template
s
MethodBodyWithoutExceptions.template
s
MethodBodyWithoutReturnValue.template
s
MethodBody.template
Because the
getBalance
method calls methods in the
ManageAccounts
EJB, you
can either generate a stub or run the tests directly against the actual
ManageAccounts
EJB.
To generate the stubs:
1
Right-click the
ManageAccountsBean
class in the Rose browser and click
QualityArchitect > Generate Stub
.
2
Select a directory for storing the stubs.
3
Click
OK
.
QualityArchitect generates stubs for:
The remote interface,
ManageAccounts.java
The home interface,
ManageAccountsHome.java