Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
9 changes: 7 additions & 2 deletions .github/workflows/bat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,17 @@ jobs:
with:
source-folder: sample
code-coverage-metric-level: mcdc
- name: Run MATLAB Tests for statement coverage without MATLAB Test # Test Case 2: Statement coverage without MATLAB Test, view is shown
uses: ./
with:
source-folder: sample
code-coverage-metric-level: statement
- name: Perform 'setup-matlab' with MATLAB Test
uses: matlab-actions/setup-matlab@v3
with:
products: |
MATLAB_Test
- name: Run MATLAB Tests with other options # Test Case 2: With MATLAB Test, and other code-coverage options, no view is shown.
- name: Run MATLAB Tests with other options # Test Case 3: With MATLAB Test, and other code-coverage options, no view is shown.
uses: ./
with:
model-coverage-cobertura: test-results/modelcoverage.xml
Expand All @@ -142,7 +147,7 @@ jobs:
use-parallel: true
output-detail: Detailed
logging-level: Detailed
- name: Run MATLAB Tests # Test Case 3: With MATLAB Test, and only code-coverage-metric-level option, view is shown.
- name: Run MATLAB Tests # Test Case 4: With MATLAB Test, and only code-coverage-metric-level option, view is shown.
uses: ./
with:
source-folder: sample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@

methods
function plugins = providePlugins(~, ~)
verInfo = ver;
productNames = string({verInfo.Name});
productName = 'MATLAB Test';
isProductInstalled = any(productNames.matches(productName));
hasCoverageHTML = ~isempty(getenv('MW_INPUT_CODE_COVERAGE_HTML'));
hasCoverageCobertura = ~isempty(getenv('MW_INPUT_CODE_COVERAGE_COBERTURA'));
hasCoverageRequest = hasCoverageHTML || hasCoverageCobertura;
metricLevel = getenv('MW_INPUT_CODE_COVERAGE_METRIC_LEVEL');

% MATLAB Test product installation is only required for decision, condition, and mcdc levels
requiresProductInstall = ismember(metricLevel, {'decision', 'condition', 'mcdc'});
if requiresProductInstall
verInfo = ver;
productNames = string({verInfo.Name});
isProductInstalled = any(productNames.matches('MATLAB Test'));
else
isProductInstalled = true;
end

% Check if MATLAB Test license is available and MATLAB Test is installed
if strcmpi(getenv("MW_INPUT_GENERATE_SUMMARY"), "true") && ~hasCoverageRequest && license('test', 'matlab_test') && isProductInstalled
% Get metric level from environment variable
metricLevel = getenv('MW_INPUT_CODE_COVERAGE_METRIC_LEVEL');

% Create a shared CoverageResult format object
format = matlab.unittest.plugins.codecoverage.CoverageResult;
Expand Down