Azzera filtri
Azzera filtri

How to pass additional data to testresults of unittest inside testmethod of matlab.unittest.TestCase in 2019b

11 visualizzazioni (ultimi 30 giorni)
Hello I`m searching for the best way adding data to test results. The aim is to add additional information to the results of a testmethod in a way that i can apply easily further evaluation on all testresult data. For example Im testing with image_data in a testcase class TestMyImageData < matlab.unittest.TestCase and I'm using the factory method to create the suite = matlab.unittest.TestSuite.fromClass(?TestMyImageData, 'ExternalParameters',param). While param holds various images data. After testrun I would like to be able to make further operations on testresult data:
Im not interested in any figure creation and logging to files while testrun. I would like to decide afterwards what I plot or analyze based on the data I specified to go with the testresult of a testmethod. Maybe something like the following:
function test_my_stuff(testCase)
testCase.verifyLessThan(difference, MY_EXPECTED_DIFF)
results =

Risposta accettata

Andy Campbell
Andy Campbell il 3 Nov 2020
Hi Florian,
The ability to write a plugin that can append to the test result details was added in R2020a and is documented here. In this case, since you are adding the data from within the test method itself, you can add the data as a Diagnostic and log the data. Then the plugin can listen to the DiagnosticLogged event and add the logged data to your test result. Hope that helps!

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by