Forum Discussion
An alternative to the import/export functionality of JavaScript is, in your unit in which you want to use the constants, add
//USEUNIT <unitname>
at the top of the unit. This will bring over everything... otherwise, yes... you would need to declare all the constants.
An additional alternative would be, rather than having the constants sitting out there in the open, put them in some sort of object. Something like
var myContants = {colSelect_RSR: 0, colSts_RSR: 10 ... etc...}
Then, just export myConstants and reference the different properties.
A slightly more advanced alternative would be to wrap all your constants in read-only properties of a Script Extension RunTime object.
- CSL7 years agoContributor
Hi Robert,
Thank you for your quick answer. I am very new in Test Complete so this definitely helps me. Anyway, so when I use //UseUnit, I don't need to export/import them? Can I use //USEUNIT in javascript?
Thanks,
- tristaanogre7 years agoEsteemed Contributor
Correct, with //USEUNIT you don't need to the export/import stuff and it is available in JavaScript in TestComplete
- CSL7 years agoContributor
Awesome, but I'm wondering what is the purpose of import/export then. Why does TC even have that? just curious.
Thanks, I'll give //USEUNIT a try.
Related Content
- 10 months agolodecesa
Recent Discussions
- 10 hours agosimonaferrara
- 19 hours agoSubhraDas