-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
matlab-plugin-agent/src/main/resources/+ciplugins/+teamcity/TestVisualizationPlugin.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
classdef TestVisualizationPlugin < matlab.unittest.plugins.TestRunnerPlugin | ||
|
||
% Copyright 2024 The MathWorks, Inc. | ||
|
||
methods (Access=protected) | ||
|
||
% Write about covered edgecases as well for function based tests instead of class based tests | ||
|
||
function runTest(plugin, pluginData) | ||
classAndTestName = strrep(pluginData.Name,"/","."); | ||
% fprintf("##teamcity[testStarted name='%s' captureStandardOutput='true']",pluginData.Name) | ||
% fprintf("##teamcity[testStarted name='%s' captureStandardOutput='true']",pluginData.TestSuite.TestClass + "." + pluginData.TestSuite.ProcedureName) | ||
% In the above method -> Test class becomes null for function based tests | ||
fprintf("##teamcity[testStarted name='%s' captureStandardOutput='true']", classAndTestName) | ||
|
||
% Invoke super class method to run the test | ||
[email protected](plugin, pluginData); | ||
|
||
result = pluginData.TestResult; | ||
|
||
if result.Failed | ||
|
||
% display(result.Details.DiagnosticRecord.Report); | ||
|
||
% Not using fprintf as it treats / as a backslash escape character, which we recieve in the error logs like In L:\Projects\matlab-teamcity-plugin. (errors out) | ||
% fprintf(result.Details.DiagnosticRecord.Report); | ||
|
||
% fprintf("##teamcity[testFailed name='%s' errorDetails='%s' status='ERROR']", pluginData.Name, result.Details.DiagnosticRecord.Report); % possibly include error details here | ||
% fprintf("##teamcity[testFailed name='%s' status='ERROR']", pluginData.Name); | ||
fprintf("##teamcity[testFailed name='%s' status='ERROR']", classAndTestName); | ||
elseif result.Incomplete | ||
% fprintf("##teamcity[testIgnored name='%s']", pluginData.Name); | ||
fprintf("##teamcity[testIgnored name='%s']", classAndTestName); | ||
end | ||
|
||
% fprintf("##teamcity[testFinished name='%s' duration='%f']", pluginData.Name, result.Duration) | ||
fprintf("##teamcity[testFinished name='%s' duration='%f']", classAndTestName, result.Duration) | ||
end | ||
|
||
% pluginData.TestResult.Passed | pluginData.TestResult.Failed | pluginData.TestResult.Incomplete | ||
|
||
% function runTestSuite(plugin, pluginData) | ||
% fprintf("##teamcity[testSuiteStarted name='%s']","suiteName") | ||
|
||
% groupNumber = pluginData.Group; | ||
% totalGroups = pluginData.NumGroups; | ||
% suiteSize = numel(pluginData.TestSuite); | ||
% fprintf('### Running %d tests in Group %d of %d\n', suiteSize, groupNumber, totalGroups); | ||
|
||
% % Invoke the super class method | ||
% [email protected](plugin, pluginData) | ||
|
||
% fprintf("##teamcity[testSuiteFinished name='%s']","suiteName") | ||
% % pluginData.TestSuite.TestClass | ||
% end | ||
|
||
function runSession(plugin, pluginData) | ||
% Introspect into pluginData to get TestSuite size | ||
suiteSize = numel(pluginData.TestSuite); | ||
fprintf('### Running a total of %d tests\n', suiteSize); | ||
fprintf('test run session started\n'); | ||
% fprintf("##teamcity[testRetrySupport enabled='true']"); | ||
% Invoke the super class method | ||
[email protected](plugin, pluginData) | ||
fprintf("##teamcity[testRetrySupport enabled='true']"); | ||
fprintf('test run session ended'); | ||
end | ||
|
||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
...resources/+matlab/+unittest/+internal/+services/+plugins/TestVisualizationPluginService.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
classdef TestVisualizationPluginService < matlab.buildtool.internal.services.ciplugins.CITestRunnerPluginService | ||
% Copyright 2024 The MathWorks, Inc. | ||
|
||
methods | ||
function plugins = providePlugins(~, ~) | ||
plugins = ciplugins.teamcity.TestVisualizationPlugin(); | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters