How to pass additional data to testresults of unittest inside testmethod of matlab.unittest.TestCase in 2019b
6 views (last 30 days)
Florian Osterloh on 28 Oct 2020
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:
results = runner.run()
Andy Campbell on 3 Nov 2020
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!