Main Content

Author Tests

Author tests using Polyspace® Test™ xUnit API in Visual Studio Code

You can author C/C++ tests using the Polyspace Test xUnit API. Tests and assessments are written using macros that begin with PST_. For instance, use PST_TEST to define a test in a suite, or PST_VERIFY_EQ_INT to assess that two integer values are equal.

If you use the Polyspace as You Code™ extension in Visual Studio Code, you can start typing PST_ to see autocomplete suggestions for macros from the C/C++ xUnit API. You can hover on a suggestion to see a description of the macro, and select a suggestion to enter the macro with placeholders to be filled in. You can also build and run these tests from Visual Studio Code. All files required for compiling xUnit tests are available with either a Polyspace as You Code or Polyspace Test installation (in the folder <polyspaceroot>/polyspace/pstest/pstunit/).

Autocomplete suggestions containing PST and TEST

Topics