(How) Is it possible to set the 'Details' Property of a TestResult object in the Matlab Unit Test Framework?

2 views (last 30 days)
Alex L
Alex L on 17 Jun 2017
Commented: Christian Heigele on 19 Oct 2018
Is it possible to access (set) the Details property of a matlab.unittest.TestResult object in the Matlab Unit Testing Framework? Is that possible from inside a custom Plugin (Subclassed from TestRunnerPlugin) that is added to the TestRunner object? And if yes, how?
I am writing Class-Based Unit Tests and running them with some custom plugins to the TestRunner. I am interested in accessing diagnostic (or other) data from custom constraints (Subclassed from matlab.unittest.constraints.Constraint) after the test has run, ideally in the TestResult object that is returned when running a test suite.
I know of the possibility to access data in the way the Example " Write Plugin to Save Diagnostic Details " in the documentation does. However I am interested in alternative ways to do so.
Sadly the documentation is not very clear about which possibilities exist to either pass data from "outside" (which is another problem I have) to a test run or retrieve data from a running test. Or at least I could not find that information.
I would like to avoid using evalin or global variables.
Thank you for any help or ideas you can provide!
Alex L
  1 Comment
Sagar Doshi
Sagar Doshi on 20 Jun 2017
Based on the documentation, there does not seem to be a way to set any of the properties of the TestResult class. As per the documentation "TestResult arrays are created and returned by the test runner." I doubt what you are looking for is achievable.

Sign in to comment.

Answers (1)

Andy Campbell
Andy Campbell on 21 Jun 2017
Hi Alex,
While this is not currently available, the purpose and principle behind the Details property is indeed that it can serve as a place where different plugins can store their own data on the TestResult. So, in short this is something we would like to have available for custom plugin authors but is not ready to open up yet.
This request fuels that effort though. I am definitely interested in any additional details you have about what you are trying to do and how you see adding your own custom data to the TestResult will help your workflows so that we can help ensure any solutions take your use cases and pain points into account.
In the meantime, storing the data on the plugin itself, like the example you linked above, is currently the best workaround.
Another question: what type of data are you looking to get into the test from the outside?
Thanks! Andy
  1 Comment
Christian Heigele
Christian Heigele on 19 Oct 2018
Any update on this Andy? We are also interested in additional (mainly runtime created) information to a test run. Preferable with support in the XML Plugin ;)

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!