tracking number of Test Cases

Ask general questions here.
johannes
Posts: 14
Joined: Mon Oct 17, 2016 12:40 pm

tracking number of Test Cases

Post by johannes » Wed Jun 19, 2019 8:24 am

Hi All,

how can I track the number of testcases without starting the whole testsuite ( sum of success + failed)

many thx
Hannes

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5071
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: tracking number of Test Cases

Post by odklizec » Wed Jun 19, 2019 8:57 am

Hi,

I'm afraid, I don't understand your question? Number of success/failed tests is always listed in report and it's only available at the end of test suite run. So I'm not quite sure what exactly do you want to achieve?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Stub
Posts: 266
Joined: Fri Jul 15, 2016 1:35 pm

Re: tracking number of Test Cases

Post by Stub » Thu Jun 20, 2019 8:25 am

I quite like knowing how many Test Cases I have in a feature's Test Suite too. But to gather that information I also have to run the tests, to generate the report, which tells me the total.

Could you scan the entire test suite via a code module and detect Test Cases rather than Smart Folders, and count them manually that way?

:

Hmmm, the ITestContainer has IsSmartFolder and IsTestCase properties, but doesn't seem to have a way to dig deeper into the hierarchy. Oh well, bang goes that thought.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5071
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: tracking number of Test Cases

Post by odklizec » Thu Jun 20, 2019 9:55 am

Hi,

In case you just want to get a number of testcases/smart folders, without knowing their status at the end of test, you can use something like this:

Code: Select all

int tcCount=0, sfCount= 0;
var testSuite = (TestSuite) TestSuite.Current;
IList<TestSuiteEntry> entries = testSuite.GetAllTestSuiteEntries();  
foreach(var entry in entries)  
{  
    if ((entry is TestCaseNode) && (!(entry as TestCaseNode).IsRootTestCase && !(entry as TestCaseNode).IsSmartFolder))
    {  
        tcCount = tcCount + 1;
    }  
    if ((entry is TestCaseNode) && (!(entry as TestCaseNode).IsRootTestCase && (entry as TestCaseNode).IsSmartFolder && !(entry as TestCaseNode).IsTestCase))
    {  
        sfCount = sfCount + 1;
    }  
}  
Report.Info("User","Number of TestCases:" + tcCount); 
Report.Info("User","Number of SmartFolders:" + sfCount);
Hope this helps?
Last edited by odklizec on Thu Jun 20, 2019 1:43 pm, edited 3 times in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Stub
Posts: 266
Joined: Fri Jul 15, 2016 1:35 pm

Re: tracking number of Test Cases

Post by Stub » Thu Jun 20, 2019 10:04 am

Ack, I missed the GetAllTestSuiteEntries() API! D'oh.

But I just this minute upgraded to Ranorex v9.1 for the first time and am admiring the improved progress dialog, which now includes a count of all Test Cases. So I just ran one Test Suite to see how many it had.

Whoop:
RanorexProgress.png
RanorexProgress.png (2.44 KiB) Viewed 98 times

johannes
Posts: 14
Joined: Mon Oct 17, 2016 12:40 pm

Re: tracking number of Test Cases

Post by johannes » Fri Jun 21, 2019 7:49 am

thx All :))