background image
<< Generating EJB Test Assets | Selecting Template >>
<< Generating EJB Test Assets | Selecting Template >>

Generating Unit Test Scripts

52
Chapter 3 - Testing Enterprise JavaBeans
Generating EJB Unit Test Scripts and Datapools from a Rose
Model
To try out the QualityArchitect unit test generation feature, you can use the sample
model that is included with the Rational Bank Account Sample Application. For
example, try generating a unit test for the
getBalance
method, which is part of the
remote interface named
ExecuteTransaction
. This method is used to obtain the
current balance from the specified account.
The
getBalance
method calls three methods from the
ManageAccounts
session
bean. The three methods are
getSavingsCustomerID
,
getSavingsBalance
, and
getCheckingBalance
. All of these methods take noncomplex objects as
parameters.
To generate the unit test:
1
If you haven't already done so, create a project with the Administrator for
maintaining your test assets.
For details, see Adding a Project in the Administrator Help.
2
Start Rose and open the
ratlbankacct.mdl
model.
3
In Rose, right-click the
getBalance
method and click
QualityArchitect > Select
Unit Test Template
.
4
Do one of the following:
Select the
websphere_remote.template
and click
Open
if you are working in a
WebSphere environment.
getBalance
method