A question about proper way of writing scripts. Test complete will return the errors automatically if the objects do not exist after the specific timeout or any files/regions/objects comparison failure
b) objects.compare(A.bmp, B.bmp)
I am very happy to write these formats but I would like to see the pass results of any comparison.
Normally, I write the scripts as follows:
a) if not w.waitWindow('myform','*',-1,5000).Exists then
Log.error('form not found')
// continue running the next scripts
b) if not objects.compare(A.bmp, B.bmp) then
Log.error('object comparison failed on A.bmp')
Log.message('object comparison passed on A.bmp')
It is good to write these formats in order to debug/investigate scrpts from the log results. However, I have found it would be too much to write these duplicate messages as I have many process/windows opened or object/files/regions comparisons in my project.
I have tried to place these scripts in a procedure with providing parameters. But it is inconvenient to debug scripts , because it goes to this procedure in child unit (procedure stored) but not the parent unit when you double click the files comparison failure in the log results. And then, I have to switch back to the log results again and find a script before running this file comparison failed script in order to find the parameters of the comparison procedure.
Are there other easy way to return the passed results of files/objects comparison rather than writing the above format on each comparison script? I appreciate with any help? Thanks!
Re: scripts format
There is no another way to get rid of a repetitive code and leave links between log entries and correct script lines. However, you can automate the process of writing such code constructions by using the Code Templates feature. You can find information on this feature in the 'Code Templates' help topic.