Method-level testing exercises the different conditions
defined in the method code in isolation from other methods, allowing you to
test each individual method independently. The focus is generally to ensure
that the method correctly processes all of its possible inputs.
To create a method-level Java™ test:
- Click and then click Next.
This starts the New Java Component Test wizard.
- On the first wizard page, select the test project that will contain
the test or click New to 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.
See Changing the scope of a test
project) for details.)
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.
- Select the Method-level testing test pattern and click Next.
- On the Select the methods to be tested page, select the individual
methods you want to test and click Finish.
The result is a new test suite along with a test behavior script
and one test case for each method selected.