主要内容

Find Existing Tests for Function in Polyspace Platform User Interface

You can author graphical tests for C/C++ functions in the Polyspace Platform user interface. When you author a new test for a function, to avoid repetitions, it can be helpful to know if any existing tests already call the function. This topic shows how to:

  • Find the tests that explicitly call a given function as code under test.

  • Find all tests that call a given function, either intentionally as code under test or incidentally as a callee of the code under test.

Find Tests Written for Function

To find which graphical tests are explicitly invoking a function:

  1. Open the Polyspace® Platform project containing your source code.

  2. On the toolstrip, select Parse Code.

    For more information on code parsing, see Parse Source Code for Auto-Populating Test Information in Polyspace Platform User Interface.

  3. Select the Code Explorer button on the toolstrip.

  4. On the Code pane, find the function through search.

  5. Select the function. The Property pane shows the graphical test steps that directly call the function, listed in the property Code Under Test in.

    In this image, the Property pane shows that the function update() is being called in two tests, update_test_1 and update_test_2. In both tests, the function is called in the step Step_ID1.

    Property pane shows an entry "Code under test in", which lists the test steps directly calling a function.

  6. Right-click the test step that you want to see and select Open Test Step.

Find Tests Calling Function

To find which tests are covering a function by calling it directly or indirectly:

  1. Open the Polyspace Platform project containing your source code.

  2. Enable code coverage computation, build the project, and run all tests in the project. For more information, see Calculate C/C++ Code Profiling Metrics in Polyspace Platform User Interface.

  3. Open the code coverage results and locate the function on the Results List pane by inspection or by using the Show only filter on the toolstrip.

  4. Select the function name. The Result Details pane shows which tests are covering the function.

See Also

Topics