Browsing Related Tests

Use the Related Tests Browser to view what unit tests cover a method selected in the Methods List of the Class Browser, Interface Browser, or Primitive Types Browser.

The Related Tests Browser Options pane enables you to configure preferences and filter settings for searching within the Related Tests Browser. For details, see "Browser Options Pane", later in this chapter.

To open the Related Tests Browser for a method

The Related Tests Browser can also be opened for a class, interface, or primitive type selected in the Class Browser, Interface Browser, or Primitive Types Browser, respectively. Right‑click on the selected item and then select the Related Unit Tests Browser command from the Classes, Interfaces, or Types menu.

The Related Tests Browser is then displayed at the right of the Editor pane, as shown in the following image.

The Related Tests tab is displayed if you have multiple‑sheet functionality enabled. For details, see "Displaying Multiple Sheets in the Editor Pane", earlier in this chapter.

Any unit tests that reference the selected method are then are listed in the search results of the Related Tests Browser. This includes non‑direct calls (that is, there could be a number of methods between a unit test and the method of interest).

If you view the related tests for a different method or class, the details are displayed in another sheet in the Related Tests Browser. Click the tab of the sheet whose related tests you want to view. To close a sheet, right‑click on that tab and then select the Close Tab command from the popup menu that is displayed. Alternatively, middle‑click with your mouse on that tab.

This browser performs the following layers of searches.

  1. Initial results view

    The initial search displays the unit tests that cover a method.

    The first item in the search list is the method of interest, the second‑level items are schemas, and third‑level items are all of the unit tests for that schema that have been found to exercise that method. Right‑click on a unit test and then select the Search code paths command to open the Code path view in a new sheet.

  2. Code path view

    The code path view displays the call path result of the first search that found the selected unit test.

    An additional entry is added at the bottom of the results list that, when expanded or double‑clicked, initiates a thorough search for all code paths, which opens the All code paths view in a new sheet.

  3. All code paths view

    The all code paths view searches from that unit test to the original method of interest. The results are displayed in another sheet.

If the search is taking a long time, try reducing the value in the Maximum Search Depth text box on the Browser Options pane.

The maximum search depth for the Related Tests Browser is different from the other supplementary browsers in that the search performed traverses the metamodel to the maximum specified depth and then adds the items to the list (in the other two browsers, the lists are built as you expand each element).

Call paths that extend hundreds of levels deep should not be treated as meaningful evidence that the unit test is exercising the selected method. At that distance, the link between the test and the method is incidental; the method is executed only as a side effect of other logic, not as the direct focus of the test.

The intent of a unit test is to verify behavior in a targeted and controlled scope. While deeper traversal could still be useful for exploration or impact analysis, it should not be interpreted as proof that a test genuinely validates the selected method.

To view call paths from a unit test to see what that unit test actually tests, use the Call Hierarchy Browser to view all code exercised by the selected test. For details, see "Browsing Method Calls", earlier in this chapter.

Click the Expand all nodes button at the right of the Related Tests Browser to expand all of the nodes in the related tests hierarchy list.

To search the related tests that you are currently viewing

  1. In the Search Related Tests search box, enter some or all of the text for which you want to search.

  2. Click the Search button or press Enter.

Elements in the related tests list that contain the text are then highlighted using the Selection Background color specified on the Editor sheet of the User Preferences dialog (for details, see "Maintaining the Editor Display", in Chapter 2). In addition, the status line displays the search term and the number of matching results. If no match is found, (not found) is displayed at the right of the search term in the status bar.

Click the Refresh button to clear the current list box and perform the same search again. This is useful if the view of the first search is now outdated (as a result of class, method, property or schema deletions).

The following table lists the commands that are displayed when you right‑click on an element in the Related Tests Browser list.

Command Action
Search code paths

Initiates a search for all code paths from the unit test to method end‑points. The code paths are displayed in a new sheet, adjacent to the Related Tests Browser list box. This command is available only if the selected element is a unit test.

References Opens the References window for the selected method.
Implementors Opens the Update References window for the selected method.
Implementor References Opens the Read References window for the selected method.
Run selected unit test

Runs the selected unit test or tests.

If tests are selected to run from multiple schemas, one Unit Test Runner form is opened for each schema in the selection.

Click the Menu button at the upper left of the Related Tests Browser and then select one of the following commands as required.

2025.0.01 and higher