Forum Discussion

siv_arunprakash's avatar
siv_arunprakash
Contributor
7 years ago

Setting Count of Test Item from DataSource

Hi,

 

How do I set the Count of the Test Items dynamic?.

 

Project.TestItems.TestItem(1).Count gives me the number of Iteration this test item will run.

 

I need to set the count like Project.TestItems.TestItem(1).Count = 2;

 

I think this is not supported by test complete. Is there any way or workaround to set the count value dynamic from a variable.

 

Please Help.

  • Currently, there is not.  The best way to do something like this with TestComplete is to set a loop within your test itself and set the upper limit of the loop to be a variable that you can set dynamically.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Currently, there is not.  The best way to do something like this with TestComplete is to set a loop within your test itself and set the upper limit of the loop to be a variable that you can set dynamically.

    • siv_arunprakash's avatar
      siv_arunprakash
      Contributor

      Hi,

       

      I have multiple separated Keyword Tests (like login, logout, env setup) and script routines which is grouped under Test Items in the project level.

       

      Now how do I set the loop in test level ?. I have multiple Test Items which I need to loop exactly similar to the Count functionality.

       

      Sample structure:

                - ProjectName

                        -TestItem1

                               -Setup Env

                               -Login

                               -Logout

                        -TestItem2

                               -Setup Env

                               -Login

                               -Logout

       

      Now i need to loop the TestItem1 and TestItem 2 based on the external datasource.

       

      Please help.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        As mentioned, you cannot.  The "Count" value is read-only at runtime.  To do what you want, you'll need to re-architect the way your tests run so that, rather than being organized as TestItems, you organize them within code to execute within a loop.