From 0055613f5353013a665f604472864c6e4f3b37cf Mon Sep 17 00:00:00 2001 From: AaronBrennan1 <68754265+AaronBrennan1@users.noreply.github.com> Date: Tue, 5 Nov 2024 01:25:42 +0000 Subject: [PATCH] Update run_coverage_tests.m --- run_coverage_tests.m | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/run_coverage_tests.m b/run_coverage_tests.m index 5d3188db98..d24d9cba2f 100644 --- a/run_coverage_tests.m +++ b/run_coverage_tests.m @@ -2,42 +2,18 @@ % Add MOcov to path addpath(genpath('/opt/MOcov')); - % Get the current directory - current_dir = pwd; - try - % Create test suite from the test file - suite = matlab.unittest.TestSuite.fromFile('test/test_myfunction.m'); - - % Create a runner with detailed output - runner = matlab.unittest.TestRunner.withTextOutput('Verbosity', 3); - - % Run the tests - results = runner.run(suite); + % Run tests directly + disp('Running tests...'); + test_results = test_myfunction; - % Display summary - disp('=========================================='); - disp('Test Summary:'); - disp('=========================================='); - disp(['Number of tests: ' num2str(numel(results))]); - disp(['Passed: ' num2str(nnz([results.Passed]))]); - disp(['Failed: ' num2str(nnz([results.Failed]))]); - disp(['Duration: ' num2str(sum([results.Duration])) ' seconds']); - disp('=========================================='); - - % Generate MOcov coverage report + % Generate coverage report disp('Generating coverage report...'); - mocov('-cover', current_dir, '-cover_xml_file', 'coverage.xml'); - - % Check if any tests failed - if any([results.Failed]) - error('Some tests failed. Check the test report for details.'); - end + mocov('-cover', pwd, '-cover_xml_file', 'coverage.xml'); disp('Testing completed successfully.'); exit(0); catch e - % Display error and exit with failure disp('Error running tests:'); disp(getReport(e)); exit(1);