Skip to content

The Jenkins plugin for MATLAB® enables you to easily run your MATLAB tests and generate test artifacts in formats such as JUnit, TAP, and Cobertura code coverage reports.

License

Notifications You must be signed in to change notification settings

SangaviJayagopi/jenkins-matlab-plugin

 
 

Repository files navigation

Jenkins MATLAB Plugin

Description

The Jenkins plugin for MATLAB® enables you to easily run your MATLAB tests and generate test artifacts in formats such as JUnit, TAP, and Cobertura code coverage reports.

Build Step Configuration

To invoke this plugin, select "Run MATLAB Tests" from the Add build step list.

new_add_build_step

new_default_plugin_page

Use the plugin as part of the Jenkins build step to run MATLAB tests in two distinct modes:

  • Automatic
  • Custom

Enter the value returned by “matlabroot” in the field named “MATLAB root”.

new_enter_matlabroot

Configuring “Automatic” Option

This option finds tests written using the MATLAB unit testing framework and/or Simulink Test and runs them. If the code is organized using projects, it will locate all test files in the project that have been classified as "Test". If the code does not leverage projects or uses a MATLAB version prior to R2019a, the plugin will discover all tests in the current Jenkins workspace including subfolders.

If you are using a source code management (SCM) system such as Git, then the job must include an appropriate SCM configuration to check out the code before running the MATLAB plugin. If you do not use any SCM systems to manage your code, then an additional build step is required to ensure the code is available in the workspace before running the MATLAB plugin.

The automatic test running feature enables you to generate different types of test artifacts. They could be used with other Jenkins plugins as part of a post-build action to publish the test results. To configure the Jenkins build for running MATLAB tests automatically, follow these steps.

  1. Select the Test mode as Automatic to run tests (Automatic is the default mode).

new_select_automatic_option

  1. Select the desired test artifacts. You can also choose not to generate any test artifacts.

new_select_all_test_artifacts

The selected test artifact(s) will be stored in the “matlabTestArtifacts” folder of the Jenkins workspace.

Workspace01

Test_artifacts

If the user does not select any test artifact generation checkboxes, this folder will not be created under the workspace and no test artifacts will be generated. However, test execution still occurs and test failures will fail the build.

The Automatic test run mode generates a MATLAB script file named “runMatlabTests.m” in the Jenkins workspace. The plugin uses this file to run tests and generate test artifacts. You may review the MATLAB script to understand the test workflow.

Workspace01

Configuring “Custom” Option

This option enables you to develop your custom MATLAB commands for running tests.

  1. From the "Test mode" dropdown list, select “Custom” option.

new_select_custom

  1. In "MATLAB command” text box, enter your MATLAB command. Separate multiple commands by commas or semicolons.

new_custom_runtest_command

Note: If you require several MATLAB commands to execute your test session, consider writing a MATLAB script or function as part of your repository and executing the script or function instead. Test artifacts are not autogenerated if you choose to run tests using your custom MATLAB commands. You can generate these and other artifacts by configuring a test runner in the script or function invoked by the command. The build will fail if the execution of any MATLAB command causes an error.

new_custom_script_example

Contact Us

If you have any questions or suggestions, please feel free to contact MathWorks.

[email protected]

License

MIT © 2019 The MathWorks, Inc.

Build Results

Overall Linux Windows Mac
Build Status Build Status Build Status Build Status

About

The Jenkins plugin for MATLAB® enables you to easily run your MATLAB tests and generate test artifacts in formats such as JUnit, TAP, and Cobertura code coverage reports.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 86.5%
  • MATLAB 6.2%
  • Shell 3.5%
  • HTML 3.2%
  • Batchfile 0.6%