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

runMATLABCommand: Run MATLAB commands, scripts, or functions

  • command
    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
    • Type: String

runMATLABTests: Run MATLAB tests and generate artifacts

  • codeCoverageCobertura (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.
    • Type: String
  • modelCoverageCobertura (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.

    • Type: String
  • selectByFolder (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"]

    • Type: Array / List of String
  • selectByTag (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'

    • Type: String
  • sourceFolder (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"]

    • Type: Array / List of String
  • testResultsJUnit (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.
    • Type: String
  • testResultsPDF (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.
    • Type: String
  • testResultsSimulinkTest (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.
    • Type: String
  • testResultsTAP (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.
    • Type: String

step([$class: 'MatlabBuilder']):

  • matlabRoot (optional)
    Enter the full path to the MATLAB root folder, which is returned by the matlabroot function.

    Example:

    Windows:
    C:\Program Files\MATLAB\R2019a
    Linux:
    /usr/local/MATLAB/R2019a
    Mac:
    /Applications/MATLAB_R2019a.app

    Note: If the job runs on a remote agent, you must specify the full path to MATLAB root folder on the remote agent.

    • Type: String
  • testRunTypeList (optional)
    Select the test run mode from the following options.
  • Run Tests Automatically: Runs all tests in the Jenkins workspace, including tests in subfolders.
  • Use Custom MATLAB Command: Use your own custom MATLAB commands or script file to run your tests.
    Nested Choice of Objects
  • $class: 'RunTestsAutomaticallyOption'
    • taCoberturaChkBx (optional)

      Generate a Cobertura code coverage report, named cobertura.xml, to be stored in the matlabTestArtifacts folder of the current Jenkins workspace.
      • Type: boolean
    • taJunitChkBx (optional)

      Generate a JUnit style test report, named junittestresults.xml, to be stored in the matlabTestArtifacts folder of the current Jenkins workspace.
      • Type: boolean
    • taModelCoverageChkBx (optional)

      Generate a Cobertura model coverage report, coberturamodelcoverage.xml, and save it in the matlabTestArtifacts folder of the Jenkins workspace. This report includes coverage results for Simulink® models that are tested using Simulink Test™.

      Note: This feature requires a Simulink Coverage™ license and is supported only in MATLAB R2018b or a newer release.

      • Type: boolean
    • taPDFReportChkBx (optional)

      Generate a test report in PDF format, testreport.pdf, and save it in the matlabTestArtifacts folder of the Jenkins workspace.

      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:This feature is not currently supported on MacOS platforms.
      • Type: boolean
    • taSTMResultsChkBx (optional)

      Export Simulink Test™ Manager results in MLDATX format, simulinktestresults.mldatx, and save them in the matlabTestArtifacts folder of the Jenkins workspace.

      Note: This feature requires a Simulink Test license and is supported only in MATLAB R2019a or a newer release.
      • Type: boolean
    • tatapChkBx (optional)

      Generate a TAP style test report, named taptestresults.tap, to be stored in the matlabTestArtifacts folder of the current Jenkins workspace.
      • Type: boolean
  • $class: 'RunTestsWithCustomCommandOption'
    • customMatlabCommand (optional)
      To run your tests, enter MATLAB commands separated by semicolons.
      Example: cd c:\MATLAB\tests; runtests('IncludingSubfolder','true');

       
      Recommendation:If you require a number of MATLAB commands to execute your build, consider writing a MATLAB script and executing the script file instead.
      Note: The build will fail if the execution of any MATLAB command causes an error.
      • Type: String

step([$class: 'RunMatlabCommandBuilder']): Run MATLAB Command

  • matlabCommand (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
    • Type: 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
      • Type: 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
      • Type: String
  • 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
      • Type: String
  • 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
      • Type: 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
        • Type: 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
      • Type: 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
        • Type: 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
      • Type: String
  • 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
      • Type: String

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
      • Type: String
    • matlabRootFolder
      • Type: 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.