I am having a webtable which contains around 20 rows, I am trying to set a webtable checkpoint and check all the values in each row, I am bringing the expected value from the database and dumping them in the datatable,
now for the webtable checkpoint how can I move the cursor row by row and check the values?
First, let me say I never use checkpoints, so my understanding may be a bit off. But looking through the Table Checkpoint Properties Dialog Box, it seems you can configure the expected data to a parameter, and that parameter can be your datatable.
So since you've loaded your expected values from your database and dumped them into the datatable, why not simply check all rows at once, since that is an option in the Define Row Range dialog box?
Does that not work? If not, what problem are you seeing?
If you do want to step through it manually (which is what I do) then you use .SetCurrentRow() and .SetNextRow to move through your datatable and you use .GetCellData() to get values from your web table and you simply compare them in a pair of nested For..Next loops:
<font class="small">Code:</font><hr /><pre>
For i = 0 to RowCount -1 'get the row count with the .RowCount method
For j = 0 to ColumnCount -1 ''get the column count with the .ColumnCount method
var_GetCellData = Browser().Page().WebTable().GetCellData(i,j)
If var_GetCellData = DataTable(j,dtLocalSheet) Then
Reporter.ReportEvent micPass, "Test Row " & i & ", column " & j, "Expected " & DataTable(j,dtLocalSheet) & " and found " & var_GetCellData
Reporter.ReportEvent micFail, "Test Row " & i & ", column " & j, "Expected " & DataTable(j,dtLocalSheet) & " and found " & var_GetCellData
Make sure your datatable column headers are numbered to match your column counts.
I wrote that from my head, so I apologize in advance if I threw in a syntax error or two, but that should be the gist of it. It will check every cell and give you a pass/fail on every cell it checks. For a big table, this can add up to hundreds or thousands or tens of thousands of passes and or fails in your test log, so you may want to disable the ReportEvent for the pass message.
Hope that helps.
"The last 10% of any software project will take 90% of the budgeted time. The first 90% will take the other 90%"