Skip to content
Open
Show file tree
Hide file tree
Changes from 26 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-test-publish.pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 1.13$(Rev:.r)
name: 1.14$(Rev:.r)

trigger:
- master
Expand Down
20 changes: 17 additions & 3 deletions integ-test-promote-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,17 @@ jobs:
testResultsJUnit: test-results/matlab/selectbyfolder.xml
selectByFolder: tests/filteredTest
- task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }}
displayName: Run MATLAB tests filter by folder
displayName: Run MATLAB tests filter by tag
inputs:
testResultsJUnit: test-results/matlab/selectbytag.xml
selectByTag: FILTERED
- task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }}
displayName: Run MATLAB tests filter by name
inputs:
testResultsJUnit: test-results/matlab/selectbyname.xml
selectByName: "filtertest/* mytest/StartupTest"
sourceFolder: src
condition: not(eq(${{ version }}, '0'))
- bash: |
set -e
grep -q FirstTest test-results/matlab/results.xml
Expand All @@ -240,6 +247,13 @@ jobs:
grep -v FirstTest test-results/matlab/selectbytag.xml
grep -v simpleTest test-results/matlab/selectbytag.xml
displayName: Verify test filtered by tag name
- bash: |
set -e
grep -q StartupTest test-results/matlab/selectbyname.xml
grep -q simpleTest test-results/matlab/selectbyname.xml
! grep -q FirstTest test-results/matlab/selectbytag.xml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be ! grep -q FirstTest test-results/matlab/selectbytag.xml?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to remove the !?
This is to verify that the 'FirstTest' test is not run so used a ! before the grep command.

Copy link
Member

@davidbuzinski davidbuzinski Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forget what I meant, but I think I meant to type selectbyname.xml. Should they all be checking in one .xml for the select by name run?

displayName: Verify test filtered by name
condition: not(eq(${{ version }}, '0'))
- bash: |
echo 'diary console.log' >> startup.m
displayName: Set up diary for logging
Expand Down Expand Up @@ -273,7 +287,7 @@ jobs:
sourceFolder: src
- bash: |
set -e
grep -q "TestRunner.withTextOutput('OutputDetail', 3)" console.log
grep -q "('OutputDetail', 3)" console.log
rm console.log
displayName: Verify tests ran with detailed display level for event details
- task: MathWorks.matlab-azure-devops-extension-dev.RunMATLABTests.RunMATLABTests@${{ version }}
Expand All @@ -283,7 +297,7 @@ jobs:
sourceFolder: src
- bash: |
set -e
grep -q "TestRunner.withTextOutput('LoggingLevel', 3)" console.log
grep -q "('LoggingLevel', 3)" console.log
rm console.log
displayName: Verify tests ran with detailed verbosity level for logged diagnostics
- bash: |
Expand Down
1 change: 1 addition & 0 deletions tasks/run-matlab-tests/v1/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ async function run() {
SourceFolder: taskLib.getInput("sourceFolder"),
SelectByFolder: taskLib.getInput("selectByFolder"),
SelectByTag: taskLib.getInput("selectByTag"),
SelectByName: taskLib.getInput("SelectByName"),
CoberturaModelCoverage: taskLib.getInput("modelCoverageCobertura"),
SimulinkTestResults: taskLib.getInput("testResultsSimulinkTest"),
PDFTestReport: taskLib.getInput("testResultsPDF"),
Expand Down
11 changes: 11 additions & 0 deletions tasks/run-matlab-tests/v1/scriptgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@ export interface IRunTestsOptions {
CoberturaModelCoverage?: string;
SelectByTag?: string;
SelectByFolder?: string;
SelectByName?: string;
Strict?: boolean;
UseParallel?: boolean;
OutputDetail?: string;
LoggingLevel?: string;
}

// Function to convert space separated names to cell array of character vectors
export function getSelectByNameAsCellArray(input?: string): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully this is just temporary until scriptgen gets updated to properly accept SelectByName as a space separated string?

While unlikely, single-quotes in the strings need to be escaped or it may result in a malformed cell array.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I created an issue in scritgen repo and added a note to update this once that issue is resolved.

if (!input || !input.trim()) {
return "{}";
}
const items = input.split(/\s+/).filter(Boolean).map((s) => `'${s}'`);
return `{${items.join(", ")}}`;
}

export function generateCommand(options: IRunTestsOptions): string {
return `addpath('${path.join(__dirname, "scriptgen")}');` +
`testScript = genscript('Test',` +
Expand All @@ -28,6 +38,7 @@ export function generateCommand(options: IRunTestsOptions): string {
`'CoberturaModelCoverage','${options.CoberturaModelCoverage || ""}',` +
`'SelectByTag','${options.SelectByTag || ""}',` +
`'SelectByFolder','${options.SelectByFolder || ""}',` +
`'SelectByName',${getSelectByNameAsCellArray(options.SelectByName)},` +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a plan to go back and fix scriptgen so this can be:

'SelectByName','${options.SelectByName || ""}', ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, created an issue under scriptgen repo.

`'Strict',${options.Strict || false},` +
`'UseParallel',${options.UseParallel || false},` +
`'OutputDetail','${options.OutputDetail || ""}',` +
Expand Down
9 changes: 9 additions & 0 deletions tasks/run-matlab-tests/v1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@
"required": false,
"helpMarkDown": "Test tag used to select test suite elements. To create a test suite, the task uses only the test elements with the specified tag."
},
{
"name": "selectByName",
"type": "string",
"label": "By name",
"defaultValue": "",
"groupName": "filterTests",
"required": false,
"helpMarkDown": "Test name used to select test suite elements. To create a test suite, the task uses only the test elements with the specified name."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this text, Vahila.

@davidbuzinski: Where would such text show up? In the UI?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shows up if you try to edit the yaml in the pipeline editor at dev.azure.com. There is a list of all the input fields, and each field has a info icon that you can hover over to see this help text.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks David.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vahila : Would you like to replaced "with the specified name" with "that match the specified name"?

},
{
"name": "strict",
"type": "boolean",
Expand Down
8 changes: 6 additions & 2 deletions tasks/run-matlab-tests/v1/test/scriptgen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default function suite() {
CoberturaModelCoverage: "",
SelectByTag: "",
SelectByFolder: "",
SelectByName: "",
Strict: false,
UseParallel: false,
OutputDetail: "",
Expand All @@ -32,14 +33,15 @@ export default function suite() {
assert(actual.includes("'CoberturaModelCoverage',''"));
assert(actual.includes("'SelectByTag',''"));
assert(actual.includes("'SelectByFolder',''"));
assert(actual.includes("'SelectByName',{}"));
assert(actual.includes("'Strict',false"));
assert(actual.includes("'UseParallel',false"));
assert(actual.includes("'OutputDetail',''"));
assert(actual.includes("'LoggingLevel',''"));

const expected = `genscript('Test', 'JUnitTestResults','', 'CoberturaCodeCoverage','',
'SourceFolder','', 'PDFTestReport','', 'SimulinkTestResults','',
'CoberturaModelCoverage','', 'SelectByTag','', 'SelectByFolder','',
'CoberturaModelCoverage','', 'SelectByTag','', 'SelectByFolder','', 'SelectByName',{},
'Strict',false, 'UseParallel',false, 'OutputDetail','', 'LoggingLevel','')`
.replace(/\s+/g, "");
assert(actual.replace(/\s+/g, "").includes(expected));
Expand All @@ -55,6 +57,7 @@ export default function suite() {
CoberturaModelCoverage: "test-results/modelcoverage.xml",
SelectByTag: "FeatureA",
SelectByFolder: "test/tools;test/toolbox",
SelectByName: "tTestA/* tTestB/*",
Strict: true,
UseParallel: true,
OutputDetail: "Detailed",
Expand All @@ -72,6 +75,7 @@ export default function suite() {
assert(actual.includes("'CoberturaModelCoverage','test-results/modelcoverage.xml'"));
assert(actual.includes("'SelectByTag','FeatureA'"));
assert(actual.includes("'SelectByFolder','test/tools;test/toolbox'"));
assert(actual.includes("'SelectByName',{'tTestA/*', 'tTestB/*'}"));
assert(actual.includes("'Strict',true"));
assert(actual.includes("'UseParallel',true"));
assert(actual.includes("'OutputDetail','Detailed'"));
Expand All @@ -81,7 +85,7 @@ export default function suite() {
'CoberturaCodeCoverage','code-coverage/coverage.xml', 'SourceFolder','source',
'PDFTestReport','test-results/pdf-results.pdf', 'SimulinkTestResults','test-results/simulinkTest.mldatx',
'CoberturaModelCoverage','test-results/modelcoverage.xml', 'SelectByTag','FeatureA',
'SelectByFolder','test/tools;test/toolbox', 'Strict',true, 'UseParallel',true, 'OutputDetail','Detailed',
'SelectByFolder','test/tools;test/toolbox', 'SelectByName',{'tTestA/*', 'tTestB/*'}, 'Strict',true, 'UseParallel',true, 'OutputDetail','Detailed',
'LoggingLevel','Detailed' )`
.replace(/\s+/g, "");
assert(actual.replace(/\s+/g, "").includes(expected));
Expand Down