Forum Discussion

lucieneven's avatar
lucieneven
Contributor
13 years ago

can we avoid too many magic numbers in the script?

Hello,



When i checked my script recorded by TestComplete, i noticed many Magic numbers. One thing i don't understand is why TestComplete will note down the coordinate value like below:



Call table.cell1.linkJavascriptSubmit.textnodeLogin.Click(25, 7)



Instead, I tried the QTP, simple the code is like below:



Browser("JMap Admin").Page("JMap Admin").Link("Login").Click



That's for the same operation, click login links.



This kind of existing magic numbers makes me a little bit upset, because when playing back the script, from times to times, it happens to me that object not found or doesn't exist.



May i ask whether this is an issue or there's something we can do to work around the magic numbers.



Thanks for your help,



Lucien

1 Reply

  • Hi,



    'Magic numbers' are any hard-coded numeric constants, no matter to what method they're passed. You can remove coordinates from Click calls, in this case, TC will click the target control in its center.