Forum Discussion
This is a good place to start:
https://support.smartbear.com/testcomplete/docs/testing-with/checkpoints/index.html
- nisgupta6 years agoValued Contributor
these are the check points . I am already using the property checkpoints.
I looked at the database checkpoint but this will not slove the issue .
My concerns is how will I match the value that shows in UI to the database value. As in the database we are showing the values rows. In UI we are showing the same values in the one Text with spaces in between
For e.g
in database
TB
TR
TT
In UI
TB TR TT
Thanks
NG
- Marsha_R6 years agoChampion Level 3
There are all sorts of string operations you can use to pick apart the text with spaces
https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqstring/methods.html
What I might do is read the whole text string from the UI into a variable, then use Trim to take the spaces out. After that you can loop through the string 2 spaces at a time and get the next pair out to compare to the database. Or you could not take the spaces out and loop through 3 at a time and do the compare with the first two and skip the space. Or if you don't mind destructive testing, you can compare to the first pair and then delete them so you are always comparing to the first two.
- RUDOLF_BOTHMA6 years agoCommunity Hero
If you are certain the UI will display in format [text][space][text][space][text], you could consider using .split. Rough outline like so:
var UItext = holdcodesobject.contentText //This should be 'TB TR TT var UISplitText = UItext.split(' '); //Now compare one item at a time for(var I=0;i<UISplitText.length;i++) { //depending on usage, you should be able to use one of the following
/// OPTION 1 if(!databale.IsEOF()) {
databale.MoveNext() //or the method that moves to the next current record
if(UISplitText[i]!=datatable.GetValue(0)) //can't recall the syntax for getting the value from column 0 - you will need to double check this
{
log.error("a field didn't match");
break;
} } else { Log.Error("No data in datatable"); }
//OPTION 2
if(datatablerowcount>0)
{ if(UISplitText[I]!=[datatable row i, column 0] //consider aqstring.ToUpper() and .Trim() on both sides.
{
log.error("a field didn't match");
break; } }
}
else
{
Log.Error("No data in datatable");
}Also, your first check could be to make sure that your UIsplitText's length is the same as the record count of your datatable before you even compare the items per row. If they aren't, there will obviously be an error in matching