How can I extract the number of test cases contained by a test file?
5 views (last 30 days)
Show older comments
Hello,
I'm having some struggles trying to create statistics based on some test manager test files. What I need is to extract the number of test cases contained by all of the test suits found inside a test file. What I'm looking for is something like this:
TestFile = sltest.testmanager.load(SomeTest);
TestCases = sltest.testmanager.NumberOfTestCases(TestFile); %
This is my supposition, if only it would be this simple
The name of the test cases is not important, it's just the number that I need.
One solution would be to run the test file and get the test cases number based on the results, but this would be too much time consuming (Some tests take hours to run).
Is there a way to access that number just by loading the test file?
3 Comments
Answers (1)
Kartik Saxena
on 5 Jan 2024
Hi,
I understand that you want to extract the number of test cases present in all the Test Suites.
To calculate this, you can loop over all the Test Suites and keep adding the number of test cases present in each of them. For this purpose you can use the 'getTestCases' function, which returns an array of test case objects. The size of this array will be the number of test cases present in a Test Suite.
Refer to the following MathWorks documentation for information regarding use of 'getTestCases':
I hope this resolves your issue.
0 Comments
See Also
Categories
Find more on Results, Reporting, and Test File Management in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!