Forum Discussion

bdrummond's avatar
bdrummond
Contributor
7 years ago

What is the best practice technique/method to create array in (Keyword Test) Test Complete?

Hi everyone,

 

I am here to ask if anybody can give some me some direction and insight on best practices for creating an array when using Keyword testing...?

 

for e.g.,

 

  • I have a routine where I calculate the accumulation of time taken to open an 'X' number of chart. (See image 1).
  • This procedure is now looped around 'Z' number of times (See image 2)

As you can see I have the variable timeAccumulation which hold the total of accumulation time to open 'X' number of chart per 1 loop. I need this to be returned to the keyword testing and placed it in an another keyword variable which can contain an array type (See image 3). In hope that I can store each of the accumulated time per loop as an Array and calculate the mean average of it. 

 

But I couldn't see an option in Keyword Variable that you can have Array type assigned to a variable (See image 4). I do aware you can set it as table type which is a 2 dimensional array. I am no software developer, so i am not quire sure this is what i need to make a simple array.

 

I have also read in Keyword documentation that ArrayItem Object is depreciated and therefore should not be involved for creating a new test item (See image 5) - https://support.smartbear.com/testcomplete/docs/reference/project-objects/items/odt/arrayitem/index.html.

 

 

If anything above isn't clear to understand, please let me know. so far i can deal with the latest result, but it would be nice to be able to have a mean average for this calculation and not to do it manually. I am not a software developer but can read/write a basic script, so i may need 'a-help-for-dummies' kind of guide. I am sure someone out there know this work as a simple one.

 

I am looking forward to any reply from anyone.

 

Thanks

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    You are correct, there is not a quick and easy way, beyond using a Table variable type, to create an array simply using KeywordTesting stuff (the deprecated thing is simply for the ODT feature of TestComplete and not really related to this question).

     

    Your best bet for ease of use is to write a script routine to construct your array and store the result in an Object data type.

    • Marsha_R's avatar
      Marsha_R
      Champion Level 3

      Using a Table variable would work fine here, wouldn't it?  Just stick the time value in there every time you loop through the measurement and when you're done with that, loop through the Table variable to do your calculation.

      • bdrummond's avatar
        bdrummond
        Contributor

        yes it is possible and i have found out how to use them (table variable). Using the script routine to create columns and row(s) to enter each individual accumulation time.

         

        But unfortunately, for me, the way i have written the test design has required more thought into it. so i decided to use a workaround method and because I am already too deep into creating my test I have decided to use a script routine to construct my array. 

         

        But at least now I know what Table variable can do and made me learn how to design my test better in the future.

         

        thanks for your interest and sharing your thought.

         

        BD