Forum Discussion

Novari-QA's avatar
Novari-QA
Frequent Contributor
8 years ago

Script Extensions - Why isn't it working?

Good day all,
I am having a lot of trouble with Script Extensions. I am trying to instal a .TCX file and it just doesn't seem to be working as expected.

I thought my scripts where the problem so I went and found another script extension that I wanted to try out. 

I put the .js file and the Description.xml file into a folder.
I then zipped the folder

I then renamed the zipped folder to have a new extension of .tcx
I double clicked the file

I installed the file in 'C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\Extensions\ScriptExtensions'
I restarted TestComplete

 

 

Expected:

Go into a file, and type the script extension file name, once you begin typing, intellisense picks up the fact that you are trying to utilize that extension and trys to autocomplete for you.

 

Actual:

The IDE has no idea my extension exists.


What am I missing?

  • tristaanogre's avatar
    tristaanogre
    8 years ago

    Um... I see it already... no subfolders within the TCX file... should be just a zipped folder with the JS and XML files right inside.  Basically, don't add the folder to a zip, add the files to a zip and then rename.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The script extension name is not the filename.  For example, I have a script extension in my repostiry where the filename is DDTLibrary.tcx.  However, the object as it is rendered in TestComplete is DDTLib.  Why?

     

    This comes from the Description.XML file.  

     

    <ScriptExtensionGroup Name="Data Driven Helpers">
        <Category Name="Data Driven Helpers">
            <ScriptExtension Name="Data Driven Helpers" Author="Robert Martin" Version="1.0">
                <Script Name="DDTLibrary.js">
                    <RuntimeObject Name="DDTLib">
                        <Method Name="CloseDriver" Routine="CloseDriver">Closes the DDT driver specified by the name</Method>
                        <Description>Provides helper methods for working with DDT objects</Description>
                    </RuntimeObject>
                </Script>
                <Description>Provides helper methods for working with DDT objects</Description>
            </ScriptExtension>
        </Category>
    </ScriptExtensionGroup>

    Note the "RuntimeObject Name=   " portion.   That Name value is what shows up in Intellisence and so on as the object within TestComplete.

     

    So... your problem is probably due to something wrong with your XML file.  If you'd care to share your XML file and the script code file that goes along with it, someone here should be able to help you debug it.

    • Novari-QA's avatar
      Novari-QA
      Frequent Contributor
      <ScriptExtensionGroup Name="TristaanOgre Community Extensions">
          <Category Name="TristaanOgre Community Extensions">
              <ScriptExtension Name="SQL Utilities" Author="Robert Martin" Version="3.0" HomePage="bitbucket.org/account/user/privateteamogre/projects/CSE">
                  <Script Name="SQLUtilities.js">
                      <Option Name = "SQLType" DefaultValue = "MSSQL"/>
                      <Option Name = "SecurityType" DefaultValue = "INTEGRATED"/>
                      <RuntimeObject Name="SQLUtilities">
                          <Method Name="NewSQLQuery" Routine="sqlQuery">Creates an SQL object based upon a string and a set of parameter objects</Method>
                          <Method Name="FormatDateForSQL" Routine="FormatDateForSQL">Takes an integer as an offset date in days, adds it to the current date, and returns a string formatted as YYYY-MM-DD</Method>
                          <Method Name="SetSQLType" Routine="setSQLType">Sets the SQL Type script option to the indicated string value. Currently supports MSSQL and MYSQL_351</Method>
                          <Method Name="SetSQLSecurityType" Routine="setSecurityType">Sets the SQL Login type. Enter either INTEGRATED or PROMPT.</Method>
                          <Method Name="NewQueryObject" Routine="queryObject">Creates a query object for building SQL Query</Method>
                          <Property Name="DatabaseName" GetRoutine="getDatabaseName" SetRoutine="setDatabaseName">The name of the SQL Database against which SQL queries will be run</Property>
                          <Property Name="SQLServerName" GetRoutine="getSQLServerName" SetRoutine="setSQLServerName">The name of the SQL server against which SQL queries will be run</Property>
                          <Property Name="ConnectionString" GetRoutine="getConnectionString">The Connection String used for SQL Query operations</Property>
                          <Property Name="SQLUserName" GetRoutine="getUserName" SetRoutine="setUserName">The SQL user name for the database connection if needed</Property>
                          <Property Name="SQLPassWord" GetRoutine="getPassWord" SetRoutine="setPassWord">The SQL Password for the database connection. WARNING! It is unencrypted</Property>
                          <Description>A runtime object providing a wrapper for several SQL Query related functions used in automation tests.  If they don't exist, will create a DatabaseName and SQLServerName project variables</Description>
                      </RuntimeObject>
                  </Script>
                  <Description>A Set of Runtime objects used for SQL Operations</Description>
              </ScriptExtension>
          </Category>
      </ScriptExtensionGroup>

      Above is the XML file in question. It may look familiar ;)

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Well, yes... yes it does.

         

        So, the intellisense should show SQLUtilities as the object with the different methods available.

         

        Let's check something...  Go to File | Install Script Extensions and see if the extension shows up there.  If not, click the "Reload" button and then check again.