You can use an abstract test to test Java™ interfaces,
abstract classes, and superclasses. When you create an abstract test, the
result is a test scenario that can be reused with any implementing class.
Abstract tests cannot be run on their own and do not include a
test suite. To run an abstract test, you must make the test concrete, that
is, apply the abstract test to a public class that implements the interface,
extends the abstract class, or inherits from the superclass. You can make
an abstract test concrete at the time of test creation if there are implementing
classes available or at any time after the abstract test has been created.
To
create an abstract test for testing Java interfaces, abstract classes, and superclasses:
- Click and click Next.
This starts the Create Abstract Java Component Test wizard.
- On the Select a test project page, select the component test project
that will contain the test or click New, create a new
component test project, and click Next.
- Select the class or interface for which you want to create an abstract
test and click Next.
- Select each method that you want included in the test and click Add or
simply double-click the methods you want included from the available methods
list. (The selected methods are added to the test scenario in the bottom half
of the page.)
- Do one of the following:
- If there are implementing classes available, click Next,
select the constructors you want to use in the test, and click Finish.
- Otherwise, click Finish and implement the test
afterwards when you have implementing classes available. You can use the "Implement
an existing abstract test" feature to make the abstract test concrete. Note
that the abstract test cannot be run if there are no constructors available
to instantiate the object.
When you implement the abstract test, the result is a test suite
with one test case and a test behavior script for each implementation. In
addition, there will be a test behavior script for the abstract test itself.