Forum Discussion

warinthira's avatar
warinthira
New Contributor
5 years ago
Solved

Keyword Test - How to verify data value in auto-generated table which contain auto-generated objectI

Hi

Keyword Test - How to verify data value in the auto-generated table which contains auto-generated objectID and objectName

 

I tried verify property of the whole table and the system includes all expected value in the table. My question is how to verify the value row by row?

  • Just as a note:

    While keyword tests are great, I recommend that you learn coding skills for two reasons:

     

    1) Knowing coding logic will help in knowing how to organize tests and run more complicated logic like for loops, if-then, exception handling, etc

    2) There are some things that are much more elegant and, even, easier to do in code than in keyword tests.  They can be CALLED from keyword tests but the code is much less convoluted.

     

    That said... to obtain a cells value all you need to do is set the parameter type for whatever operation you're executing (logging a message, setting a variable, etc) to "Code expression" and then enter the full object identifier for the cell (Aliases.App.Table.Cell(i, 2)).  That should do what you need.

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The contentText is a delimited string, delimited by carriage returns.  You could read it in as such and work through it line by line.

     

    However... that Table, as as web table, has a RowCount property I'm assuming.  And Cells...  So, if you know the cells you want, you could use a for loop from 0 to RowCount-1 and compare values in the cells.

     

     

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Just as a note:

        While keyword tests are great, I recommend that you learn coding skills for two reasons:

         

        1) Knowing coding logic will help in knowing how to organize tests and run more complicated logic like for loops, if-then, exception handling, etc

        2) There are some things that are much more elegant and, even, easier to do in code than in keyword tests.  They can be CALLED from keyword tests but the code is much less convoluted.

         

        That said... to obtain a cells value all you need to do is set the parameter type for whatever operation you're executing (logging a message, setting a variable, etc) to "Code expression" and then enter the full object identifier for the cell (Aliases.App.Table.Cell(i, 2)).  That should do what you need.