I am working on webbased application in which there is a webtable.in this in column no 3 some data should be displayed.My requirement is it should not be displayed more than 3 times ( same data).Here i used getcelldata(i,3)to fetch cell content and stored in a variable.How can i validate that same data should not displayed more than 3 times..
Put a counter, everytime you find the particular data,
i) increment the counter by 1 and
ii) compare whether it is the fourth (or more) time that the data is repeated.
iii) If it is the fourth (or higher) time that the data is displayed, put a fail statement.
You can continue with the test-case instead of stopping, as this is the thumb rule (atleast as per me) to continue the test - unless we encounter some fatal error. That will help in batch runs.
but you are asking code... its a simple logic, basic scripting knowledge is enough.
anyway try below code
<font class="small">Code:</font><hr /><pre>counter = 1
for i = 1 to 4
ExpectedValue = obj.getcelldata(i,3)
counter = counter+1
if ExpectedValue <> null and counter >3