diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 541369e..1a7955a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -120,5 +120,7 @@ jobs: with: source-folder: install/+opentelemetry code-coverage-cobertura: cobertura.xml + uses: codecov/codecov-action@v4 token: ${{ secrets.CODECOV_TOKEN }} slug: mathworks/OpenTelemetry-Matlab + file: cobertura.xml diff --git a/testToolbox.m b/testToolbox.m index 1edd819..b0b7fa8 100644 --- a/testToolbox.m +++ b/testToolbox.m @@ -1,14 +1,17 @@ -suite = testsuite(fullfile('test/')); -runner = testrunner("textoutput"); +import matlab.unittest.TestRunner +import matlab.unittest.Verbosity import matlab.unittest.plugins.CodeCoveragePlugin -import matlab.unittest.plugins.codecoverage.CoverageReport import matlab.unittest.plugins.codecoverage.CoberturaFormat -sourceFile = fullfile('install','+opentelemetry'); +suite = testsuite(fullfile('test/')); +runner = TestRunner.withTextOutput("OutputDetail",Verbosity.Detailed); + +sourceFile = fullfile('install'); + reportFile = fullfile("cobertura.xml"); reportFormat = CoberturaFormat(reportFile); p = CodeCoveragePlugin.forFolder(sourceFile,'IncludingSubfolders',true,'Producing',reportFormat); runner.addPlugin(p); -result = runner.run(suite); - -result.assertSuccess() \ No newline at end of file +results = runner.run(suite); +nfailed = nnz([results.Failed]); +assert(nfailed == 0,[num2str(nfailed) ' test(s) failed.']) \ No newline at end of file