From 244bc2f0240f9158a7748e16ebe63204522c9414 Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Mon, 26 Aug 2019 12:34:10 -0400 Subject: [PATCH 01/17] Update README.md --- README.md | 57 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 1dde9de0..bf692909 100644 --- a/README.md +++ b/README.md @@ -1,78 +1,83 @@ # 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. +## Configure Plugin for Freestyle Project +To configure the plugin for a freestyle project, select **Run MATLAB Tests** from the **Add build step** list. ![new_add_build_step](https://user-images.githubusercontent.com/47204011/55624172-be54a100-57c2-11e9-9596-52d3a60ee467.png) ![new_default_plugin_page](https://user-images.githubusercontent.com/47204011/55624213-dcba9c80-57c2-11e9-85e6-abb6ae03534e.png) -Use the plugin as part of the Jenkins build step to run MATLAB tests in two distinct modes: +You can 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”. +To run your tests, enter the value returned by the **matlabroot** function in the **MATLAB root** field. ![new_enter_matlabroot](https://user-images.githubusercontent.com/47204011/55624374-45097e00-57c3-11e9-96e1-5fa0fc966767.png) -#### 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. +### Option 1: Freestyle Project with Automatic Test Mode +This option runs the tests written using the MATLAB Unit Testing Framework and/or Simulink Test. If your files and folders are organized in a project, the plugin will locate all test files in the project that have been tagged as **Test**. If your code does not leverage a project or uses a MATLAB version prior to R2019a, the plugin will discover all tests in the current Jenkins workspace including the 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. +If you use a source code management (SCM) system such as Git, then your job must include the appropriate SCM configuration to check out the code before if can invoke the MATLAB plugin. If you do not use any SCM systems to manage your code, then an additional build step is required to ensure that the code is available in the Jenkins workspace before the build starts. -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. +The automatic test execution feature of the plugin enables you to generate different types of test artifacts. To publish the test results, you can use these artifacts with other Jenkins plugins. To configure the Jenkins build where MATLAB tests run automatically, follow these steps. -1) Select the Test mode as Automatic to run tests (Automatic is the default mode). +1) From the **Test mode** drop-down list, select the **Automatic** option (**Automatic** is the default testing mode). ![new_select_automatic_option](https://user-images.githubusercontent.com/47204011/55624469-a0d40700-57c3-11e9-8811-32892ccbe673.png) -2) Select the desired test artifacts. You can also choose not to generate any test artifacts. +2) Select your desired test artifacts. ![new_select_all_test_artifacts](https://user-images.githubusercontent.com/47204011/55624765-7f274f80-57c4-11e9-8a15-ebdef19ebd3d.png) - The selected test artifact(s) will be stored in the “matlabTestArtifacts” folder of the Jenkins workspace. + The selected artifacts will be saved in the **matlabTestArtifacts** folder of the Jenkins workspace. ![Workspace01](https://user-images.githubusercontent.com/47204011/55470859-1e621080-5626-11e9-98f2-044144272643.JPG) ![Test_artifacts](https://user-images.githubusercontent.com/47204011/55470863-21f59780-5626-11e9-9765-4d79a6fd4061.JPG) - 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. + If you not select any of the test artifact check boxes, the **matlabTestArtifacts** folder will not be created in the workspace. However, tests will still run and potential 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. + The **Automatic** test mode results in a MATLAB script file named **runMatlabTests.m** in the Jenkins workspace. The plugin uses this file to run tests and generate test artifacts. You can review the contents of the script to understand the testing workflow. ![Workspace01](https://user-images.githubusercontent.com/47204011/55470859-1e621080-5626-11e9-98f2-044144272643.JPG) +### Option 2: Freestyle Project with Custom Test Mode +This option enables you to develop your custom MATLAB commands for running tests. To configure the Jenkins build where you can customize the MATLAB test execution, follow these steps. -#### 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. +1) From the **Test mode** drop-down list, select the **Custom** option. ![new_select_custom](https://user-images.githubusercontent.com/47204011/55624858-d0cfda00-57c4-11e9-8366-45edbc9ba83f.png) -2) In "MATLAB command” text box, enter your MATLAB command. Separate multiple commands by commas or semicolons. +2) Enter your commands in the **MATLAB command** field. If you specify more than one MATLAB command, use commas or semicolons to separate the commands. The build will fail if the execution of any command results in an error. ![new_custom_runtest_command](https://user-images.githubusercontent.com/47204011/55624949-096fb380-57c5-11e9-8711-98baf91816c0.png) - 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. + **Note:** If you need several MATLAB commands to run your tests, consider writing a MATLAB script or function as part of your repository and executing this script or function instead. Test artifacts are not autogenerated if you choose to run tests using custom MATLAB commands. You can generate your desired test artifacts by configuring the test runner in the script or function that you invoke from the **MATLAB command** field. ![new_custom_script_example](https://user-images.githubusercontent.com/47204011/55625021-32904400-57c5-11e9-86b7-478b930796c0.png) -## Configuring "Multi-configuration"(matrix) project. -The Jenkins plugin for MATLAB can be used inside of "Multi-configuration" (matrix) projects. Matrix projects allow jobs to be repeated with different configurations, such as testing on multiple platforms or testing against multiple MATLAB versions. +## Configure Plugin for Multi-Configuration Project +In addition to freestyle projects, the Jenkins plugin for MATLAB supports [multi-configuration (matrix) projects](https://wiki.jenkins.io/display/JENKINS/Building+a+matrix+project). Multi-configuration projects are useful when builds include similar steps, for example when the same test suite should run on different platforms (e.g., Windows, Linux, and Mac) or using several MATLAB versions. -#### Matrix build for "Automatic" option. +![image](https://user-images.githubusercontent.com/47204011/62458632-0e586a00-b79b-11e9-8611-3671adb8c289.png) -1) Create a "Multi-configuration" project. +As in a freestyle project, a multi-configuration project requires you to specify the location where MATLAB is installed as well as the test execution mode. You should also add user-defined axes in the configuration matrix to specify the duplicating build steps. -![image](https://user-images.githubusercontent.com/47204011/62458632-0e586a00-b79b-11e9-8611-3671adb8c289.png) +### Option 1: Multi-Configuration Project with Automatic Test Mode -2) Add User-defined axis for different MATLAB versions as shown below. +To configure the plugin for a matrix build where tests run automatically in multiple MATLAB versions, create a multi-configuration project and follow these steps. + +1) Add a user-defined axis in the **Configuration Matrix** to represent the MATLAB versions in the build. Specify the name of the axis in the **Name** field and its values in the **Values** field. Separate the elements in the **Values** field with a space. ![image](https://user-images.githubusercontent.com/47204011/62603081-c2c8cc00-b912-11e9-83a4-c5462f58f607.png) +In this example, four MATLAB versions are specified, which will be used to run the same set of tests. + +2) In the **Run MATLAB Tests** section of the project, include the user-defined axis name in the **MATLAB root** field to specify the locations where MATLAB is installed. In this example, **$VERSION** will be replaced by one axis value per build step. + + 3) Replace the User-defined axis variable in MATLAB root appropriately. ![image](https://user-images.githubusercontent.com/47204011/62459137-3c8a7980-b79c-11e9-9bee-305b4cabfd42.png) From e27c36c98bf012084470912522fa9fd8c203d0d6 Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Mon, 26 Aug 2019 13:09:14 -0400 Subject: [PATCH 02/17] Update README.md --- README.md | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index bf692909..0fffe685 100644 --- a/README.md +++ b/README.md @@ -77,42 +77,38 @@ In this example, four MATLAB versions are specified, which will be used to run t 2) In the **Run MATLAB Tests** section of the project, include the user-defined axis name in the **MATLAB root** field to specify the locations where MATLAB is installed. In this example, **$VERSION** will be replaced by one axis value per build step. - -3) Replace the User-defined axis variable in MATLAB root appropriately. - ![image](https://user-images.githubusercontent.com/47204011/62459137-3c8a7980-b79c-11e9-9bee-305b4cabfd42.png) -4) Save and run the build. +As in a freestyle project, you can select test artifact check boxes when tests run automatically. Once you have made your selections, save your settings and run the build. -#### Matrix build for "Custom" option. +### Option 2: Multi-Configuration Project with Automatic Test Mode -1) Create a "Multi-configuration" project. - -![image](https://user-images.githubusercontent.com/47204011/62458632-0e586a00-b79b-11e9-8611-3671adb8c289.png) +To configure the matrix build where you can customize the MATLAB test execution, create a multi-configuration project and follow these steps. -2) Add User-defined axis for different MATLAB versions as shown below. +1) Add a user-defined axis in the **Configuration Matrix** to represent the MATLAB releases in the build. ![image](https://user-images.githubusercontent.com/47204011/62603081-c2c8cc00-b912-11e9-83a4-c5462f58f607.png) -3) Add another User-defined axis for custom commands as shown below. +2) Add another user-defined axis with the **Add axis** button. In this example, the **TEST_TAG** axis specifies the possible test tags for a group of test elements. ![image](https://user-images.githubusercontent.com/47204011/62517774-b6c30880-b845-11e9-86a0-8344a281fb27.png) -4) Replace the User-defined axis variable in MATLAB root appropriately. +4) In the **Run MATLAB Tests** section of the project, use the **VERSION** axis to specify the locations where MATLAB is installed. ![image](https://user-images.githubusercontent.com/47204011/62459137-3c8a7980-b79c-11e9-9bee-305b4cabfd42.png) -5) Select "Custom" option from "Test mode" drop-down and replace User-defined axis variable for custom command appropriately. +5) From the **Test mode** drop-down list, select the **Custom** option. Use the second user-defined axis to create your commands and enter them in the **MATLAB command** field. Then, save your settings and run the build. ![image](https://user-images.githubusercontent.com/47204011/62686681-cd529680-b9e2-11e9-82c1-c211f1740be4.png) -6) Save and run the build. +**Notes:** +1) For a user-defined axis named **VAR**, **$VAR** and **${VAR}** are both valid formats for accessing the values. +2) A multi-configuration project creates a separate workspace for each user-defined axis value. If you specify the full paths to where MATLAB is installed as axis values, Jenkins fails to create separate workspaces and fails the build. -Note: Axis variables can be replaced in either "$VAR" or "${VAR}" formats. Do not use complete MATLAB root path as axis values. Multi-configuration project creates separate workspace folder for each User-defined axis values with same name, and file separators in complete path will cause Jenkins build to fail as folder creation fails. ## Contact Us -If you have any questions or suggestions, please feel free to contact MathWorks. +If you have any questions or suggestions, please contact MathWorks. support@mathworks.com From 892bb57025958e9dce12e9faea8b30b4aaf4bffd Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Mon, 26 Aug 2019 13:10:21 -0400 Subject: [PATCH 03/17] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0fffe685..16babef6 100644 --- a/README.md +++ b/README.md @@ -93,11 +93,11 @@ To configure the matrix build where you can customize the MATLAB test execution, ![image](https://user-images.githubusercontent.com/47204011/62517774-b6c30880-b845-11e9-86a0-8344a281fb27.png) -4) In the **Run MATLAB Tests** section of the project, use the **VERSION** axis to specify the locations where MATLAB is installed. +3) In the **Run MATLAB Tests** section of the project, use the **VERSION** axis to specify the locations where MATLAB is installed. ![image](https://user-images.githubusercontent.com/47204011/62459137-3c8a7980-b79c-11e9-9bee-305b4cabfd42.png) -5) From the **Test mode** drop-down list, select the **Custom** option. Use the second user-defined axis to create your commands and enter them in the **MATLAB command** field. Then, save your settings and run the build. +4) From the **Test mode** drop-down list, select the **Custom** option. Use the second user-defined axis to create your commands and enter them in the **MATLAB command** field. Then, save your settings and run the build. ![image](https://user-images.githubusercontent.com/47204011/62686681-cd529680-b9e2-11e9-82c1-c211f1740be4.png) From efc0bf32f7da285a7899ae86093e24bee4166966 Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Mon, 26 Aug 2019 13:18:59 -0400 Subject: [PATCH 04/17] Update README.md --- README.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 16babef6..b59cc617 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,20 @@ # Jenkins MATLAB Plugin -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. +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. You can run tests in either *automatic* or *custom* mode. + ## Configure Plugin for Freestyle Project To configure the plugin for a freestyle project, select **Run MATLAB Tests** from the **Add build step** list. ![new_add_build_step](https://user-images.githubusercontent.com/47204011/55624172-be54a100-57c2-11e9-9596-52d3a60ee467.png) ![new_default_plugin_page](https://user-images.githubusercontent.com/47204011/55624213-dcba9c80-57c2-11e9-85e6-abb6ae03534e.png) - -You can use the plugin as part of the Jenkins build step to run MATLAB tests in two distinct modes: -* Automatic -* Custom - + To run your tests, enter the value returned by the **matlabroot** function in the **MATLAB root** field. ![new_enter_matlabroot](https://user-images.githubusercontent.com/47204011/55624374-45097e00-57c3-11e9-96e1-5fa0fc966767.png) ### Option 1: Freestyle Project with Automatic Test Mode -This option runs the tests written using the MATLAB Unit Testing Framework and/or Simulink Test. If your files and folders are organized in a project, the plugin will locate all test files in the project that have been tagged as **Test**. If your code does not leverage a project or uses a MATLAB version prior to R2019a, the plugin will discover all tests in the current Jenkins workspace including the subfolders. +This option runs the tests written using the MATLAB Unit Testing Framework and/or Simulink® Test. If your files and folders are organized in a project, the plugin will locate all test files in the project that have been tagged as **Test**. If your code does not leverage a project or uses a MATLAB version prior to R2019a, the plugin will discover all tests in the current Jenkins workspace including the subfolders. If you use a source code management (SCM) system such as Git, then your job must include the appropriate SCM configuration to check out the code before if can invoke the MATLAB plugin. If you do not use any SCM systems to manage your code, then an additional build step is required to ensure that the code is available in the Jenkins workspace before the build starts. From b8a6cc0d1c1a3c79eff99726e2fc92afeca4d64a Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Mon, 26 Aug 2019 13:23:09 -0400 Subject: [PATCH 05/17] Update README.md --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index b59cc617..2e7afb84 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,10 @@ 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. You can run tests in either *automatic* or *custom* mode. ## Configure Plugin for Freestyle Project -To configure the plugin for a freestyle project, select **Run MATLAB Tests** from the **Add build step** list. +To configure the plugin for a freestyle project, select **Run MATLAB Tests** from the **Add build step** list. Then, enter the value returned by the **matlabroot** function in the **MATLAB root** field. ![new_add_build_step](https://user-images.githubusercontent.com/47204011/55624172-be54a100-57c2-11e9-9596-52d3a60ee467.png) - ![new_default_plugin_page](https://user-images.githubusercontent.com/47204011/55624213-dcba9c80-57c2-11e9-85e6-abb6ae03534e.png) - -To run your tests, enter the value returned by the **matlabroot** function in the **MATLAB root** field. - ![new_enter_matlabroot](https://user-images.githubusercontent.com/47204011/55624374-45097e00-57c3-11e9-96e1-5fa0fc966767.png) ### Option 1: Freestyle Project with Automatic Test Mode From 3b67bbe61f593358f56596ad6f4baccafa00952d Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Mon, 26 Aug 2019 13:25:25 -0400 Subject: [PATCH 06/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e7afb84..e79cd7da 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ To configure the plugin for a freestyle project, select **Run MATLAB Tests** fro ![new_enter_matlabroot](https://user-images.githubusercontent.com/47204011/55624374-45097e00-57c3-11e9-96e1-5fa0fc966767.png) ### Option 1: Freestyle Project with Automatic Test Mode -This option runs the tests written using the MATLAB Unit Testing Framework and/or Simulink® Test. If your files and folders are organized in a project, the plugin will locate all test files in the project that have been tagged as **Test**. If your code does not leverage a project or uses a MATLAB version prior to R2019a, the plugin will discover all tests in the current Jenkins workspace including the subfolders. +This option runs the tests written using the MATLAB Unit Testing Framework and/or Simulink® Test. If your files and folders are organized in a project, the plugin will locate all test files in the project that have been tagged as **Test**. If your code does not leverage a project or uses a MATLAB version prior to R2019a, the plugin will discover all tests in the current Jenkins workspace including the subfolders. If you use a source code management (SCM) system such as Git, then your job must include the appropriate SCM configuration to check out the code before if can invoke the MATLAB plugin. If you do not use any SCM systems to manage your code, then an additional build step is required to ensure that the code is available in the Jenkins workspace before the build starts. From 06f986e6004307d8c8d6aa6c89b5b5302d9b4f26 Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Mon, 26 Aug 2019 13:28:27 -0400 Subject: [PATCH 07/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e79cd7da..2e978e7f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ To configure the plugin for a freestyle project, select **Run MATLAB Tests** fro ![new_enter_matlabroot](https://user-images.githubusercontent.com/47204011/55624374-45097e00-57c3-11e9-96e1-5fa0fc966767.png) ### Option 1: Freestyle Project with Automatic Test Mode -This option runs the tests written using the MATLAB Unit Testing Framework and/or Simulink® Test. If your files and folders are organized in a project, the plugin will locate all test files in the project that have been tagged as **Test**. If your code does not leverage a project or uses a MATLAB version prior to R2019a, the plugin will discover all tests in the current Jenkins workspace including the subfolders. +This option runs the tests written using the MATLAB Unit Testing Framework and/or Simulink® Test. If your files and folders are organized in a project, the plugin will consider any test files in the project that have been tagged as **Test**. If your code does not leverage a project or uses a MATLAB version prior to R2019a, the plugin will consider all tests in the current Jenkins workspace including the subfolders. If you use a source code management (SCM) system such as Git, then your job must include the appropriate SCM configuration to check out the code before if can invoke the MATLAB plugin. If you do not use any SCM systems to manage your code, then an additional build step is required to ensure that the code is available in the Jenkins workspace before the build starts. From de4ad65d090e990398cba0c75ecf9b2343edb8e0 Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Mon, 26 Aug 2019 13:49:09 -0400 Subject: [PATCH 08/17] Update README.md --- README.md | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2e978e7f..e05cc329 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ The automatic test execution feature of the plugin enables you to generate diffe ![Test_artifacts](https://user-images.githubusercontent.com/47204011/55470863-21f59780-5626-11e9-9765-4d79a6fd4061.JPG) - If you not select any of the test artifact check boxes, the **matlabTestArtifacts** folder will not be created in the workspace. However, tests will still run and potential test failures will fail the build. + If you do not select any of the test artifact check boxes, the **matlabTestArtifacts** folder will not be created in the workspace. However, tests will still run and potential test failures will fail the build. - The **Automatic** test mode results in a MATLAB script file named **runMatlabTests.m** in the Jenkins workspace. The plugin uses this file to run tests and generate test artifacts. You can review the contents of the script to understand the testing workflow. + The **Automatic** test mode results in a MATLAB script file named **runMatlabTests.m** in the Jenkins workspace. The plugin uses this file to run the tests and generate the test artifacts. You can review the contents of the script to understand the testing workflow. ![Workspace01](https://user-images.githubusercontent.com/47204011/55470859-1e621080-5626-11e9-98f2-044144272643.JPG) @@ -43,7 +43,7 @@ This option enables you to develop your custom MATLAB commands for running tests ![new_select_custom](https://user-images.githubusercontent.com/47204011/55624858-d0cfda00-57c4-11e9-8366-45edbc9ba83f.png) -2) Enter your commands in the **MATLAB command** field. If you specify more than one MATLAB command, use commas or semicolons to separate the commands. The build will fail if the execution of any command results in an error. +2) Enter your commands in the **MATLAB command** field. If you specify more than one MATLAB command, use a comma or semicolon to separate the commands. The build will fail if the execution of any command results in an error. ![new_custom_runtest_command](https://user-images.githubusercontent.com/47204011/55624949-096fb380-57c5-11e9-8711-98baf91816c0.png) @@ -56,33 +56,31 @@ In addition to freestyle projects, the Jenkins plugin for MATLAB supports [multi ![image](https://user-images.githubusercontent.com/47204011/62458632-0e586a00-b79b-11e9-8611-3671adb8c289.png) -As in a freestyle project, a multi-configuration project requires you to specify the location where MATLAB is installed as well as the test execution mode. You should also add user-defined axes in the configuration matrix to specify the duplicating build steps. +As in a freestyle project, you can run your tests in automatic or custom mode within a multi-configuration project. The configuration requires you to specify the location where MATLAB is installed as well as the test execution mode. You should also add user-defined axes in the **Configuration Matrix** to specify the duplicating build steps. ### Option 1: Multi-Configuration Project with Automatic Test Mode To configure the plugin for a matrix build where tests run automatically in multiple MATLAB versions, create a multi-configuration project and follow these steps. -1) Add a user-defined axis in the **Configuration Matrix** to represent the MATLAB versions in the build. Specify the name of the axis in the **Name** field and its values in the **Values** field. Separate the elements in the **Values** field with a space. +1) Add a user-defined axis in the **Configuration Matrix** to represent the MATLAB versions in the build. Specify the name of the axis in the **Name** field and its values in the **Values** field. Separate the elements in the **Values** field with a space. In this example, four MATLAB versions are specified, which will be used to run the same set of tests. ![image](https://user-images.githubusercontent.com/47204011/62603081-c2c8cc00-b912-11e9-83a4-c5462f58f607.png) -In this example, four MATLAB versions are specified, which will be used to run the same set of tests. - 2) In the **Run MATLAB Tests** section of the project, include the user-defined axis name in the **MATLAB root** field to specify the locations where MATLAB is installed. In this example, **$VERSION** will be replaced by one axis value per build step. ![image](https://user-images.githubusercontent.com/47204011/62459137-3c8a7980-b79c-11e9-9bee-305b4cabfd42.png) -As in a freestyle project, you can select test artifact check boxes when tests run automatically. Once you have made your selections, save your settings and run the build. +You can select the test artifact check boxes when tests run automatically. Once you have made your selections, save your settings and run the build. -### Option 2: Multi-Configuration Project with Automatic Test Mode +### Option 2: Multi-Configuration Project with Custom Test Mode To configure the matrix build where you can customize the MATLAB test execution, create a multi-configuration project and follow these steps. -1) Add a user-defined axis in the **Configuration Matrix** to represent the MATLAB releases in the build. +1) Add a user-defined axis in the **Configuration Matrix** to represent the MATLAB versions in the build. ![image](https://user-images.githubusercontent.com/47204011/62603081-c2c8cc00-b912-11e9-83a4-c5462f58f607.png) -2) Add another user-defined axis with the **Add axis** button. In this example, the **TEST_TAG** axis specifies the possible test tags for a group of test elements. +2) Add another user-defined axis using the **Add axis** button. In this example, the **TEST_TAG** axis specifies the possible test tags for a group of test elements. ![image](https://user-images.githubusercontent.com/47204011/62517774-b6c30880-b845-11e9-86a0-8344a281fb27.png) From 5fa4ea4bfd78076aead56aa0bcbd6a8354e14b7d Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Tue, 27 Aug 2019 18:39:43 -0400 Subject: [PATCH 09/17] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e05cc329..ddbec033 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Jenkins MATLAB Plugin -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. You can run tests in either *automatic* or *custom* mode. +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. You can choose to run your tests in either *automatic* or *custom* mode. This guide shows you examples of how to configure the plugin for different objectives, considering a Microsoft® Windows® platform. ## Configure Plugin for Freestyle Project To configure the plugin for a freestyle project, select **Run MATLAB Tests** from the **Add build step** list. Then, enter the value returned by the **matlabroot** function in the **MATLAB root** field. @@ -10,9 +10,9 @@ To configure the plugin for a freestyle project, select **Run MATLAB Tests** fro ![new_enter_matlabroot](https://user-images.githubusercontent.com/47204011/55624374-45097e00-57c3-11e9-96e1-5fa0fc966767.png) ### Option 1: Freestyle Project with Automatic Test Mode -This option runs the tests written using the MATLAB Unit Testing Framework and/or Simulink® Test. If your files and folders are organized in a project, the plugin will consider any test files in the project that have been tagged as **Test**. If your code does not leverage a project or uses a MATLAB version prior to R2019a, the plugin will consider all tests in the current Jenkins workspace including the subfolders. +This option runs the tests written using the MATLAB Unit Testing Framework and/or Simulink® Test. If your source code is organized as files and folders within a project, the plugin will consider any test files in the project that have been tagged as **Test**. If your code does not leverage a project or uses a MATLAB version prior to R2019a, the plugin will consider all tests in the current Jenkins workspace including the subfolders. -If you use a source code management (SCM) system such as Git, then your job must include the appropriate SCM configuration to check out the code before if can invoke the MATLAB plugin. If you do not use any SCM systems to manage your code, then an additional build step is required to ensure that the code is available in the Jenkins workspace before the build starts. +If you use a source code management (SCM) system such as Git, then your job must include the appropriate SCM configuration to check out the code before it can invoke the MATLAB plugin. If you do not use any SCM systems to manage your code, then an additional build step is required to ensure that the code is available in the Jenkins workspace before the build starts. The automatic test execution feature of the plugin enables you to generate different types of test artifacts. To publish the test results, you can use these artifacts with other Jenkins plugins. To configure the Jenkins build where MATLAB tests run automatically, follow these steps. From 4beee2e1091f15e11f723d6ca65dd240286f2f78 Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Thu, 29 Aug 2019 15:46:37 -0400 Subject: [PATCH 10/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ddbec033..3917b936 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Jenkins MATLAB Plugin -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. You can choose to run your tests in either *automatic* or *custom* mode. This guide shows you examples of how to configure the plugin for different objectives, considering a Microsoft® Windows® platform. +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. This guide shows you examples of how to configure the plugin for different objectives, considering a Microsoft® Windows® platform. ## Configure Plugin for Freestyle Project To configure the plugin for a freestyle project, select **Run MATLAB Tests** from the **Add build step** list. Then, enter the value returned by the **matlabroot** function in the **MATLAB root** field. From da601dc46b5a5cd100f13e0f91860813e5dde824 Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Thu, 29 Aug 2019 16:01:37 -0400 Subject: [PATCH 11/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3917b936..d10f939b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ To configure the plugin for a freestyle project, select **Run MATLAB Tests** fro ![new_enter_matlabroot](https://user-images.githubusercontent.com/47204011/55624374-45097e00-57c3-11e9-96e1-5fa0fc966767.png) ### Option 1: Freestyle Project with Automatic Test Mode -This option runs the tests written using the MATLAB Unit Testing Framework and/or Simulink® Test. If your source code is organized as files and folders within a project, the plugin will consider any test files in the project that have been tagged as **Test**. If your code does not leverage a project or uses a MATLAB version prior to R2019a, the plugin will consider all tests in the current Jenkins workspace including the subfolders. +With the Jenkins plugin for MATLAB, you have the option to run your tests in either *automatic* or *custom* mode. The automatic test mode employs a default setting to run tests written using the MATLAB Unit Testing Framework and/or Simulink® Test. If your source code is organized as files and folders within a project, the plugin will consider any test files in the project that have been tagged as **Test**. If your code does not leverage a project or uses a MATLAB version prior to R2019a, the plugin will consider all tests in the current Jenkins workspace including the subfolders. If you use a source code management (SCM) system such as Git, then your job must include the appropriate SCM configuration to check out the code before it can invoke the MATLAB plugin. If you do not use any SCM systems to manage your code, then an additional build step is required to ensure that the code is available in the Jenkins workspace before the build starts. From 619a6db11bd7e113d1a7018891b6b55fa10c8d1c Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Mon, 16 Sep 2019 16:18:15 -0400 Subject: [PATCH 12/17] Run MATLAB Tests with FreeStyle Project --- FreeStyle_Project_Example/squareRoot.m | 7 +++++ FreeStyle_Project_Example/testSquareRoot.m | 11 +++++++ .../testSquareRootParameterized.m | 29 +++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 FreeStyle_Project_Example/squareRoot.m create mode 100644 FreeStyle_Project_Example/testSquareRoot.m create mode 100644 FreeStyle_Project_Example/testSquareRootParameterized.m diff --git a/FreeStyle_Project_Example/squareRoot.m b/FreeStyle_Project_Example/squareRoot.m new file mode 100644 index 00000000..2e246342 --- /dev/null +++ b/FreeStyle_Project_Example/squareRoot.m @@ -0,0 +1,7 @@ +function rs = squareRoot(x) +if x < 0 + error('SQUAREROOT:INVALIDINPUT','Negative value %d Not accepted',x); +else + rs = sqrt(x); +end +end \ No newline at end of file diff --git a/FreeStyle_Project_Example/testSquareRoot.m b/FreeStyle_Project_Example/testSquareRoot.m new file mode 100644 index 00000000..c16a7717 --- /dev/null +++ b/FreeStyle_Project_Example/testSquareRoot.m @@ -0,0 +1,11 @@ +classdef testSquareRoot < matlab.unittest.TestCase + + methods (Test) + function testOutput(testCase) + testCase.verifyEqual(squareRoot(16),4); + testCase.verifyEqual(squareRoot(81),9); + end + end + +end + diff --git a/FreeStyle_Project_Example/testSquareRootParameterized.m b/FreeStyle_Project_Example/testSquareRootParameterized.m new file mode 100644 index 00000000..708b3adb --- /dev/null +++ b/FreeStyle_Project_Example/testSquareRootParameterized.m @@ -0,0 +1,29 @@ +classdef testSquareRootParameterized < matlab.unittest.TestCase + + properties (TestParameter) + inputs = {4, 16, 81, 121, 49}; + expected_outputs = {2, 4, 9 , 11, 7}; + end + +% methods (TestClassSetup) +% function addTestContentToPath(~) +% %cd ..; +% addpath(fullfile(pwd,'source')); +% end +% end + + + methods (Test,ParameterCombination='sequential') + function testOutput(testCase,inputs,expected_outputs) + testCase.verifyEqual(squareRoot(inputs),expected_outputs); + end + + function testError(testCase) + testCase.verifyError(@()squareRoot(-1),'SQUAREROOT:INVALIDINPUT'); + end + + end + + +end + From 4532b79ec5ca103fefc1cd41ff95eaf309602141 Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Tue, 17 Sep 2019 14:38:41 -0400 Subject: [PATCH 13/17] Delete testSquareRootParameterized.m --- .../testSquareRootParameterized.m | 29 ------------------- 1 file changed, 29 deletions(-) delete mode 100644 FreeStyle_Project_Example/testSquareRootParameterized.m diff --git a/FreeStyle_Project_Example/testSquareRootParameterized.m b/FreeStyle_Project_Example/testSquareRootParameterized.m deleted file mode 100644 index 708b3adb..00000000 --- a/FreeStyle_Project_Example/testSquareRootParameterized.m +++ /dev/null @@ -1,29 +0,0 @@ -classdef testSquareRootParameterized < matlab.unittest.TestCase - - properties (TestParameter) - inputs = {4, 16, 81, 121, 49}; - expected_outputs = {2, 4, 9 , 11, 7}; - end - -% methods (TestClassSetup) -% function addTestContentToPath(~) -% %cd ..; -% addpath(fullfile(pwd,'source')); -% end -% end - - - methods (Test,ParameterCombination='sequential') - function testOutput(testCase,inputs,expected_outputs) - testCase.verifyEqual(squareRoot(inputs),expected_outputs); - end - - function testError(testCase) - testCase.verifyError(@()squareRoot(-1),'SQUAREROOT:INVALIDINPUT'); - end - - end - - -end - From 5aca29301b19c67090e71c846be86a5acf5a63a0 Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Tue, 17 Sep 2019 14:38:53 -0400 Subject: [PATCH 14/17] Delete squareRoot.m --- FreeStyle_Project_Example/squareRoot.m | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 FreeStyle_Project_Example/squareRoot.m diff --git a/FreeStyle_Project_Example/squareRoot.m b/FreeStyle_Project_Example/squareRoot.m deleted file mode 100644 index 2e246342..00000000 --- a/FreeStyle_Project_Example/squareRoot.m +++ /dev/null @@ -1,7 +0,0 @@ -function rs = squareRoot(x) -if x < 0 - error('SQUAREROOT:INVALIDINPUT','Negative value %d Not accepted',x); -else - rs = sqrt(x); -end -end \ No newline at end of file From 5a1ad3b420492ec6288ede3928e9a3c7ceadf8b0 Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Tue, 17 Sep 2019 14:39:01 -0400 Subject: [PATCH 15/17] Delete testSquareRoot.m --- FreeStyle_Project_Example/testSquareRoot.m | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 FreeStyle_Project_Example/testSquareRoot.m diff --git a/FreeStyle_Project_Example/testSquareRoot.m b/FreeStyle_Project_Example/testSquareRoot.m deleted file mode 100644 index c16a7717..00000000 --- a/FreeStyle_Project_Example/testSquareRoot.m +++ /dev/null @@ -1,11 +0,0 @@ -classdef testSquareRoot < matlab.unittest.TestCase - - methods (Test) - function testOutput(testCase) - testCase.verifyEqual(squareRoot(16),4); - testCase.verifyEqual(squareRoot(81),9); - end - end - -end - From 21600b7648440cb92b4cfe290abdf17533690bdb Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Tue, 17 Sep 2019 14:40:18 -0400 Subject: [PATCH 16/17] Test Random Number Generation --- TestRand.m | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 TestRand.m diff --git a/TestRand.m b/TestRand.m new file mode 100644 index 00000000..a3ea272e --- /dev/null +++ b/TestRand.m @@ -0,0 +1,54 @@ +classdef TestRand < matlab.unittest.TestCase + properties (ClassSetupParameter) + generator = {'twister','combRecursive','multFibonacci'}; + end + + properties (MethodSetupParameter) + seed = {0, 123}; + end + + properties (TestParameter) + dim1 = struct('small', 1,'medium', 2, 'large', 3); + dim2 = struct('small', 2,'medium', 3, 'large', 4); + dim3 = struct('small', 3,'medium', 4, 'large', 5); + type = {'single','double'}; + end + + methods (TestClassSetup) + function ClassSetup(testCase, generator) + orig = rng; + testCase.addTeardown(@rng, orig) + rng(0, generator) + end + end + + methods (TestMethodSetup) + function MethodSetup(testCase, seed) + orig = rng; + testCase.addTeardown(@rng, orig) + rng(seed) + end + end + + methods (Test, ParameterCombination='sequential') + function testSize(testCase,dim1,dim2,dim3) + testCase.verifySize(rand(dim1,dim2,dim3),[dim1 dim2 dim3]) + end + end + + methods (Test, ParameterCombination='pairwise') + function testRepeatable(testCase,dim1,dim2,dim3) + state = rng; + firstRun = rand(dim1,dim2,dim3); + rng(state) + secondRun = rand(dim1,dim2,dim3); + testCase.verifyEqual(firstRun,secondRun); + end + end + + methods (Test) + function testClass(testCase,dim1,dim2,type) + testCase.verifyClass(rand(dim1,dim2,type), type) + end + end +end \ No newline at end of file From fb6e35fe3c20008316edad4dddf572b167c31dbc Mon Sep 17 00:00:00 2001 From: mw-hrastega <48831250+mw-hrastega@users.noreply.github.com> Date: Tue, 17 Sep 2019 14:41:44 -0400 Subject: [PATCH 17/17] Update TestRand.m --- TestRand.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestRand.m b/TestRand.m index a3ea272e..4167eee5 100644 --- a/TestRand.m +++ b/TestRand.m @@ -4,7 +4,7 @@ end properties (MethodSetupParameter) - seed = {0, 123}; + seed = {0, 123, 4294967295}; end properties (TestParameter) @@ -51,4 +51,4 @@ function testClass(testCase,dim1,dim2,type) testCase.verifyClass(rand(dim1,dim2,type), type) end end -end \ No newline at end of file +end