Forum Discussion

golnar's avatar
golnar
New Contributor
10 years ago
Solved

Setting the value of a non fixed position variable

I have to create a test for a  report page,  we can set the section name,like Advising Load, start year, like 2012, and end year, like 2014,and see all the actvities for that section, during the start year and end year. The result will be in a table, that columns are different semers, like spring 2011, all 2011, .. and rows shows the number of activity in each term, and also the totall number of the selected activity during the start and end year. I have to record the value of  totall. But after recording a test, if I change the start and end year, and run the test, since the postion of totall value, will change,  my recorded test can not find the totall value.

Is there anyway to fix this problem?
  • Hi Golnar,

     


    It's quite difficult to suggest something without seeing your recorded tests or your tested app. 


    If you are using Name Mapping in your test, you need to carefully map the objects, and choose mapping criteria that won't change from run to run, or the values that you can control by changing the project variables.


     


    Anyway, we need more information to tell you anything for sure.

3 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)
    Hi Golnar,

     


    It's quite difficult to suggest something without seeing your recorded tests or your tested app. 


    If you are using Name Mapping in your test, you need to carefully map the objects, and choose mapping criteria that won't change from run to run, or the values that you can control by changing the project variables.


     


    Anyway, we need more information to tell you anything for sure.

  • golnar's avatar
    golnar
    New Contributor
    I need the value which I have shown in my pictures in red box, as you can see by chnaging the term, the postion of that table cell changes, so even if I carete a Property chekponi for that cell in my first picture, and run the test, but change the term and make it like second picture, it will give me error.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)
    Hi Golnar,

     


    Thanks for the clarification. 


    Actually, the algorithm can look like this:


    1. You obtain the index of the Total column by iterating through all columns.


    2. The last row of the table will always show the Total value.


    3. When you know the column index and the row line, you can get the value of the needed column.


     


    I recommend that you explore the table in TestComplete's Object Browser. To see all available properties, make sure that you are using the Advanced View mode, and showing hidden properties is allowed in TestComplete. Please refer to the "Basic and Advanced View Modes" article for details.