(How) Is it possible to set the 'Details' Property of a TestResult object in the Matlab Unit Test Framework?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Sagar Doshi
2017-6-20
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.
回答(1 个)
Andy Campbell
2017-6-21
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 个评论
Christian Heigele
2018-10-19
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 ;)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Extend Testing Frameworks 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!