3. Creating the Description File

Applies to TestComplete 15.45, last modified on December 01, 2022

Now let’s create a skeleton of the description file that will provide information about our custom keyword test operation. When our script extension is ready, TestComplete will use this file to install the extension.

The description file has the XML format. To create it, you can use any text or XML editor:

  • Launch your editor and enter the following text in it:

    XML

    [description.xml]

    <?xml version="1.0" encoding="UTF-8"?>
    <ScriptExtensionGroup>
      <Category Name = "Keyword Test Operations">

        <ScriptExtension Name = "Log Attributes Keyword Test Operation" Author = "SmartBear Software" Version="1.0 test" HomePage = "smartbear.com">    
          <Description>Provides the Log Attributes keyword test operation.</Description>
          <Script Name = "laCode.js">
            <KDTOperation Name = "Log Attributes" Category = "Logging">
            </KDTOperation>
          </Script>        
        </ScriptExtension>

      </Category>
    </ScriptExtensionGroup>

  • Save the file under the description.xml name to the C:\My Extension Files\LogAttrExtension folder.

    The file name must be description.xml. When a script extension is installed in TestComplete, the latter searches for the file with this name and retrieves information from it.

Let’s examine the file contents.

The root element is ScriptExtensionGroup, which corresponds to a collection of script extensions. The ScriptExtensionGroup element can have one or more children Category elements that define the categories to which the extensions belong. The category names are shown in the Script Extensions dialog and are used to group extensions into the appropriate categories (see the image below). In this tutorial, we specify that our custom script extension belongs to the Keyword Test Operations category.

Each script extension is represented by the ScriptExtension element. Its attributes provide information about the extension. This info is also shown in the Script Extensions dialog (see the image below). The extension description is specified by the child Description element:

ScriptExtension Attributes

A combination of the Name, Author, and Version attributes are used as the extension identifier. If the extensions list already contains an extension with the same Name, Author, and Version value, a new extension will not be installed into the list. In this tutorial, we specify the 1.0 test value for the Version attribute in order to avoid conflicts with the pre-installed Log Attributes extension.

The ScriptExtension element contains the Script child element corresponding to the script unit that will be included into the extension. The Name attribute of this element specifies the name of the script file; in our example it is laCode.js:

XML

[description.xml]
 

...
<Script Name="laCode.js">
  <KDTOperation Name = "Log Attributes" Category = "Logging">
    ...
  </KDTOperation>
</Script>
...

The Script element may also have the InitRoutine and FinalRoutine attributes that specify the script functions that perform the initialization and finalization actions. In our tutorial, these attributes are not needed.

The Script element may contain one or more child KDTOperation elements. These elements correspond to custom keyword test operations that extend the TestComplete operation set. In this tutorial, we only use one KDTOperation element, which defines our Log Attributes operation. The element’s Name attribute specifies the operation name that is displayed in the operations palette, namely, Log Attributes. The Category attribute specifies the name of the category to which TestComplete will add the operation. In this tutorial, the operation will belong to the Logging category, which contains operations relating to the test log:

XML

[description.xml]
 

...
<Script Name="laCode.js">
  <KDTOperation Name = "Log Attributes" Category = "Logging">
    ...
  </KDTOperation>
</Script>
...

The description file is not finished yet. We will update it on further steps as we proceed with the operation implementation.

For details about elements and attributes that are used in the description files, see topics of the Script Extension Files section.

Prev     Next

See Also

Script Extensions
Script Extension Files
Structure of the Description File

Highlight search results