主要内容

polyspace-test -create-testgen-config

R2026b

(System Command) Create a default configuration file for automatic test generation in a Polyspace Platform project

Since R2026b

Description

The system command polyspace-test -create-testgen-config creates a default test generation configuration file for a specified function in a Polyspace® Platform project. You can then customize the configuration file and use it with the polyspace-test -generate-tests command.

polyspace-test -create-testgen-config -config-file <configFile> -project <projectFile> -function <function> creates a default test generation configuration file configFile for the function function in the project projectFile. The configuration file uses a TOML-like format and contains default entries for the function inputs. You can edit this file to add constraints such as fixed values, minimum and maximum bounds, and pointer target sizes, and then use it with the polyspace-test -generate-tests command.

example

Examples

collapse all

Create a default configuration file for a function, customize the input constraints, and then generate boundary-value tests using the configuration file.

Create a default configuration file for the saturate_value function.

polyspace-test -create-testgen-config -config-file saturate_config.toml -project myProject.psprjx -function "int saturate_value(int)"

The command creates a file saturate_config.toml with default entries for the function inputs.

Open the generated file and customize the input constraints. For instance, specify a minimum and maximum value for the input:

Tabular = true
CodeUnderTest = "int saturate_value(int)"

[[Inputs]]
Var = 0
MinValue = "-100"
MaxValue = "100"

Generate boundary-value tests using the customized configuration file.

polyspace-test -generate-tests -project myProject.psprjx -boundary -config-file saturate_config.toml -boundary-mode minimal

Input Arguments

collapse all

Path to the configuration file to create. You can specify the file path as an absolute path or as a path relative to your working directory.

Example: -config-file "myConfig.toml"

Example: -config-file "configs/saturate_config.toml"

Absolute or relative path to the Polyspace Platform project file (.psprjx file) that contains the source files.

Example: -project "myProject.psprjx"

Name of the C/C++ function to generate configuration file for. If only one function with the specified name exists in the project sources, specifying just the function name is sufficient. Otherwise, specify the full function signature.

Example: -function "int saturate_value(int)"

Example: -function "saturate_value"

More About

collapse all

Version History

Introduced in R2026b