Forum Discussion
AlexanderM
15 years agoStaff
Hi,
To automate checkpoints creation for one page, I suggest that you use the approach described below:
1. Create the "regions1.txt" file containing regions parameters, for example:
10,10,10,20
...
25,13,100,100
This file should contain regions parameters - you should specify them in the same order as they are specified for the Picture method. To successfully perform the next step, make sure that this file does not contain empty strings.
2. From TestComplete, run the script below:
/JScript
function GenerateCheckpoints()
{
var code = "";
var obj = <...>; // Specify here the full path to the object for which checkpoints will be created
var f = aqFile.ReadWholeTextFile("c:\\regions1.txt", 20);
var rects = f.split(chr(13)+chr(10));
for (var i = 0; i < rects.length; i++)
{
var x = rects.split(",")[0];
var y = rects.split(",")[1];
var width = rects.split(",")[2];
var height = rects.split(",")[3];
Regions.AddPicture(obj.Picture(x, y, width, height), "Image"+i);
code = code + "Regions.Compare(\"Image"+i+"\", obj.Picture("+x+", "+y+", "+width+", "+height+", false));" + chr(13) + chr(10);
}
Sys.Clipboard = code;
}
This code fills the Stores collection with images and generates ready-to-use code (it will be in the clipboard right after executing).
Having several regionsN.txt files and having modified the GenerateCheckpoints routine a bit, you will be able to automate checkpoint creation for other pages.
See the 'Regions.AddPicture' and 'Regions.Compare' help topics for the method's usage information.
Related Content
- 5 years ago
- 3 years ago
- 11 years ago
Recent Discussions
- 7 hours ago