Storing results from unit tests for later review

40 次查看(过去 30 天)
I have a set of unit test methods defined inside a class derived from matlab.unittest.TestCase. The tests run and give pass/fail results as expected.
What I would like to do is to save a data structure generated during each test, for later review. Currently this will consist of three file names, but I may add to this later.
I have been looking through the unit test framework documentation, but haven't found a way to do this yet. Is it possible to do this?
  4 个评论
Michael Lofgren
Michael Lofgren 2018-3-21
Each of my tests use two image files as input, and generates a struct that stores the results of the function under test. At a later time I wish to display those images and overlay data stored in the struct, as a visual way of determining if the test worked at a more detailed level. I can save this data in individual mat files for each test, but that doesn't provide me with a way to programmatically link it with the test and its result.
When runtests() completes, it produces a TestResult array. Within each of those TestResult objects, I would like to include the paths to my image files and the generated struct so that I can view results of each test visually, at a later time. I can then choose to inspect data from all tests, or just from those that have failed, for example.
Hopefully that answers your questions, if not let me know and I'll try to clarify.
Brendan Hamm
Brendan Hamm 2018-4-4
Sorry for the delay.
I'm a bit confused. If you have the information on the paths of the images created by each test, why can these not be matched up?
Are you using a parameterization of the image paths?
Perhaps a code example may clarify exactly where the issue is.

请先登录,再进行评论。

回答(1 个)

Andy Campbell
Andy Campbell 2019-1-28
Based on the comments above, it sounds like you may want to try an approach simialr to the one outlined in this blog post:
Hope that helps!
Andy
  1 个评论
Michael Lofgren
Michael Lofgren 2019-2-1
Thanks Andy - at a glance your post looks like it might answer my question. I'm working on something else at the moment but will certainly review your post in more detail when I eventually get back to it.
Michael

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Generated Code Tests 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by