Storing results from unit tests for later review
Show older comments
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 Comments
Andy Campbell
on 21 Mar 2018
Edited: Andy Campbell
on 21 Mar 2018
Hi Michael, I am not sure yet exactly what you are looking for. Some questions:
- What do you mean by it will consist of three file names?
- Are you looking for a programmatic interface to the test results?
- Are you looking for the test results in a format that is easily archived?
- Are you generating some files or other artifacts during the test run that you would like to save?
I suspect that we may have the capability in the test framework you need, but can you clarify that need so that I am more likely to hit the mark?
Brendan Hamm
on 21 Mar 2018
Also, what is meant by data structure? Do you mean an actual struct?
The result of running as test generates a vector of Test Results, which can easily be converted to a table. Saving this would be as simple as the save command. Is this what you want?
Or, possibly you are interested in logging the output of the tests to a text file. In this case we can create our own matlab.unittest.TestRunner, add a matlab.unittest.plugins.LoggingPlugin to the runner, and call its run method rather than the run method of the TestCase class. Possibly you are interested in another matlab.unittest.plugin as well.
Michael Lofgren
on 21 Mar 2018
Brendan Hamm
on 4 Apr 2018
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.
Answers (1)
Andy Campbell
on 28 Jan 2019
0 votes
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 Comment
Michael Lofgren
on 1 Feb 2019
Categories
Find more on Downloads in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!