How can I extract the number of test cases contained by a test file?
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Kartik Saxena
2024-1-5
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Results, Reporting, and Test File Management 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!