The following plugin provides functionality available through
Pipeline-compatible steps. Read more about how to integrate steps into your
Pipeline in the
Steps
section of the
Pipeline Syntax
page.
For a list of other such plugins, see the
Pipeline Steps Reference
page.
MATLAB Plugin
buildOptions : String
(optional)
Specify a space-separated list of MATLAB build options. The plugin supports the build options that you can pass to the buildtool command.
Example: -continueOnFailure
Example: -continueOnFailure -skip test
startupOptions : String
(optional)
Specify a space-separated list of MATLAB startup options.
Example: -nojvm
Example: -nojvm -logfile output.log
Note: Specifying the -batch or -r option is not supported.
tasks : String
(optional)
Insert a space-separated list of tasks to run in the
Tasks box. If not specified, the action runs the default tasks in buildfile.m as well as all the tasks on which they depend.
Example: test
Example: compile test
Note:
- MATLAB exits with exit code 0 if the tasks run without error. Otherwise, MATLAB terminates with a nonzero exit code, which causes the step to fail.
- To use the Run MATLAB Build step, you need MATLAB R2022b or a later release.
runMATLABCommand
: Run MATLAB commands, scripts, or functions
command : String
Insert the MATLAB commands you want to execute in the
Command box. If you need to specify more than one command, use a comma or semicolon to separate the commands.
Example: results = runtests, assertSuccess(results);
If you need to specify several MATLAB commands, consider writing a MATLAB script or function and executing this script or function instead. (To run a script or function, do not specify the file extension.)
Example: myscript
Note:
- The build fails if the execution of any command results in an error.
- If the build uses a MATLAB version prior to R2020a, MATLAB might display non-ASCII characters, specified in the Command box, as garbled text. If you specify non-ASCII characters in your commands, consider running your commands as a .m or .mlx file created in the same locale that MATLAB uses on the build agent
startupOptions : String
(optional)
A space-separated list of MATLAB startup options.
runMATLABTests
: Run MATLAB tests and generate artifacts
codeCoverageCobertura : String
(optional)
Generate a code coverage report in Cobertura XML format. By default, MATLAB names the artifact cobertura.xml and stores it in the matlabTestArtifacts folder of the project workspace. To override the default artifact name and location, specify a path relative to the project folder in the File path box. If the text box is empty, MATLAB does not generate an artifact.
loggingLevel : String
(optional)
Maximum verbosity level for logged diagnostics included for the test run.
modelCoverageCobertura : String
(optional)
Generate a model coverage report in Cobertura XML format. This artifact includes coverage results for Simulink® models that are tested using Simulink Test™. By default, MATLAB names the artifact coberturamodelcoverage.xml and stores it in the matlabTestArtifacts folder of the project workspace.
Note: This feature requires a Simulink Coverage™ license and is supported only in MATLAB R2018b or a newer release.
outputDetail : String
(optional)
Display level for event details output by the test run.
selectByFolder : Array / List of String
(optional)
Specify the locations of folders containing tests, relative to the project root folder, as a list of strings. To generate a test suite, MATLAB uses only the tests in the specified folders and their subfolders.
Example: ["test/folderA", "test/folderB"]
selectByTag : String
(optional)
Specify the test tag used to select test suite elements. To generate a test suite, MATLAB uses only the test elements with the specified tag.
Example: 'FeatureA'
sourceFolder : Array / List of String
(optional)
Specify the location of folders containing source code, relative to the project root folder, as a string array. The specified folders and their subfolders are added to the top of the MATLAB search path. To generate a coverage report, MATLAB uses only the source code in the specified folders and their subfolders.
Example: ["src/folderA", "src/folderB"]
startupOptions : String
(optional)
A space-separated list of MATLAB startup options.
strict : boolean
(optional)
Whether to apply strict checks when running the tests. For example, the framework generates a qualification failure if a test issues a warning.
testResultsJUnit : String
(optional)
Generate a test report in JUnit XML format. By default, MATLAB names the artifact junittestresults.xml and stores it in the matlabTestArtifacts folder of the project workspace. To override the default artifact name and location, specify a path relative to the project folder in the File path box. If the text box is empty, MATLAB does not generate an artifact.
testResultsPDF : String
(optional)
Generate a test report in PDF format. By default, MATLAB names the artifact
testreport.pdf and stores it in the
matlabTestArtifacts folder of the project workspace. To override the default artifact name and location, specify a path relative to the project folder in the
File path box. If the text box is empty, MATLAB does not generate an artifact.
Due to Jenkins Content Security Policy rules, the generated report might not open properly from within the Jenkins workspace. Consider copying the report to a location outside the workspace and opening it from there. For more information, see
Configuring Jenkins Content Security Policy.
Note: On macOS platforms, this feature is supported in MATLAB R2020b and later.
testResultsSimulinkTest : String
(optional)
Export Simulink Test™ Manager results in MLDATX format. By default, MATLAB names the artifact simulinktestresults.mldatx and stores it in the matlabTestArtifacts folder of the project workspace. To override the default artifact name and location, specify a path relative to the project folder in the File path box. If the text box is empty, MATLAB does not generate an artifact.
Note: This feature requires a Simulink Test license and is supported only in MATLAB R2019a or a newer release.
testResultsTAP : String
(optional)
Generate a test report in TAP format. By default, MATLAB names the artifact taptestresults.tap and stores it in the matlabTestArtifacts folder of the project workspace. To override the default artifact name and location, specify a path relative to the project folder in the File path box. If the text box is empty, MATLAB does not generate an artifact.
useParallel : boolean
(optional)
Whether to run tests in parallel. This feature requires a Parallel Computing Toolbox license, and might not be compatible with other options. If incompatible, testing occurs in serial regardless of the value of this feature.
step([$class: 'RunMatlabBuildBuilder'])
: Run MATLAB Build
buildOptions
(optional)
Specify a space-separated list of MATLAB build options. The plugin supports the build options that you can pass to the buildtool command.
Example: -continueOnFailure
Example: -continueOnFailure -skip test
Nested Object
options : String
startupOptions
(optional)
Specify a space-separated list of MATLAB startup options.
Example: -nojvm
Example: -nojvm -logfile output.log
Note: Specifying the -batch or -r option is not supported.
Nested Object
options : String
tasks : String
(optional)
Insert a space-separated list of tasks to run in the
Tasks box. If not specified, the action runs the default tasks in buildfile.m as well as all the tasks on which they depend.
Example: test
Example: compile test
Note:
- MATLAB exits with exit code 0 if the tasks run without error. Otherwise, MATLAB terminates with a nonzero exit code, which causes the step to fail.
- To use the Run MATLAB Build step, you need MATLAB R2022b or a later release.
step([$class: 'RunMatlabCommandBuilder'])
: Run MATLAB Command
matlabCommand : String
(optional)
Insert the MATLAB commands you want to execute in the
Command box. If you need to specify more than one command, use a comma or semicolon to separate the commands.
Example: results = runtests, assertSuccess(results);
If you need to specify several MATLAB commands, consider writing a MATLAB script or function and executing this script or function instead. (To run a script or function, do not specify the file extension.)
Example: myscript
Note:
- The build fails if the execution of any command results in an error.
- If the build uses a MATLAB version prior to R2020a, MATLAB might display non-ASCII characters, specified in the Command box, as garbled text. If you specify non-ASCII characters in your commands, consider running your commands as a .m or .mlx file created in the same locale that MATLAB uses on the build agent
startupOptions
(optional)
A space-separated list of MATLAB startup options.
Nested Object
options : String
step([$class: 'RunMatlabTestsBuilder'])
: Run MATLAB Tests
coberturaArtifact
(optional)
Generate a code coverage report in Cobertura XML format. By default, MATLAB names the artifact cobertura.xml and stores it in the matlabTestArtifacts folder of the project workspace. To override the default artifact name and location, specify a path relative to the project folder in the File path box. If the text box is empty, MATLAB does not generate an artifact.
Nested Object
coberturaReportFilePath : String
junitArtifact
(optional)
Generate a test report in JUnit XML format. By default, MATLAB names the artifact junittestresults.xml and stores it in the matlabTestArtifacts folder of the project workspace. To override the default artifact name and location, specify a path relative to the project folder in the File path box. If the text box is empty, MATLAB does not generate an artifact.
Nested Object
junitReportFilePath : String
loggingLevel : String
(optional)
Maximum verbosity level for logged diagnostics included for the test run.
modelCoverageArtifact
(optional)
Generate a model coverage report in Cobertura XML format. This artifact includes coverage results for Simulink® models that are tested using Simulink Test™. By default, MATLAB names the artifact coberturamodelcoverage.xml and stores it in the matlabTestArtifacts folder of the project workspace.
Note: This feature requires a Simulink Coverage™ license and is supported only in MATLAB R2018b or a newer release.
Nested Object
modelCoverageFilePath : String
outputDetail : String
(optional)
Display level for event details output by the test run.
pdfReportArtifact
(optional)
Generate a test report in PDF format. By default, MATLAB names the artifact
testreport.pdf and stores it in the
matlabTestArtifacts folder of the project workspace. To override the default artifact name and location, specify a path relative to the project folder in the
File path box. If the text box is empty, MATLAB does not generate an artifact.
Due to Jenkins Content Security Policy rules, the generated report might not open properly from within the Jenkins workspace. Consider copying the report to a location outside the workspace and opening it from there. For more information, see
Configuring Jenkins Content Security Policy.
Note: On macOS platforms, this feature is supported in MATLAB R2020b and later.
Nested Object
pdfReportFilePath : String
selectByFolder
(optional)
Specify the location of folders used to select test suite elements, relative to the project root folder. To generate a test suite, the plugin uses only the tests in the specified folders and their subfolders.
Paste the test folder path in the text box. To add more folders, click Add folder.
Nested Object
testFolderPaths
Array / List of Nested Object
testFolders : String
selectByTag
(optional)
Specify the test tag used to select test suite elements. To generate a suite, the plugin uses only the test elements with the specified tag.
Nested Object
testTag : String
sourceFolder
(optional)
Specify the location of folders containing source code, relative to the project root folder. The specified folders and their subfolders are added to the top of the MATLAB search path. To generate a coverage report, MATLAB uses only the source code in the specified folders and their subfolders.
Paste the source folder path in the Folder path box. To add more folders, click Add folder.
Nested Object
sourceFolderPaths
Array / List of Nested Object
srcFolderPath : String
startupOptions
(optional)
A space-separated list of MATLAB startup options.
Nested Object
options : String
stmResultsArtifact
(optional)
Export Simulink Test™ Manager results in MLDATX format. By default, MATLAB names the artifact simulinktestresults.mldatx and stores it in the matlabTestArtifacts folder of the project workspace. To override the default artifact name and location, specify a path relative to the project folder in the File path box. If the text box is empty, MATLAB does not generate an artifact.
Note: This feature requires a Simulink Test license and is supported only in MATLAB R2019a or a newer release.
Nested Object
stmResultsFilePath : String
strict : boolean
(optional)
Whether to apply strict checks when running the tests. For example, the framework generates a qualification failure if a test issues a warning.
tapArtifact
(optional)
Generate a test report in TAP format. By default, MATLAB names the artifact taptestresults.tap and stores it in the matlabTestArtifacts folder of the project workspace. To override the default artifact name and location, specify a path relative to the project folder in the File path box. If the text box is empty, MATLAB does not generate an artifact.
Nested Object
tapReportFilePath : String
useParallel : boolean
(optional)
Whether to run tests in parallel. This feature requires a Parallel Computing Toolbox license, and might not be compatible with other options. If incompatible, testing occurs in serial regardless of the value of this feature.
wrap([$class: 'UseMatlabVersionBuildWrapper'])
: Use MATLAB version
Use this list to specify the MATLAB version for the build. The plugin prepends your specified MATLAB to the PATH environment variable and uses it to perform the build.
The list includes the names of all MATLAB versions that have been registered as a tool in Jenkins. Select one of the tools, or select Custom if you want to specify a different version. When you select Custom, you must enter the full path to the desired MATLAB root folder in the MATLAB root box.
Note: In multi-configuration projects, the value specified by Use MATLAB version takes precedence over the values specified by the MATLAB axis.
matlabBuildWrapperContent
(optional)
Nested Object
matlabInstallationName : String
matlabRootFolder : String
Was this page helpful?
Please submit your feedback about this page through this
quick form.
Alternatively, if you don't wish to complete the quick form, you can simply
indicate if you found this page helpful?
See existing feedback here.