You can test Eclipse plug-ins the same way as any other Java applications,
with method-level or scenario-based test patterns.
Before creating a test for a plug-in, you must have a plug-in project
and a plug-in test project. If you do not already have a plug-in test project,
the wizard will help you create one.
Note: Plug-in test projects are not the
same as other test projects. If you are testing a plug-in, you must use a
specific plug-in test project.
To create a component test for an Eclipse plug-in:
- Click and then click Next.
This starts the Create Plug-in Component Test wizard.
- On the first wizard page, select the plug-in component test project
that will contain the new test or click New to create
a new plug-in component test project, and click Next.
At this point, a static analysis is performed on the plug-in source
files associated with the test project. These files were selected during the
creation of the plug-in 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.
- Select the components you want to include in the test and click Next.
- On the Select a test pattern page, select the test pattern that
you want to use and click Next.
- Follow the wizard steps exactly in the same manner as for a plain
Java component test.
The result is a new test suite along with a test behavior script
and one test case for each method selected.