Forum Discussion
- hhagay8 years agoContributor
I am probably lacking some information regarding implementing and utilizing the extension.
I followed the instructions online, I can see the extension via the extension dialog box, however I am not able to use it.
Any suggestions?
- tristaanogre8 years agoEsteemed Contributor
Extensions are a way to add functionality into TestComplete in a number of different ways. What I have been working with most often has been RunTime Objects. Basically, if you are writing script code or a Keyword test, a Runtime object from a script extension is utilized much like the built in objects like aqUtils or aqString. There are methods and properties that you can call within your test project that will do certain things during runtime.
https://support.smartbear.com/testcomplete/docs/working-with/extending/script/creating/objects/index.htmlSo... if you want to create a function, variable, method, object, etc., that you want to have available globally throughout your project, you can do so with a Runtime Object script extension. As an example, a script extension that I use in some of my personal work has variables and methods used for executing SQL queries via a runtime object. Some of the properties of that extension are things like the SQL Servername, the database name, etc. Using that extension (called SQLUtilities), I can write code like:
//The following function can be included in any project but it only ever needs to be run the first time to set up the desired settings function SQLOptions(){ SQLUtilities.SetSQLOption = 'MSSQL'; //Can be either MSSQL or MYSQL_351 SQLUtilities.SetSQLSecurityType = 'INTEGRATED'; //Can be either INTEGRATED or PROMPT } //Now, if I want to run an SQL query against my database, say I want to select a number of rows and log how many I got function checkRowCount() { var MyRows; SQLUtilities.DatabaseName = 'MyDatabase'; SQLUtilities.SQLServerName = 'MyServer'; SQLUtilities.SQLUserName = 'myusername'; //This is not necessary since I'm using integrated security. Provided in example to allow for editing and adaptation SQLUtilities.SQLPassWord = 'mypassword'; //This is not necessary since I'm using integrated security. Provided in example to allow for editing and adaptation MyRows = SQLUtilities.ExecSQLQueryFromString('SELECT * from myTable'); Log.Message('We got ' + MyRows + ' back'); }
So, to answer your OP, you could create a Runtime Object script extension which would contain those global variables as read/write properties on your runtime object that you can then access from any script or test in any project.
Related Content
- 6 years ago
- 9 years ago
- 12 months ago
- 11 years ago
- 11 years ago
Recent Discussions
- 11 minutes ago
- 21 hours ago
- 2 days ago