polyspace-test -generate-tests
R2026b(System Command) Generate C/C++ unit tests automatically in a Polyspace Platform project
Since R2026b
Syntax
Description
The system command polyspace-test -generate-tests generates
C/C++ unit tests automatically for boundary values or coverage objectives in a Polyspace® Platform project.
Generate Tests Using a Configuration File
polyspace-test -generate-tests
generates boundary-value tests using the test generation configuration file
-project <projectFile> -boundary -config-file <configFile> [options]<configFile>. The configuration file describes the code under test
and constraints on the inputs. Depending on the contents of
<configFile>, the test generator produces either function-based
(tabular) or scripted tests.
Use the polyspace-test
-create-testgen-config command to create a default configuration file and
then modify it to according to your testing requirements.
polyspace-test -generate-tests
generates tests to achieve coverage objectives using the test generation configuration
file -project <projectFile> -coverage -config-file <configFile> [options]<configFile>. Depending on the contents of
<configFile>, the test generator produces either function-based
(tabular) or scripted tests.
Use the polyspace-test
-create-testgen-config command to create a default configuration file and
then modify it to according to your testing requirements.
Generate Tests for a Specific Function
polyspace-test -generate-tests
generates boundary-value tests for the function -project <projectFile> -boundary -function <function> [options]function within the
project projectFile. The generated tests exercise boundary values
(such as minimum, maximum, and zero) for each input of the specified function.
By default, the generated tests are contained within the default test suite of the
project. If the project does not contain a default test suite and at least one test is
generated, the test generator creates a default test suite. To specify a nondefault
destination suite, use the -destination-suite <suiteName> option
(see the description of the options argument below).
polyspace-test -generate-tests
generates tests to achieve coverage objectives for the function
-project <projectFile> -coverage -function <function> [options]function within the project projectFile. The
generated tests target structural coverage metrics such as decision, condition/decision,
or MC/DC coverage for the specified function.
Examples
Input Arguments
Version History
Introduced in R2026b