Main Content

Update Projects in Polyspace Platform User Interface

You can keep a Polyspace Platform project in sync with your source code repository throughout software development. In some cases, the project is updated automatically based on changes to your source code, while in other cases, you might have to perform some additional actions to keep the project updated. This topic lists some actions you can do to keep your project in sync with the latest sources.

Update Sources

When creating a Polyspace® Platform project, you can manually add source files or add them automatically by tracing your build command. Depending on how you created the project initially, you have to follow different steps for updating the project. For more information on project creation, see Create Project and Add Source Files in Polyspace Platform User Interface.

Update Sources in Manually Created Project

If you added source folders manually to a project, each time you add new files to those folders, the project can be refreshed to show the newly added files.

The refresh happens automatically when you reopen the project Polyspace Platform user interface or add more folders to the project. You can also explicitly refresh the project:

  1. Select the project on the Projects pane.

  2. On the Polyspace Platform toolstrip, select the refresh sources button.

Update Sources in Project Created from Build Command

If you created a project automatically from your build command, you have to retrace your build command to sync the project with the latest sources:

  1. On the Projects pane, right-click the root node of the project and select Update Using Build Command.

    Alternatively, with the project selected, you can select the refresh sources button on the Polyspace Platform toolstrip.

  2. In the Update project window, you see the build information that was originally entered to create the project. Click Run to recreate the project from your current build information.

When you update a project created from a build command, the following configuration options are erased and re-entered in the project:

  • Source files in the project, in other words, the entries for the option Application source files and Application source folders.

  • Include paths in the project, in other words, the entries for the option Include paths (-I).

  • All options in the build configuration created from the build command.

    In particular, if you created a project from a build command and later modified some options, your modifications are lost during the project update. You can retain your modifications by duplicating the build configuration, and following an update, copying back the modifications from the duplicated configuration variant. For more information on configuration variants, see Configure Project for Static Analysis in Polyspace Platform User Interface.

Update Tests

This section applies to only to users authoring graphical tests using Polyspace Test™.

When you update existing functions or data types in your source code, you can automatically update an existing graphical test to use the revised function prototype or type definitions. Any existing test information that is still applicable is retained during the update.

You can change a function signature in various ways including the following:

  • Renaming the function.

  • Adding or removing a parameter from the function.

  • Renaming a function parameter.

  • Reordering the existing function parameters.

  • Changing the data type of a function parameter.

In all of these cases, you have to update tests that call this function as code under test. Most of the changes, other than the function parameter renaming, cause a build failure. Even in case of a function parameter renaming, it is beneficial to update the test to show the new parameter names.

To find which tests in a project require an update because of code under test changes:

  1. Right-click the Tests node of a project and select Validate Tests.

    Tests with validation issues are shown with a Exclamation mark icon next to them.

  2. On the Logs pane, note which test steps have an invalid code under test.

    If you open such a test step, you can see that the code under test does not exist.

To update the function in a test step with an invalid code under test:

  1. Double-click the test on the Projects pane and open the test.

  2. Right-click the step node in the left side of the test case editor and select Update Code Under Test.

  3. In the Update Code Under Test dialog box, select the new function from the Replace function with list and click OK.

    Update Code Under Test Dialog box. The Replace function with drop-down list shows a list of functions to select from.

  4. On the Remapping Code Under Test dialog box, you see a mapping between the old and new functions. If the data type of a function parameter in the new function is equivalent to the data type of the corresponding parameter in the old function, the parameter is considered unchanged. Otherwise, it is considered as new.

    Adjust the mapping as needed. For instance:

    • If a function parameter is considered as existing by the software but is actually a new parameter, change the value in the Mapping column from New to Existing.

    • If you reordered two parameters of a function but both parameters are considered as new, change the values in the Mapping column from New to Existing. Then, in the Old Function Data column, select the parameters to map to.

    Remapping Code Under Test dialog box. The Mapping column shows whether a parameter is new or existing. For existing parameters, the Old Function Data column shows which old function parameter is mapped to the current parameter.

Alternatively, to map the old function to a new function, select the new function from the Code Under Test drop-down list in the test step and then select Remap data.

When you map the old function in a test step to a new function:

  • You see these changes in the Inputs section of the step:

    • If you marked a function parameter as existing, it is retained along with its previous value. If you marked it as new, the parameter is entered with a default value (the same value as if you were creating the test for the first time). Parameters that no longer exist are removed.

    • If a global variable value was read during execution of the old function and continues to be read in the new function, it is retained in the test along with its previous value. Global variables that are no longer read-accessed in the new function get removed. No new global variables are entered.

  • You see these changes in the Assessments section of the step:

    • If you marked a return value as existing, the assessment for the return value is retained. If you marked it as new, any existing assessment on a return value is removed and a new assessment is entered with default values.

    • If you marked a function parameter as existing, any assessment on the parameter is retained. No new assessments are added for new parameters. You can add them explicitly after update as needed.

    • If a global variable value was written during execution of the old function and continues to be written in the new function , any existing assessment on the variable is retained along with its previous value. Assessments on global variables that are no longer write-accessed in the function get removed. No new assessments are entered for global variables. You can add them explicitly after update as needed.

    • Mock variables are removed during test update. You can add them explicitly after update as needed.

In addition to function interface changes, changes in type definition can also affect a test. For instance, you might change a structured type to add or remove a member. Following a code under test update, all test elements in the test step and test header are updated to the latest definition of the type:

  • The test elements in the Inputs and Assessments section of the test step that use this type get updated.

    For instance, if you add a new member to an existing structured type, for inputs using the type, this new member is entered with default values.

  • The test elements in the Test Data and Test Parameters sections of the test header that use this type also get updated.

See Also

Topics