Stubs are classes that provide replacement implementations for
the actual classes that the code you are testing interacts with. In this release,
stubbed session beans must be deployed on IBM® WebSphere® Application Server (WAS)
5.x, and there is no support for stubbing entity beans. You can view the stubs
that have already been created by looking in the Package Explorer view or
the Test Suite editor.
To create a stub for an EJB session bean:
- Click and click Next.
- On the first wizard page, do one of the following:
- Select the test project that will contain the stub and click Next.
- Or click New to create a new test project.
- On the Select the Components to be Stubbed page, select the EJB
components, libraries, or Java™ source files you want to stub and click Finish. If the stub component already exists, the wizard prompts you to replace
the existing stub. If you select Yes or Yes
to All, then any changes you have made to the existing stub will
be overwritten. If you select No or No to
All, then the existing files remain unchanged and a new stub is
not generated.
- In the Test Navigator view, double-click the test suite that you
want to add the stub to. This opens the Test Suite editor.
- In the Test Suite editor, click the Stubs tab,
click Add, select the stub you want to add to the test
suite, and click Finish.
Note: To create a new stub and
add it automatically to the test suite, click New and
proceed with Step 3.
To replace the stub with the real class at any time, simply remove
the stub from the test suite.