Forum Discussion

MadhuLambu's avatar
MadhuLambu
Contributor
31 days ago

Count number of test cases in Execution Plan

Hello Community,

I want to count the test items in the project's execution plan that are marked as test case and print their names. Any suggestion?

function CountTestCasesRecursive(testItem) {
  let count = 0;
  if (testItem.TestCase) {  //there's no property called TestCase
    count++;
  }
  for (let i = 0; i < testItem.ItemCount; i++) {
    count += CountTestCasesRecursive(testItem.TestItem(i));
  }
  return count;
}

  • Oh, well now you know one advantage of keeping your test modules small!

    You can try picking the test cases out of the .mds file.

  • You could write the name to a spreadsheet as you run the test and use the spreadsheet to eliminate duplicates and give a count.

    • MadhuLambu's avatar
      MadhuLambu
      Contributor

      I have several projects and it takes >16 hours for each to run. So unfortunately, that's not an option for me.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Read the .mds file as Marsha_R has mentioned. It's an XML based file, and you should be able to extract the required information.