Implementing an existing abstract test
To run an abstract test, first 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; otherwise, you can make the test concrete afterwards by explicitly applying the abstract test to an implementing class. You can reuse the abstract test with any number of implementing classes.
To implement an existing abstract test:
- Click File > New > Other > Component Test > Java > Java Component Test and click Next.
- On the Select a test project page, select the test project that will contain the test or click New, create a new project, and click Next.
At this point, a static analysis is performed on the Java source files associated with the test project. These files were selected during the creation of the test project and serve to define the scope of the test. (The list of files in the project can be updated by modifying the test project's Test Scope properties.)
When the analysis is complete, you will see a list of components in a table format and sorted according to the computed metrics. You can use the guidance that these metrics provide to help you decide which classes or components are most important for you to test. Components with highlighted values or high numerical values are considered high-priority test candidates.
- On the Select the component under test page, select the component for which you want to implement the abstract test and click Next.
Note: An abstract test can only be applied to one component at a time.
- On the Select a Test Pattern selection page, select Implementation of abstract test and click Next.
- On the Apply an Existing Abstract Test page, select the previously defined abstract test and the constructor used to create an instance of the component under test. Then click Finish.
The result is a test suite, test case, and test behavior script.
Related concepts
Static metrics
Java interfaces, abstract classes, and superclasses
Related tasks
Creating abstract Java tests
Related reference
Static metrics reference